5namespace XXSharpKmyMath{
7 private value struct Vector3{
17 Vector3(
float _x,
float _y,
float _z)
26 return sqrt(x*x + y*y + z*z);
29 kmyMath::Vector3 toNative() {
30 return kmyMath::Vector3(x, y, z);
33 static Vector3 fromNative(
const kmyMath::Vector3& v) {
34 return Vector3(v.x, v.y, v.z);
37 static Vector3 normalize(Vector3 v)
39 float l = sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
47 static Vector3 operator-(Vector3 v1, Vector3 v2)
56 static Vector3 operator+(Vector3 v1, Vector3 v2)
65 static Vector3 operator*(Vector3 v,
float f)
74 static Vector3 operator*(Vector3 v1, Vector3 v2)
83 static Vector3 operator/(Vector3 v,
float f)
92 static Vector3 operator- (Vector3 v)
101 static float dotProduct(Vector3 v1, Vector3 v2)
103 return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z;
106 static Vector3 crossProduct(Vector3 v1, Vector3 v2)
109 tmp.x = v1.y * v2.z - v1.z * v2.y;
110 tmp.y = v1.z * v2.x - v1.x * v2.z;
111 tmp.z = v1.x * v2.y - v1.y * v2.x;
115 static Vector3 one = Vector3(1, 1, 1);
116 static Vector3 zero = Vector3(0, 0, 0);