/// <summary> /// Bezier constructor /// </summary> /// <param name="P1">P1</param> /// <param name="P2">P2</param> /// <param name="P3">P3</param> /// <param name="P4">P4</param> public BezierD( PointD P1, PointD P2, PointD P3, PointD P4 ) { this.P1 = P1; this.P2 = P2; this.P3 = P3; this.P4 = P4; return; }
/// <summary> /// Distance between two points /// </summary> /// <param name="Other">Other point</param> /// <returns>Distance</returns> public Double Distance( PointD Other ) { return((new LineD(this, Other)).Length); }
/// <summary> /// LineD constructor (two points) /// </summary> /// <param name="P1">Point 1</param> /// <param name="P2">Point 2</param> public LineD( PointD P1, PointD P2 ) { this.P1 = P1; this.P2 = P2; return; }
/// <summary> /// PointD constructor /// </summary> /// <param name="Center">Center point</param> /// <param name="Radius">Radius</param> /// <param name="Alpha">Angle</param> public PointD( PointD Center, Double Radius, Double Alpha ) { this.X = Center.X + Radius * Math.Cos(Alpha); this.Y = Center.Y + Radius * Math.Sin(Alpha); return; }
/// <summary> /// Bezier constructor /// </summary> /// <param name="P1">P1</param> /// <param name="Factor2">Factor2</param> /// <param name="Alpha2">Alpha2</param> /// <param name="Factor3">Factor3</param> /// <param name="Alpha3">Alpha3</param> /// <param name="P4">P4</param> public BezierD( PointD P1, Double Factor2, Double Alpha2, Double Factor3, Double Alpha3, PointD P4 ) { // save two end points this.P1 = P1; this.P4 = P4; // distance between end points LineD Line = new LineD(P1, P4); Double Length = Line.Length; if(Length == 0) { P2 = P1; P3 = P4; return; } // angle of line between end points Double Alpha = Line.Alpha; this.P2 = new PointD(P1, Factor2 * Length, Alpha + Alpha2); this.P3 = new PointD(P4, Factor3 * Length, Alpha + Alpha3); return; }