Beispiel #1
0
 public static Vector3D Cross(Vector3D a, Vector3D b)
 {
     Vector3D cross = 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);
     return cross;
 }
Beispiel #2
0
		public Vertex(Vector3D position, Vector3D normal, Vector4D tangent, UV uv1, UV uv2, Color4 color)
		{
			Position = position;
			Normal = normal;
			Tangent = tangent;
			UV1 = uv1;
			UV2 = uv2;
			Color = color;
		}
Beispiel #3
0
		public Vertex(Vertex vertex)
		{
			Position = vertex.Position;
			Normal = vertex.Normal;
			Tangent = vertex.Tangent;
			UV1 = vertex.UV1;
			UV2 = vertex.UV2;
			Color = vertex.Color;
		}
Beispiel #4
0
		public static Plane BuildFromVertices(Vector3D a, Vector3D b, Vector3D c)
		{
			Plane p = new Plane ();
			Vector3D edgeA = c.SubtractedBy (a);
			Vector3D edgeB = b.SubtractedBy (a);
					
			Vector3D cross = edgeA.Cross (edgeB);
			// !! Important: inverted to be valid in left-handed space
			// TODO: make this work in either handed-ness automatically
			cross.Invert();
			p.Normal = cross.Normalized();

			p.D = p.Normal.Dot (a);
			return p;
		}
Beispiel #5
0
		public Plane(Vector3D normal, float d)
		{
			Normal = normal;
			D = d;
		}
Beispiel #6
0
 public static float Dot(Vector3D a, Vector3D b)
 {
     return a.X * b.X + a.Y * b.Y + a.Z * b.Z;
 }
Beispiel #7
0
 public Vector3D Inverted()
 {
     Vector3D inverted = new Vector3D(this);
     inverted.Invert ();
     return inverted;
 }
Beispiel #8
0
 public Vector3D Lerped(Vector3D dest, float t)
 {
     return new Vector3D(this).AddedWith(dest.SubtractedBy (this).MultipliedBy (t));
 }
Beispiel #9
0
 public Vector3D Cross(Vector3D b)
 {
     return Cross (this, b);
 }
Beispiel #10
0
 public float Dot(Vector3D b)
 {
     return Dot (this, b);
 }
Beispiel #11
0
 public void Add(Vector3D b)
 {
     this.X += b.X;
     this.Y += b.Y;
     this.Z += b.Z;
 }
Beispiel #12
0
 public Vector3D AddedWith(Vector3D b)
 {
     Vector3D added = new Vector3D (this);
     added.Add (b);
     return added;
 }
Beispiel #13
0
 public Vector3D MultipliedBy(float factor)
 {
     Vector3D multiplied = new Vector3D(this);
     multiplied.MultiplyBy (factor);
     return multiplied;
 }
Beispiel #14
0
 public Vector3D Normalized()
 {
     Vector3D normalized = new Vector3D(this);
     normalized.Normalize ();
     return normalized;
 }
Beispiel #15
0
 public Vector3D(Vector3D src)
 {
     X = src.X;
     Y = src.Y;
     Z = src.Z;
 }
Beispiel #16
0
 public Vector3D SubtractedBy(Vector3D b)
 {
     Vector3D subtracted = new Vector3D (this);
     subtracted.Subtract (b);
     return subtracted;
 }
Beispiel #17
0
 public void Subtract(Vector3D b)
 {
     this.X -= b.X;
     this.Y -= b.Y;
     this.Z -= b.Z;
 }