Example #1
0
		public Triangle(Triangle triangle)
		{
			OrientationPlane = triangle.OrientationPlane;
			A = triangle.A;
			B = triangle.B;
			C = triangle.C;
		}
Example #2
0
		public Triangle(Vertex a, Vertex b, Vertex c)
		{
			OrientationPlane = Plane.BuildFromVertices(a.Position, b.Position, c.Position);
			A = a;
			B = b;
			C = c;
		}
Example #3
0
		public Vertex(Vertex vertex)
		{
			Position = vertex.Position;
			Normal = vertex.Normal;
			Tangent = vertex.Tangent;
			UV1 = vertex.UV1;
			UV2 = vertex.UV2;
			Color = vertex.Color;
		}
Example #4
0
		public void Invert()
		{
			OrientationPlane.Invert ();

			A.Invert();
			B.Invert();
			C.Invert();

			Vertex temp = A;
			A = C;
			C = temp;
		}
Example #5
0
		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;
		}
Example #6
0
		public void SetVertexByIndex(int index, Vertex vertex)
		{
			switch(index)
			{
			case 1:
				B = vertex;
				break;
			case 2:
				C = vertex;
				break;
			default:
				A = vertex;
				break;
			}
		}
Example #7
0
 /**
  * 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;
 }