/// <summary> /// Divide <c>CircularArcSegment2D</c> on straight lines polygon. /// </summary> /// <param name="start">The start point of segment.</param> /// <param name="source">The segment to discretization.</param> /// <param name="target">The <c>Region2D</c> as target of discretization.</param> public void Discretize(Point start, ISegment2D source, IPolygon2D target) { CircularArcSegment2D segment = source as CircularArcSegment2D; // The angle in degrees double totalAngle = Math.Abs(segment.GetAngle(ref start)); if (angle < totalAngle || this.numberOfTiles > 1) { int numberOfTiles = Math.Max((int)Math.Ceiling(totalAngle / angle), this.numberOfTiles); double deltaAngle = totalAngle / numberOfTiles * segment.IsCounterClockwise(ref start); Matrix mat = new Matrix(); Point centre = segment.GetCentre(ref start); for (int i = 1; i < numberOfTiles; ++i) { mat.RotateAt(deltaAngle, centre.X, centre.Y); target.Add(mat.Transform(start)); } } target.Add(segment.EndPoint); }
/// <summary> /// Copies the source into a new instance of <c>CircularArcSegment2D</c>. /// </summary> /// <param name="source">The source.</param> public CircularArcSegment2D(CircularArcSegment2D source) { EndPoint = source.EndPoint; Point = source.Point; }