public Vec GlobalCoordinatesOf(Vec localCoords) { Vec local = Vec.Ensure3D(localCoords); Vec xt = Vec.Multiply(_x, local.Coordinates[0]); Vec yt = Vec.Multiply(_x, local.Coordinates[1]); Vec zt = Vec.Multiply(_x, local.Coordinates[2]); return(Vec.Sum(_origin, xt, yt, zt)); }
//transforms the given point 'vec' from the coord system of this plane to global (or what ever system the cooridnates of this plane //are in public Vec ToGlobal(Vec vec) { Vec v = Vec.Ensure3D(vec); Vec fromOrigin = Vec.Sum( X.Multiply(v.Coordinates[0]), Y.Multiply(v.Coordinates[1]), Z.Multiply(v.Coordinates[2]) ); return(Vec.Sum(fromOrigin, Origin)); }
public Mesh(List<Vec> vertices, List<ulong[]> faces) { _vertices = vertices.Select((v) => Vec.Ensure3D(v)).ToList(); _faces = new List<ulong[]>(); foreach(var face in faces) { //skipping the faces that have other than 3 or 4 vertices if(face.Length != 3 && face.Length != 4) { continue; } _faces.Add(face); } }