public Segment Clone() { Segment s = new Segment { P1 = this.P1.Clone(), P2 = this.P2.Clone(), theColor = this.theColor }; if (this.Motion != null) { Motion = this.Motion.Clone(); } return(s); }
//find a point which is dist off the end of a line segment public static PointPlus ExtendSegment(Point P1, Point P2, float dist, bool firstPt) { if (firstPt) { Vector v = P2 - P1; double changeLength = (v.Length + dist) / v.Length; v = Vector.Multiply(changeLength, v); PointPlus newPoint = new PointPlus { P = P2 - v }; return(newPoint); } else { Vector v = P1 - P2; double changeLength = (v.Length + dist) / v.Length; v = Vector.Multiply(changeLength, v); PointPlus newPoint = new PointPlus { P = P1 - v }; return(newPoint); } }
public Segment(PointPlus P1i, PointPlus P2i, ColorInt theColori) { P1 = P1i; P2 = P2i; theColor = theColori; }