Пример #1
0
 public Plane(Vec origin, Vec x, Vec y, Vec z)
 {
     _origin = origin;
     X       = x;
     Y       = y;
     Z       = z;
     if (Math.Abs(Vec.BoxProduct(X, Y, Z) - 1) > 1e-5)
     {
         throw new ArgumentException("Cannot initialize a plane with non orthogonal system");
     }
 }
Пример #2
0
        public static bool FaceIsPlanar(List<Vec> faceVerts)
        {
            if(faceVerts.Count > 4) { throw new ArgumentException("Mesh face can only have either 3 or 4 vertices"); }
            if(faceVerts.Count < 4) { return true; }

            Vec A = Vec.Difference(faceVerts[1], faceVerts[0]);
            Vec B = Vec.Difference(faceVerts[2], faceVerts[0]);
            Vec C = Vec.Difference(faceVerts[3], faceVerts[0]);

            return Vec.BoxProduct(A, B, C) == 0;
        }