예제 #1
0
 /// <summary>
 /// Gets the linear 3d segment of the polyline 2d at specified index.
 /// </summary>
 /// <param name="pl">The instance to which the method applies.</param>
 /// <param name="index">The segment index.</param>
 /// <returns>A copy of the segment (WCS coordinates).</returns>
 /// <exception cref="ArgumentOutOfRangeException">
 /// ArgumentOutOfRangeException is thrown the index is out of range.</exception>
 public static LineSegment3d GetLineSegmentAt(this Polyline2d pl, int index)
 {
     try
     {
         return(new LineSegment3d(
                    pl.GetPointAtParameter(index),
                    pl.GetPointAtParameter(index + 1)));
     }
     catch
     {
         throw new ArgumentOutOfRangeException("Out of range index");
     }
 }
예제 #2
0
 /// <summary>
 /// Gets the arc 3d segment of the polyline 2d at specified index.
 /// </summary>
 /// <param name="pl">The instance to which the method applies.</param>
 /// <param name="index">The segment index.</param>
 /// <returns>A copy of the segment (WCS coordinates).</returns>
 /// <exception cref="ArgumentOutOfRangeException">
 /// ArgumentOutOfRangeException is thrown the index is out of range.</exception>
 public static CircularArc3d GetArcSegmentAt(this Polyline2d pl, int index)
 {
     try
     {
         return(new CircularArc3d(
                    pl.GetPointAtParameter(index),
                    pl.GetPointAtParameter(index + 0.5),
                    pl.GetPointAtParameter(index + 1)));
     }
     catch
     {
         throw new ArgumentOutOfRangeException("index");
     }
 }
예제 #3
0
 /// <summary>
 /// Gets the linear 2d segment of the polyline 2d at specified index.
 /// </summary>
 /// <param name="pl">The instance to which the method applies.</param>
 /// <param name="index">The segment index.</param>
 /// <returns>A copy of the segment (OCS coordinates).</returns>
 /// <exception cref="ArgumentOutOfRangeException">
 /// ArgumentOutOfRangeException is thrown the index is out of range.</exception>
 public static LineSegment2d GetLineSegment2dAt(this Polyline2d pl, int index)
 {
     try
     {
         Matrix3d WCS2ECS = pl.Ecs.Inverse();
         return(new LineSegment2d(
                    pl.GetPointAtParameter(index).TransformBy(WCS2ECS).Convert2d(),
                    pl.GetPointAtParameter(index + 1.0).TransformBy(WCS2ECS).Convert2d()));
     }
     catch
     {
         throw new ArgumentOutOfRangeException("Out of range index");
     }
 }
예제 #4
0
 /// <summary>
 ///     Gets the arc 2d segment of the polyline 2d at specified index.
 /// </summary>
 /// <param name="pl">The instance to which the method applies.</param>
 /// <param name="index">The segment index.</param>
 /// <returns>A copy of the segment (OCS coordinates).</returns>
 /// <exception cref="ArgumentOutOfRangeException">
 ///     ArgumentOutOfRangeException is thrown the index is out of range.
 /// </exception>
 public static CircularArc2d GetArcSegment2DAt(this Polyline2d pl, int index)
 {
     try
     {
         var wcs2Ecs = pl.Ecs.Inverse();
         return(new CircularArc2d(
                    pl.GetPointAtParameter(index).TransformBy(wcs2Ecs).Convert2D(),
                    pl.GetPointAtParameter(index + 0.5).TransformBy(wcs2Ecs).Convert2D(),
                    pl.GetPointAtParameter(index + 1.0).TransformBy(wcs2Ecs).Convert2D()));
     }
     catch
     {
         throw new ArgumentOutOfRangeException("index");
     }
 }
예제 #5
0
 public static CircularArc2d GetArcSegment2dAt([NotNull] this Polyline2d pl, int index)
 {
     try
     {
         var WCS2ECS = pl.Ecs.Inverse();
         return(new CircularArc2d(
                    pl.GetPointAtParameter(index).TransformBy(WCS2ECS).Convert2d(),
                    pl.GetPointAtParameter(index + 0.5).TransformBy(WCS2ECS).Convert2d(),
                    pl.GetPointAtParameter(index + 1.0).TransformBy(WCS2ECS).Convert2d()));
     }
     catch
     {
         throw new ArgumentOutOfRangeException(nameof(index));
     }
 }