public GeoLine(Point p1, Point p2) { P1 = p1; P2 = p2; _direction = p2 - p1; Length = _direction.Length; _direction.Normalize(); GraphicHelper.CalcABC(p1, p2, out A, out B, out C); }
public IEnumerable <Point> ToSegments(double segmentLength) { var points = GraphicHelper.ToSegments(_center, _radius, 0, Math.PI * 2, segmentLength); if (_isReverse) { points.Reverse(); } return(points); }
public IEnumerable <Point> ToSegments(double segmentLength) { var points = GraphicHelper.ToSegments(_degree, _controlPoints, _knots, _weights, _startParameter, _endParameter, _length, segmentLength); if (_isReverse) { points.Reverse(); } return(points); }
public IEnumerable <Point> ToSegments(double segmentLength) { var points = GraphicHelper.ToSegments(_center, _radius, Utilities.AngleToRadian(_startAngle), Utilities.AngleToRadian(_endAngle), segmentLength); if (_isReverse) { points.Reverse(); } return(points); }
public IEnumerable <Point> ToSegments(double segmentLength) { var vector = (Vector)_center; var transform = GraphicHelper.CreateRotateMatrix(_center, _rotateAngle); var points = GraphicHelper.ToSegments(_lr, _sr, 0, Math.PI * 2, segmentLength); if (_isReverse) { points.Reverse(); } return(points.Select(p => (p + vector) * transform)); }
public IGraphic Extend(double distance, double segmentLength, JointType jointType, IEnumerable <Segment> segments = null) { var start = Start; var end = End; var vec = GraphicHelper.GetVector(end - start) * distance; IGraphic graphic = new GraphicLine(start + vec, end + vec); if (segments != null) { graphic = new GraphicCompositeCurve(graphic.Spilt(segments, segmentLength), false); } return(graphic); }
public Point GetPoint(double length, double segmentLength) { if (length < 0 || length > Length) { throw new ArgumentOutOfRangeException(); } if (_isReverse) { length = Length - length; } var parameter = GraphicHelper.GetParameter(_lr, _sr, 0, length, segmentLength); return(_center + new Vector(_lr * Math.Cos(parameter), _sr * Math.Sin(parameter)) * GraphicHelper.CreateRotateMatrix(_center, _rotateAngle)); }
public Point GetPoint(double length, double segmentLength) { if (length < 0 || length > Length) { throw new ArgumentOutOfRangeException(); } if (_isReverse) { length = Length - length; } var parameter = GraphicHelper.GetParameter(_degree, _controlPoints, _knots, _weights, _startParameter, length, _length, segmentLength); return(GraphicHelper.ComputePoint(_degree, _knots, _controlPoints, _weights, parameter)); }
public GraphicEllipse(Point center, double lr, double sr, double rotateAngle, bool isClockwise = false) { if (lr <= 0 || sr <= 0) { throw new ArgumentOutOfRangeException(); } _center = center; _lr = lr; _sr = sr; _rotateAngle = rotateAngle; _isReverse = isClockwise; _length = GraphicHelper.ComputeArcLength(_lr, _sr, 0, Math.PI * 2, Math.PI / 4); }
public GraphicPolyLine(IEnumerable <Point> points) { if (points == null) { throw new ArgumentNullException(); } _points = GraphicHelper.FilterRepeat(points).ToList(); if (_points.Count < 2) { throw new ArgumentOutOfRangeException(); } _length = GraphicHelper.CalcLength(_points); }
public IGraphic Extend(double distance, double segmentLength, JointType jointType, IEnumerable <Segment> segments = null) { if (_isContinuously) { return(GraphicHelper.Extend(_ToSegments(segmentLength).ToList(), distance, jointType, segments, IsClosed)); } else { var graphics = _graphics.Select(graphic => graphic.Extend(distance, segmentLength, jointType)); if (graphics.Any(graphic => graphic == null)) { return(null); } return(new GraphicCompositeCurve(graphics, _isContinuously)); } }
public IEnumerable <IGraphic> Spilt(IEnumerable <Segment> segments, double segmentLength) { foreach (var segment in segments) { var startOffset = segment.StartOffset; var endOffset = segment.EndOffset; if (_isReverse) { startOffset = _length - segment.EndOffset; endOffset = _length - segment.StartOffset; } var startAngle = Utilities.RadianToAngle(GraphicHelper.GetParameter(_lr, _sr, 0, startOffset, segmentLength)); var endAngle = Utilities.RadianToAngle(GraphicHelper.GetParameter(_lr, _sr, 0, endOffset, segmentLength)); yield return(new GraphicEllipticalArc(_center, _lr, _sr, startAngle, endAngle, _rotateAngle, _isReverse)); } }
public GraphicBezier(int degree, IEnumerable <Point> controlPoints, bool isReverse = false) { if (controlPoints == null) { throw new ArgumentNullException(); } _degree = degree; _controlPoints = controlPoints.ToArray(); if (_controlPoints.Length < 2) { throw new ArgumentException(); } _isReverse = isReverse; _length = GraphicHelper.ComputeArcLength(_controlPoints, _degree, 0, 1, 0.1); }
public Vector GetTangent(double length, double segmentLength) { if (length < 0 || length > Length) { throw new ArgumentOutOfRangeException(); } if (_isReverse) { length = Length - length; } var parameter = GraphicHelper.GetParameter(_degree, _controlPoints, _knots, _weights, _startParameter, length, _length, segmentLength); var dir = GraphicHelper.ComputeVector(_degree, 1, _knots, _controlPoints, parameter); if (_isReverse) { dir = -dir; } return(dir); }
public Vector GetTangent(double length, double segmentLength) { if (length < 0 || length > Length) { throw new ArgumentOutOfRangeException(); } if (_isReverse) { length = Length - length; } var parameter = GraphicHelper.GetParameter(_lr, _sr, 0, length, segmentLength); var dir = new Vector(-_lr * Math.Sin(parameter), _sr * Math.Cos(parameter)); if (_isReverse) { dir = -dir; } return(dir); }
public GraphicEllipticalArc(Point center, double lr, double sr, double startAngle, double endAngle, double rotateAngle, bool isClockwise = false) { if (lr < 0 || sr < 0) { throw new ArgumentOutOfRangeException(); } if (startAngle > endAngle) { throw new ArgumentOutOfRangeException(); } if (endAngle - startAngle > 360) { throw new ArgumentException(); } _center = center; _lr = lr; _sr = sr; _startAngle = startAngle; _endAngle = endAngle; _rotateAngle = rotateAngle; _isReverse = isClockwise; _length = GraphicHelper.ComputeArcLength(_lr, _sr, Utilities.AngleToRadian(_startAngle), Utilities.AngleToRadian(_endAngle), Math.PI / 4); }
public IEnumerable <IGraphic> Spilt(IEnumerable <Segment> segments, double segmentLength) { var points = ToSegments(segmentLength).ToList(); return(GraphicHelper.Spilt(points, _length, segments)); }
public IGraphic Extend(double distance, double segmentLength, JointType jointType, IEnumerable <Segment> segments = null) { return(GraphicHelper.Extend(ToSegments(segmentLength).ToList(), distance, jointType, segments, IsClosed)); }
private void _Init() { _length = GraphicHelper.ComputeArcLength(_degree, _knots, _controlPoints, _weights, _startParameter, _endParameter, 0.1); _start = GraphicHelper.ComputePoint(_degree, _knots, _controlPoints, _weights, _startParameter); _end = GraphicHelper.ComputePoint(_degree, _knots, _controlPoints, _weights, _endParameter); }
public IEnumerable <IGraphic> Spilt(IEnumerable <Segment> segments, double segmentLength) { return(GraphicHelper.Spilt(_points, _length, segments)); }
public IEnumerable <Point> ToSegments(double segmentLength) { return(GraphicHelper.ToSegments(_p1, _p2, segmentLength)); }