public static MathPoint Project(this IMathPoint point, IMathPoint origin, IMathVector axis) { var a = (IMathVector) point.Subtract(origin); var t = a.Project(axis); var v = (MathVector) axis.Scale(t); return (MathPoint) origin.AddVector(v); }
/// <summary> /// 计算在某轴上的投影 /// </summary> /// <param name="point"></param> /// <param name="origin"></param> /// <param name="axis"></param> /// <returns></returns> public static MathPoint Project(this IMathPoint point, IMathPoint origin, IMathVector axis) { var a = (IMathVector)point.Subtract(origin); var t = a.Project(axis); var v = (MathVector)axis.Scale(t); return((MathPoint)origin.AddVector(v)); }
public static IMathPoint MoveAlongVector(this IMathPoint pt, IMathVector dir, double dist) { dir = dir.Normalise().Scale(dist) as IMathVector; var centerPt = pt.AddVector(dir) as IMathPoint; return(centerPt); }
public static MathPoint AddTs(this IMathPoint a, IMathVector b) { return((MathPoint)a.AddVector(b)); }