Method ToPolylineWithPrecision
- Namespace
- GeometryHelper.Dxf
- Assembly
- GeometryHelper.dll
ToPolylineWithPrecision(int)
Gets the polyline that runs along the spline within a precision, as AutoCAD's ToPolylineWithPrecision, of arcs, a DxfPolyline where the spline is flat.
public DxfCurve ToPolylineWithPrecision(int precision)
Parameters
precisionintThe precision, from 0 to 99, as ToPolylineWithPrecision(int, bool, bool) reads it.
Returns
- DxfCurve
The polyline, of the spline's look, in no file.
Exceptions
- ArgumentOutOfRangeException
Thrown when the precision is outside 0 to 99.
- InvalidOperationException
Thrown when the spline has no data that make a spline.
ToPolylineWithPrecision(int, bool, bool)
Gets the polyline that runs along the spline within a precision, as AutoCAD's ToPolylineWithPrecision. Of
lines, as AutoCAD 2021 makes it: the spline's whole parameter range, from its start to its end, halved again and
again until the spline's points halfway, a quarter and three quarters along each piece's parameter are no farther from
the chord's points there than the larger of one over the spline's sharpest bend and a ten-thousandth of its length,
over the square of one more than the precision, max(1 / M, L / 10 000) / (p + 1)^2, M the largest length of the
spline's second derivative by its parameter; each piece a segment. AutoCAD's 156 counts at hand, of cubics, a
quadratic, a quartic, quintics and rational cubics, at 0 to 99 (its plugin runs v4 to v7 and D32), are the rule's but
9, each within 3 of AutoCAD's, 7 of them of rational cubics: a quintic Bezier gives 86, 478 and 7 929 vertices at 0, 5
and 99 and the same 10 times its size, a hairpin cubic of 100 by 1 over the knots 0 to 1 129 at 0, where its length
decides, and over 0 to 100 5, where its bend does, and an S of three spans whose middle lies on its chord 173.
The rule gives AutoCAD's
counts of vertices for the three cubics of its plugin runs v4 and v5 at every precision tried: the cubic of one span on
(0, 0), (10, 10), (20, 10), (30, 0), whose bend is 60 everywhere, 33, 65, 129, 257 and 4 097 vertices at 0, 1, 3, 10
and 99; the cubic of two spans on (0, 40), (10, 50), (20, 50), (30, 40), (40, 30), 50 at 0, 513 at 10 and 4 750 at
99; the cubic of three spans on (0, 0), (10, 10), (20, 10), (30, 0), (40, -10), (50, 0), 78 at 0 and 7 562 at 99. The
sharpest bend is read at the ends of each span of the knots and at seven points between, which for a cubic, whose
second derivative runs straight along a span, is its largest; a piece is halved no more than 20 times over and no finer
than the rounding of the spline's largest coordinate, and a straight spline is one segment. The rule gives AutoCAD's
counts for a quadratic of three spans and a cubic of a double knot too (29, 342 and 2 732, and 76, 933 and 8 011 at 0,
10 and 99), a spline of degree 5 (96 at 0) and a rational one (130 at 0, 1 378 at 10 where AutoCAD gives 1 377). A
closed spline has its last vertex on its first, the
polyline closed; one closed, or of the flag 2 of its 70 (the periodic of the DXF reference, which AutoCAD writes on its
closed splines of a smooth seam), that runs through fit points, or that AutoCAD keeps by its fit points, the flag 1024
of its 70 set (its 3115 of a periodic cubic, written with no fit points), has each of its knots, one after another, in
the place of the vertex of the halving nearest it, the later of two as near, a knot taking the place another took
before it, as AutoCAD 2021 gave them: the closed cubic through (0, 0), (40, 0), (50, 30) and (10, 25), its knots the lengths of the
chords, is those four points and the first again at 0, and 48 vertices at 10, the range halved into 64ths and the knot
40 standing in the place of the 64th at 39.05; through (0, 0), (40, 0), (40.5, 0.5), (50, 30) and (10, 25) it is at
0 the vertices at 0, 40.71, 71.70, 112.01 and its end, the knot 40.71 in the place the knot 40 took. The same spline
of no fit points and no flag 1024, its 70 of 3, is the halving alone, as AutoCAD 2021 gave it: (0, 0), (34.42, -3.51),
(50.86, 28.40), (18.15, 30.49) and the first again at 0. AutoCAD's closed cubic not periodic through (0, 0), (30, 0),
(30, 15) and (20, 15), a corner at its seam (70 1065), has its knots in place as well: at 0 (0, 0), (22.66, -5.01), (30,
15), (20, 15) and the first again, the knots 45 and 55 for the quarters 40 and 60 (its D32 run, where 35 of the 36
polylines of six such cubics at 0 to 10 are the library's). Each arc is bent as the piece the halving made, its first,
from (0, 0) to (40, 0) at 0, by the turn of the tangent over the first quarter of the range. Of arcs, for a flat spline, the same vertices, each
segment the arc that turns as the spline's tangent turns along it, its bulge the tangent of a quarter of that turn,
as AutoCAD 2021 makes them: the cubic of one span at 0 gives 33 vertices, its first arc, from (0, 0) to (0.9375, 0.908), of bulge
-0.00806, the spline's tangent turning from 45 degrees to 43.15 along it. A spline not periodic of n control points
is cut instead into (n - 3) + (n - 2) k pieces even in its parameter, k half the precision rounded down, where that
is more pieces than the halving gives, as AutoCAD 2021 cut them where and as the rule says in each of 448 polylines of
sixteen closed cubics, of fit points and of control points, and 80 of eight open curves of few pieces (its D32b run): a
closed one has no last vertex on its first, and of its knots only as many as its vertices less two are put in place,
so that the closed cubic through (0, 0), (40, 0), (40.5, 0.5), (50, 30) and (10, 25) is at 0 its vertices at 0,
40.71, 55.57 (two fifths of the range), 71.70 and 111.15; the straight cubic of 4 points is 1 segment at 0 and 1, 3 at
2 and 3; the quintic Bezier over 0 to 50 is cut in thirds at 0.
public DxfCurve ToPolylineWithPrecision(int precision, bool bConvertAsArcs, bool bToLWPolyline)
Parameters
precisionintThe precision, from 0 to 99.
bConvertAsArcsboolWhether its segments are arcs; lines where false, and for a spline that is not flat.
bToLWPolylineboolWhether a flat spline gives a DxfPolyline; a DxfPolyline2d where false. A spline that is not flat gives a DxfPolyline3d.
Returns
- DxfCurve
The polyline, of the spline's look, in no file.
Exceptions
- ArgumentOutOfRangeException
Thrown when the precision is outside 0 to 99.
- InvalidOperationException
Thrown when the spline has no data that make a spline.