Esempio n. 1
0
 public static Vector4D FromTriangle(Vector3D v0, Vector3D v1, Vector3D v2)
 {
     var e1 = v1 - v0;
     var e2 = v2 - v0;
     var n = Vector3D.Cross(e1, e2).normalized;
     var d = -Vector3D.Dot(v0, n);
     return new Vector4D(n.x, n.y, n.z, d);
 }
Esempio n. 2
0
 public static double Dot(Vector3D a, Vector3D b)
 {
     return a.x * b.x + a.y * b.y + a.z * b.z;
 }
Esempio n. 3
0
 public static double Distance(Vector3D a, Vector3D b)
 {
     var dx = a.x - b.x;
     var dy = a.y - b.y;
     var dz = a.z - b.z;
     return System.Math.Sqrt(dx * dx + dy * dy + dz * dz);
 }
Esempio n. 4
0
 public static Vector3D Cross(Vector3D a, Vector3D b)
 {
     return new Vector3D(
         a.y * b.z - a.z * b.y,
         a.z * b.x - a.x * b.z,
         a.x * b.y - a.y * b.x);
 }