public Triangle(Triangle triangle) { OrientationPlane = triangle.OrientationPlane; A = triangle.A; B = triangle.B; C = triangle.C; }
public Triangle(Vertex a, Vertex b, Vertex c) { OrientationPlane = Plane.BuildFromVertices(a.Position, b.Position, c.Position); A = a; B = b; C = c; }
public Vertex(Vertex vertex) { Position = vertex.Position; Normal = vertex.Normal; Tangent = vertex.Tangent; UV1 = vertex.UV1; UV2 = vertex.UV2; Color = vertex.Color; }
public void Invert() { OrientationPlane.Invert (); A.Invert(); B.Invert(); C.Invert(); Vertex temp = A; A = C; C = temp; }
public Vertex Lerped (Vertex dest, float t) { Vertex lerped; lerped.Position = Position.Lerped (dest.Position, t); lerped.Normal = Normal.Lerped (dest.Normal, t); lerped.Tangent = Tangent.Lerped (dest.Tangent, t); lerped.UV1 = UV1.Lerped (dest.UV1, t); lerped.UV2 = UV2.Lerped (dest.UV2, t); lerped.Color = Color.Lerped (dest.Color, t); return lerped; }
public void SetVertexByIndex(int index, Vertex vertex) { switch(index) { case 1: B = vertex; break; case 2: C = vertex; break; default: A = vertex; break; } }
/** * Classify @vertex based on which side of @plane it lies. */ private static Orientation ClassifyVertexOrientation(Vertex vertex, Plane plane) { float diff = plane.Normal.Dot(vertex.Position) - plane.D; if(diff < -SplitEpsilon) return Orientation.LessThan; else if(diff > SplitEpsilon) return Orientation.GreaterThan; else return Orientation.CoPlanar; }