Пример #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;
 }
Пример #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;
		}
Пример #3
0
		public Vertex(Vertex vertex)
		{
			Position = vertex.Position;
			Normal = vertex.Normal;
			Tangent = vertex.Tangent;
			UV1 = vertex.UV1;
			UV2 = vertex.UV2;
			Color = vertex.Color;
		}
Пример #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;
		}
Пример #5
0
		public Plane(Vector3D normal, float d)
		{
			Normal = normal;
			D = d;
		}
Пример #6
0
 public static float Dot(Vector3D a, Vector3D b)
 {
     return a.X * b.X + a.Y * b.Y + a.Z * b.Z;
 }
Пример #7
0
 public Vector3D Inverted()
 {
     Vector3D inverted = new Vector3D(this);
     inverted.Invert ();
     return inverted;
 }
Пример #8
0
 public Vector3D Lerped(Vector3D dest, float t)
 {
     return new Vector3D(this).AddedWith(dest.SubtractedBy (this).MultipliedBy (t));
 }
Пример #9
0
 public Vector3D Cross(Vector3D b)
 {
     return Cross (this, b);
 }
Пример #10
0
 public float Dot(Vector3D b)
 {
     return Dot (this, b);
 }
Пример #11
0
 public void Add(Vector3D b)
 {
     this.X += b.X;
     this.Y += b.Y;
     this.Z += b.Z;
 }
Пример #12
0
 public Vector3D AddedWith(Vector3D b)
 {
     Vector3D added = new Vector3D (this);
     added.Add (b);
     return added;
 }
Пример #13
0
 public Vector3D MultipliedBy(float factor)
 {
     Vector3D multiplied = new Vector3D(this);
     multiplied.MultiplyBy (factor);
     return multiplied;
 }
Пример #14
0
 public Vector3D Normalized()
 {
     Vector3D normalized = new Vector3D(this);
     normalized.Normalize ();
     return normalized;
 }
Пример #15
0
 public Vector3D(Vector3D src)
 {
     X = src.X;
     Y = src.Y;
     Z = src.Z;
 }
Пример #16
0
 public Vector3D SubtractedBy(Vector3D b)
 {
     Vector3D subtracted = new Vector3D (this);
     subtracted.Subtract (b);
     return subtracted;
 }
Пример #17
0
 public void Subtract(Vector3D b)
 {
     this.X -= b.X;
     this.Y -= b.Y;
     this.Z -= b.Z;
 }