public decimal EvalAtPoint(Coordinate co) { return(A * co.X + B * co.Y + C * co.Z + D); }
/// <summary> /// Project a point into the space of this plane. I.e. Get the point closest /// to the provided point that is on this plane. /// </summary> /// <param name="point">The point to project</param> /// <returns>The point projected onto this plane</returns> public Coordinate Project(Coordinate point) { // http://www.gamedev.net/topic/262196-projecting-vector-onto-a-plane/ // Projected = Point - ((Point - PointOnPlane) . Normal) * Normal return(point - ((point - PointOnPlane).Dot(Normal)) * Normal); }
public Quaternion(Coordinate vector, decimal scalar) { Vector = vector; Scalar = scalar; }
public Quaternion(decimal x, decimal y, decimal z, decimal w) { Vector = new Coordinate(x, y, z); Scalar = w; }
public static Quaternion AxisAngle(Coordinate axis, decimal angle) { return(axis.VectorMagnitude() == 0 ? Identity : new Quaternion(axis.Normalise() * DMath.Sin(angle / 2), DMath.Cos(angle / 2)).Normalise()); }