public Vector3D ProjectSelfOnto(Vector3D b) { return ScalarProjectionOnto(b) * this.ToUnitVector(); }
public double ScalarProjectionOnto(Vector3D b) { return Dot(this, b) / b.Magnitude(); }
public double Dot(Vector3D b) { return X * b.X + Y * b.Y + Z * b.Z; }
/// <summary> /// Gets the angle of this object relative to the absolute X+ axis /// The angle returned is in radians. /// </summary> public float GetAngleBetween(Vector3D v) { return (float)Math.Acos((this.Dot(v)) / (this.Magnitude() * v.Magnitude())); }
public Vector3D Cross(Vector3D b) { return new Vector3D(Y * b.Z - Z * b.Y, Z * b.X - X * b.Z, X * b.Y - Y * b.X); }
/// <summary> /// Calls Vector2D.Distance(this, b) /// Returns distance between two vectors, when they are treated as points /// </summary> public double Distance(Vector3D b) { return Vector3D.Distance(this, b); }
public static double Dot(Vector3D a, Vector3D b) { return a.Dot(b); }
/// <summary> /// Treats the two vectors as points, and finds the distance between them. /// </summary> public static double Distance(Vector3D a, Vector3D b) { return new Vector3D(a.X - b.X, a.Y - b.Y, a.Z - b.Z).Magnitude(); }
public static Vector3D Cross(Vector3D a, Vector3D b) { return a.Cross(b); }
public Ray3D(Point3D position, Vector3D direction) { this.position = position; this.direction = direction; }
public Line3D(Point3D p, Vector3D v) : base(ShapeType3D.Line) { m_p = p; m_v = v; }