1 |
f4e5d893
|
Oto Šťáva
|
using UnityEngine;
|
2 |
|
|
|
3 |
|
|
namespace DeltaRobotVr
|
4 |
|
|
{
|
5 |
5b50fe1a
|
Oto Šťáva
|
|
6 |
|
|
/// <summary>
|
7 |
|
|
/// Utilities for the <c>Single3</c> struct.
|
8 |
|
|
/// </summary>
|
9 |
f4e5d893
|
Oto Šťáva
|
public class Single3Utils
|
10 |
|
|
{
|
11 |
|
|
public const float PositionScale = 0.001f;
|
12 |
|
|
|
13 |
|
|
public static Vector3 ToVector3(float x, float y, float z)
|
14 |
|
|
{
|
15 |
|
|
return new Vector3(x, y, -z) * PositionScale;
|
16 |
|
|
}
|
17 |
|
|
|
18 |
|
|
public static Vector3 ToVector3(Single3 point)
|
19 |
|
|
{
|
20 |
|
|
return ToVector3(point.X, point.Y, point.Z);
|
21 |
|
|
}
|
22 |
|
|
|
23 |
|
|
public static Vector3[] ToVector3(Single3[] curve)
|
24 |
|
|
{
|
25 |
|
|
var vectors = new Vector3[curve.Length];
|
26 |
|
|
for(int i = 0; i < curve.Length; i++)
|
27 |
|
|
{
|
28 |
|
|
var point = curve[i];
|
29 |
|
|
vectors[i] = ToVector3(point);
|
30 |
|
|
}
|
31 |
|
|
return vectors;
|
32 |
|
|
}
|
33 |
|
|
}
|
34 |
|
|
}
|