2D IPO’s for Constant Speed Lines, Curves, NURBS

,


Introduction 1.1 Speed -position closed-loop control systems
This paper describes the software IPO's for discrete lines and curves of devices that must (physical) control precisely the movements of these devices with constant instantaneous velocity along the curve.There exist two methods [9] & [11] to implement the IPO's in a velocity-position closed-loop system: the Reference Pulse Method (Fig. 1) and the Sampled-Data Method (Fig. 2).It is also possible to use no feedback, but in closed-loop systems, the up-down counter contains the servo error, which increases/decreases when the velocity increases/decreases, therefore the acceleration/deacceleration is soft when the servo is fine-tuned.The maximum servo error is double bounded, the first bound stops the input and the second bound gives an alarm.Therefore, the closed-loop is safe and the acceleration/deceleration is bounded.We will not use open-loop systems, although they still exist for simple systems.A wellknown example is the computer control of a plotter actuated with stepping motors.In that case, one does not want a constant velocity along the curve, but one must use an acceleration/ deacceleration profile or limit the frequency Fc, such that no pulses are lost.The IPO used, was Bresenham's (two-point method) algorithm for lines [1] and circles [2].Bresenham's algorithms are non-constant speed, very fast BRES-ipo's ( §1.5), without integrated priority, and they can also be used in closed-loop systems based on the reference pulse IPO.Using the Pulse-Rate-Multiplier PRM-cs ( §1.6 & §1.8) we will convert these algorithms into very fast constant-speed-algorithms.

The cubic and square grid describes the output of the axes of velocity-position systems
To describe the output of 3D-curves, we use a cubic grid as defined in Fig. 3 and to output 2D-curves we use a square grid defined in Fig. 4. The grid distance along the axes equals one BLU (resolution) or Δ (in the equations), although, in practice, Δ equals one, we will further use the symbol Δ in the equations because it makes the equations clearer.A cubic grid defines the grid points in a right-handed three-dimensional Cartesian coordinate system.A discrete curve travels along with the grid points, and we call the process of finding the discrete points the IPO.The curves using the reference pulse method must be kconnected.When we don't mention the connectedness of a curve, then the 2D curve is 8connected and the 3D-curve is 26-connected, hence the default k-value is 8 or 26 (in the Digital Analytical Geometry these curves are 0-connected [12]).PB=P1, PC=P3, PD=P2, PM= 13  PP 2 + ,PH= 21  PP 2 + , PV= 23  PP 2 + , Ph= A3 PP 2 + , Pv= A1 PP 2 + Fig. 3 "3D" Fig. 4 "2D"

Constant feedrate -Constant speed
In physical systems (machine tool practice, EDM, 3D-printing, …), the word "speed" refers to two separate velocities, for example for milling, the cutting speed or surface speed is the relative velocity between the cutting tool and the surface of the workpiece (m/min).The feedrate is the relative velocity at which the cutter is advanced along the workpiece (mm/min).In that case, constant speed means the continuous constant feedrate, in the center of the tool, along the curve.In general, constant-speed IPO's don't include the automatic feedrate adaption as used in "Circle Milling": when the radius of the surface equals Rs and the radius of the cutter equals Rc, and the finishing feedrate along an axis equals V, then the feedrate for outer finishing must be reduced by , but this ratio must be smaller than one; in that case, the input frequency must be augmented.Although the "Die & Mould Making Application Guide of Sandvik Coromant gives maximum feedrate values of 40 -60 m/min for HSM (High-Speed Machining), our NURB references [13] & [14], gives maximum feedrates of 1.5 -12 m/min for resolutions of 0.5 -7 µm.
Notice that the dynamics of the drive system does not ensure the constant speed along the curve, but that the IPO must provide the constant speed.So, figures 1.1 also represent nonconstant-speed velocity-position systems, and we have constant-speed-IPO's and notconstant-speed IPO's

Reference-pulse-Systems
As you will see in the sequel, we have to review all the reference pulse IPO's with the maximum accuracy less or equal than the upper bound (Table 1).We hope that the classification is helpful.
Fig. 5 The classification of the non-constant speed reference IPO's In reference-pulse-systems, we subdivide the curve into monotonic segments, characterized by its monotonic direction vector   In this way, the direction vector for a monotonic segment is fixed, but the cubic can collapse.
In systems based on the reference IPO, the actual best gridpoint Pn is the basepoint PA of the 2D candidate grid points P1, P2, P3 or the 3D candidate grid points P1, P2, P3, P4, P5, P6, P7 of the next best point.The best gridpoint is the candidate point with the minimum perpendicular distance to the curve; hence the discrete curve travels along with the grid points with minimum perpendicular distance to the curve.
The reference IPO can generate single pulses x, y, or z, double pulses xy, yz, or zx and a triple pulse xyz.The interrupt frequency Fc = c 1 T determines the speed of the axes and the generated pulses are directly forwarded to the corresponding up-down counters.One x (y, z) pulse denotes one BLU (Basic Length Unit) of the x-axis and corresponds with the grid distance Δx.The reference IPO uses internally the grid distance Δ=Δx=Δy=Δz=1, but the real grid distance corresponds with BLU µm.The accuracy of reference-pulse-systems is a fraction of Δ or one BLU, but the maximum execution time Tc of the reference pulse-ipo limits the velocity.

Sampled-Data-Systems:
The sampling time Ts can be some 100-times greater than reference interrupt time Tc.At the input, the sampled-data system can be described in the following way.During the period Tc the reference-pulse-system generates the incremental moves pulse[nkey] and during the period Ts, the sampling program can put the Tc pulses in the sampling word, hence the sampling word[i]=sampling word[i-1]+pulse[i-1], or the sampling word[Ts] equals the integration of the pulses over Ts.So, sampling-data systems use Euler-or Taylor-or Tustin-integrators [11].When you look to the dynamics (output) you can use the rules of zsampled data systems or you can consider the sampled system as a continuous system with delay Ts 2 and apply the integration.It is well known that sampling makes the dynamics of the system less stable, therefore the amplification is lower, and the accuracy is lower.At the input, a sampling-data system never works in this way: the Tc pulses between the sampling period Ts are not measured, so one only measures the values at the sampling instants Ts, and the regulated sampled-data system will have very well results at the sampling instants, but the dynamic behavior can be quite different between the sampling instants.So, the accuracy of sampled-data systems is high at the sampling instants, but in-between the accuracy must be bounded, or one must use subsampling ("fine line interpolation") [11, pp 96 3.4].In conclusion, we can say that the sampled-data systems are faster, have less accuracy and are more complex.Therefore, we try to avoid sampled-data systems, although we must compare our NURBS-reference-pulse-algorithms with existing NURBS-sampleddata-algorithms ( §2).The implementation of Reference-Pulse-Systems is simpler than that of Sampled-Data-Systems; hence we need to find very fast constant-speed-reference-pulse-ipo's.

The best IPO and The Least-Squared-Distance IPO's or LSD-ipo's
The absolute perpendicular distance of a point Pn to a curve is the error dErr [Pn].
The perpendicular distance dErr[Pn] is different for the sets: lines, circles, conics, NURBS.The LSD criterium is the same as the minimum absolute perpendicular distance criterium.
The LSD-ipo creates the k-connected grid points {Pn} and sometimes, the corresponding This array defines the important parameters of the k-connected curve When, for some IPO's and for all objects of its set, the MaxErr[object] equals the minimum MaxErr[object] and for one of the IPO's, the Cost[object] also equals the minimum Cost[object] then that IPO is perfect, and we call it the best IPO.An inaccurate IPO is imperfect when for some object the MaxErr is not minimum, but the MaxErr is bounded ( Table 1: In that sense, we can loosely define the best IPO as: The best IPO is the IPO with the minimum MaxErr and for two or more IPO's, with the same minimum MaxErr, the IPO with the minimum Cost is the best.In the rest of the paper "inaccurate" means "imperfect". We must use monotonic segments when we use the LSD-ipo, because, • We can detect OoC (Out-of-Control) [5] easily.As we know from [5] the point Pn can be OoC when the direction of the tangent in the footpoint of Pn on the curve is not in accordance with the monotonic direction vector, and in that case, the LSD measurement is not valid.• For a non-monotonic segment, we must detect the extreme points online, and that is quite complex.• It limits the number of candidate points to 3 in 2D (Fig. 4) and 7 in 3D (Fig. 3).
The midpoints of these points are very important, i.e. the 2D-midpoints PM, PH, PV.

Definition of the major axis of a line, the priority and the LSD-priority
The major axis of a 2D line { Li, Lj } or a 3D line { Li, Lj, Lk } is the axis which corresponds to the maximum absolute component of the line.For example, the line {4,3} is a major axis x-line and the line {49,74,82} is a major axis z-line.For curves, the components of the tangent line determine the major axis, and for quadratic curves, the components of the polar in the midpoint can be used, provided that the midpoint is very near to the curves.

Definition of the major axis principle:
"when the major axis principle holds, the LSD-ipo makes a major axis move at each move." We define the priority, • for the cubic with basepoint PA, the points P1, P3, P5 have priority one, the points P2, P4, P6 have priority two and the priority of P7 is three; • for the square, P1 and P3 have priority one and P2 has priority two.Let's agree about the next meanings: • "the major axis line" does not mean that the major axis principle, a priori, holds.For a 2D-line it holds, but for a 3D-line, it generally, does not hold.So, the major z-axis 2D-line always makes a z-move, but that is not the case for a major z-axis 3D-line.• "the major axis IPO" means that the generation of the discrete line applied the major axis principle.So, all actual 3D-IPO's are major axis IPO's and all 2D-IPO's are major axis IPO's ( §1.8), but there also exists a non-major axis 2D-IPO, e.g. the LSD-and BRES-ipo; in that case, the major axis principle holds, but the algorithm does not use that fact.So, most published BRES-ipo's are major axis 2D-IPO's and the IPO of [6] is a non-major axis 2D-IPO.The actual published 3D-line IPO's are all major axis 3D-IPO's ( §1.7.3).

Definition of the LSD-priority:
We apply the LSD-priority when we select the candidate gridpoint of a k-connected curve with the LSD with integrated priority: The LSD-point is the candidate gridpoint with the minimum absolute perpendicular distance to the curve.The LSD-point is chosen, but when two or more points have the same LSDvalue then the point with the highest priority is chosen, but when the LSD-points have the same priority and when the major axis principle holds, we could select the point along the major axis direction.But for most 3D-lines, the major axis principle does not hold (Table 3) and the calculation of the right major axis for curves is complex, as it is the tangential direction in the footpoint (for quadratic curves one could approximate this tangent as the tangential direction of the polar of the midpoint).When we use the BRES method, we do not use a major axis, because this method uses the result of "all" the midpoints {PM,PH, PV} [6].Applying the "LSD-priority" makes the k-connected curves unique.

Definition of the LSD-ipo's: the VIRT-ipo, the BRES-ipo {MIDP-ipo, 2PREP-ipo}
We can use two LSD criteria, using the integrated priority, for monotonic segments: • the dLSD (direct Least Square Distance) method: we calculate the Square Distance of each candidate point and select the candidate point with the LSD with integrated priority.This method is very slow for non-linear curves and its non-constant-speed algorithm is called the VIRT-ipo (Virtual-ipo) because it cannot be applied in real-time; • the pairwise MIDP comparison method: we compare the Square Distances of the candidate points, pairwise to the polar line of the midpoint of these candidate points until the best candidate point is found.The polar line of the conic Dot[ , ] W 0 + PG [4,5] [5, pp 31, 32].For two points with the same LSD, 22   CB     M F0  , we could select PB when the x-axis is the major axis, else we could select PC.When 22 we use the integrated priority, hence we select PD.But, instead of using the major axis, the candidate points PB, PC or PD can better be selected from [5,Ch3] when the measurement is not OoC.This method can be realized with Boolean variables; hence it is very fast.The algorithm based on this criterium is called the MIDP-ipo.For non-quadratic implicit curves, we can instead of FM use the sign of the arithmetic mean decision variable FaM of two candidate points [5, pp 21].The algorithm based on this criterium is called the (Two Point Residue) 2PRES-ipo; this IPO can also be applied to conics but in that case, we proved [5] that it can have more OoA points [5].The MIDP-and 2PRES-ipo's are identical for lines and faster for quadratic curves because the decision variables are based on the distance of the midpoints to the polar lines of these midpoints.The midpoints are the points PM, PH and PV for conics, but we have 21 midpoints for QSIC's (Quadratic Surface Intersection Curve).A very fast non-constant-speed IPO is given in [6] and in Part III we will give constant-speed IPO's for QSIC's.This method is very fast and its non-constant-speed real-time algorithm with integrated priority is called the BRES-ipo.The VIRT-ipo, with integrated priority, is the collective noun of the non-constant-speed reference IPO using the direct Least Square Distance method.The BRES-ipo, with integrated priority, is the collective noun for the MIDP-or the 2PRES-ipo.Generally, these IPO's use the LSD with integrated priority, but most of the time, the published IPO's are implemented without the integrated principle and often one presupposes that the major axis principle holds.By default, we will use the integrated priority and then, we don't care about the major axis principle.An IPO which does not use the major axis principle, a priori, must not subdivide the monotonic segment into major axis subsegments, and that is a great advantage.The LSD-ipo's is the collective noun of the VIRT-and BRES-ipo's and these IPO's can have OoC-measurements, and in that case, the measurement is not valid, but this situation can be detected easily, and the solution is very simple [5], [6].Opposite to the VIRT-ipo's, the BRESipo's can be OoA when the midpoint is inside and very near to the curve [5, Appendix 4: point {4,2} of the circle].Summarized: The VIRT-ipo has no OoA, can be applied to implicit and parametric curves, but, generally, the time needed to calculate dErr[Pn] is often complex and long, hence the VIRT-ipo is generally slow, but the BRES-ipo's are very fast.The MIDP-and 2PRES-ipo can have OoA-points, the MIDP-ipo can be applied to quadratic curves and lines, and the 2PRES-ipo can be applied to implicit curves.The LSD-ipo's can have OoC-points and these points cannot be used.It is not necessary that the major axis principle holds for the LSD-ipo's.The major axis principle holds for most published 2D-lines and all the published 3D-lines, and this simplifies incremental 2D-and 3D-algorithms.In paragraph 1.8 we shortly treat these 2D and 3D IPO's: DAG-, Bresenham-and PRM-ipo.
• The execution time of PRM-cs plus LSD-ipo < Tin and hence the execution time of the LSDipo determines if the LSD-ipo can be applied in a reference pulse constant speed system.Therefore, we must replace the LSD-ipo with the BRES-ipo.• The speed ratio of the PRM-cs is the reverse of the tangential speed ratio of the LSD-ipo; hence the LSD-ipo must, for curves, communicate the direction vector to the PRM-cs.Notes: • The PRM-cs does not change the discrete curve, so it has no influence on accuracy.
Hence the MaxErr and the Cost are independent of the PRM-cs, • The LSD-ipo calculates the grid points {xn, yn, zn}, • For curves, { Li, Lj, Lk } is a function of the grid points and its footpoints, • {LMcs, LNcs} depends on the connectedness of the line or curve (Table 1), • "ACcs > 0" corresponds with the Ceiling-form, but "ACcs ≥ 0" can also be used, • npuls is very sensitive to the initialization of ACcs, therefore, the fast simplified square root algorithm [IEEE computer] can only be applied for an approximately constant speed algorithm, • When we don't simulate this IPO, we delete npuls and nkey, • When we simulate the IPO, then npuls measures, online, the length of the curve, • Table 1 makes it clear that the 4-and 6-connected IPO's make no sense: their accuracy is worse and when using constant speed, the maximum speed is half the maximum speed of the 8-or 26-connected IPO's.So, the 4-and 6-connected IPO's are obsolete, although a half-century ago our Ducomat CNC [3] made all the geometrical calculations (intersections, equidistant contours, cut distribution) with 4-connected line-and circleipo's.This system used a PDP-8E computer without floating point hardware.We knew the 8-connected IPO's, but these IPO's cannot be used to calculate the intersections between lines-lines, lines-circles, and circles-circles.

Round Length of the Curve
We can prove the next equivalent relations: Generally, LMcs is an integer and  equals one, and for 2D-lines the LSD-ipo makes a major axis move at each step, therefore the algorithm ends with

VV is the main property of the combination of a PRM-cs and an LSD-ipo
For a 2D-line, the PRM-cs gives .

The old midpoint-and BRES-ipo's are currently the fastest constant-speed IPO's
Adding the PRM-cs converts the very fast midpoint algorithms into the fastest and simplest reference pulse constant-speed algorithms.Display, CAD and CAM systems, used or still use the reference pulse not-constant-speed-IPO for lines, circles and conics: [5], [6] extended the midpoint algorithm [4], [7] to the very fast, robust and stable generation of conics.The non-constant speed IPO's, especially the twopoint, the midpoint, the scan-conversion of the general conic algorithm (26 pages) were extensively described in the 2 nd edition of Computer Graphics [8].The criteria used to evaluate these algorithms for a non-monotonic segment of a conic were 1.The midpoint method also called the grid-distance method; 2. The two-point method, also called residual or the arithmetic mean method, 3. The perpendicular distance method to the non-monotonic conic.
As cited in §1.3, we apply the perpendicular distance method to monotonic segments.The midpoint method was chosen as the best.The two other criteria were discarded because they could select a wrong gridpoint, but we proved [5] that all three methods can be OoC and that one must apply the criteria to monotonic segments to detect OoC.The general conics algorithm of [8, 2 nd Ed., pp.951-962] is not stable, we call it berserk because sometimes, the algorithm breaks down and marches away from the conic.This is not a form of aliasing, but the real reason is that the wrong point is OoC, hence the decision variable is not valid, and therefore the algorithm takes a wrong decision.In the 3 rd Edition, the midpoint and scan-conversion algorithms do not get any attention, and they justify it in "Differences from the Previous Edition": "With the advent of the GPU, triangles are converted to pixels (or samples) by radically different approaches than the old scanconversion algorithms.We no longer discuss those."So, nowadays, instead of LSD-ipo's, one uses a GPU dedicated to graphics-related computation.Henceforth, we suppose that you will not find the word "Interpolator" or "IPO", or constant-speed algorithms in current Computer Graphics and Computer Vision books.The normal conclusion is that the midpoint or two-point algorithms are obsolete, but the opposite is true: we showed that an, at most 3-lines algorithm, called the PRM-cs, converts the "old" very fast non-constant-speed reference pulse IPO's into "up-to-date" very fast constant-speed reference pulse IPO's.Generally, constant-speed IPO's must know the length of the curve, but our method does not need to know the length of the curve, because the PRM-cs measures the length in realtime.

The current 3D-line IPO's are inaccurate
To keep the description simple, we suppose that the z-axis is the major axis or Max For all current 26-connected 3D-lines {Li,Lj,Lk}, the major axis principle holds.The major axis principle holds, a priori, for the discrete objects, defined by the Digital Analytical Geometry, hence it's a fundamental building block of the Digital Analytical Geometry.The idea that the major axis principle must hold for a 3D-line is deep-rooted.

Short Introduction to 3D-lines and inaccurate discrete 3D-lines
The 3 projections of a 3D-line can be obtained from Shortly we describe Fn as When the point Pn  P belongs to the 3D-line then s Cross[L,P P ] 0 − as P-Ps is parallel to the line.With the perpendicular vector distance nn PP ⊥  = − , we can write Pn-Ps as  in the {x,y} plane (the latter is not used for a major z-axis 3D-line). Resuming: . Therefore, we have the following identities So, for a major z-axis 3D-line, only the z-component of the 3D-vector distance n  is completely defined using a double {rnx, rny} Bresenham measurement.You can also see this from Fig. 3: the candidate points after a z-move are the points {P5, P4, P6 and P7} corresponding to a {z}-, {z,y}-, {z,x}-, {z,y,x}-move.To select the best point, one needs six decision variables of which two are independent, which correspond with the decision variables Dx and Dy of Bresenham 's dual algorithm.Dy selects P5 or P4 and Dx selects P5 or P6.Suppose Dy selects P5 and Dx selects P6, the dual Bresenham's algorithm selects P6, but point P7 can be better than P6.So, even when the major axis principle holds, Bresenham's dual algorithm can be wrong.The real problem is that the major axis principle often does not hold, this means that the best point of the points {P1, P3, P5} is not P5.Suppose that P3 is the best, then the best move is selected from {P3, P2, P4, P7}.The 3Dalgorithms which don't use the major axis principle have to select the best point from every possible major axis, and to select the best of the former best selected points.For the imperfect 3D-line IPO's one applies the PRM-cs as in §1.6 using Table 1, hence the current inaccurate discrete lines are very easily converted to constant speed 3D-line IPO's.

1.7.2.The global definition of a major axis discrete 3D-line [(18),[16] ( §1.7.3 DAG-ipo)
Oscar Figueiredo, J.-P.Reveillès [15], and R.D. Hersch [16] recognized that the global definition is not ideal from a theoretical point of view.It has several drawbacks or limitations: (a) The 3 rd projection is generally not the closest set of points to the 3 rd Euclidean projection, (b) The points of the discrete line are, generally, not the set of the closest points of the given Euclidean line.This simply means, that the discrete 3D-lines, for which the major axis principle holds, are, generally, imperfect.We show, in §1.7.4,that from a practical viewpoint, this definition gives discrete 3D-lines whose accuracy is much less than the accuracy of the best discrete 3D-lines (e.g.37% worse).The Diophantine inequalities are in fact a main property.Contrary to the local Bellman principle, the Diophantine inequalities may be used as global (naive) definitions of a major axis 3D-line, i.e. for the major z-axis 3D-line: Using Floor form: Using Ceiling form: .
For 2D-lines, rounding corresponds with the minimum absolute perpendicular distance, but for 3D-lines, rounding does not correspond with the minimum absolute distance.
We also have a round up and round down problem: e.g.

 
Floor 3.5 0. So, when the decimal value of the coordinate of an intersection point equals 0.5, one must sometimes apply a correction.It is easy to find the corrections, using a Karnaugh map and a proper example, but the problem is complex because one must sometimes apply a correction when the decimal value of the coordinate of an intersection point is near 0.5.
The reason of the "equals 0.5" error is simple: the arithmetic definition of a discrete line does not use the "integrated priority", but that is not the cause of the "near 0.5" error.
The reason for the "near 0.5" error is fundamental: 3D-distance.For 3D-lines, the global definition does not give the MaxErr nor the MinMaxErr of the discrete 3D-line, but we know that MinMaxErr ≤ MaxErr ≤ 2 2  for perfect and inaccurate 3D-lines.For a perfect line MaxErr equals MinMaxErr, but this value is not a priori known.The MaxErr of the line {10, 10, 10} is zero when we apply the LSD with integrated priority, but the discrete 3D-line complies with that 0 ≤ MaxErr ≤ 2 2  .The inaccurate discrete 3Dline and the global definitions satisfy the worst case design and can be applied.

The 2D Diophantine inequality improves the upper bound of the maximum error MaxErr :
For discrete 2D-lines {Li,Lj}, with Li>Lj>0, the signed error equals , the remainders in respectively Floor-and Ceiling form equal RemainderFloor The global definition for the major x-line, in respectively Floor-and Ceiling form is respectively zF 0 r 1  and zC 0 r 1  .Using the signed error, the global definitions become  [7].Even in this case, MinMaxErr is not known.

Current inaccurate 3D-lines IPO's
The current 3D-lines are: 1. 3D-DAG-ipo [15,18]: Jean-Pierre Reveillès [17,16] defined an analytical definition for a discrete naïve 2D-line, and thereby, initiated the discrete geometry, which associates at the Euclidean object a discrete representation in the form of a Diophantine inequality, with has an integer solution.This was extended by Reveillès, Figueredo [15] and I. Debled-Rennesson [18] to a naïve 3D-line.The 3D-DAG-ipo and the definition of the discrete 3D-line {Li,Lj,Lk} is based on One applies the major axis principle and the Simple DDA-algorithm [19] The generated 3D-line is identical with the results of Bresenham's extended 3Dline.
2. Bresenham's extended 3D-line [24]: One applies Bresenham's algorithm to the projection of the line segments in the {z, x} and the {z, y} plane.The major z-axis principle holds, but it is very easy to convert this algorithm to a constant speed IPO using a PRM-cs.The extended 3D-Bresenham-ipo of [25] is faster and more efficient, they agree that it is not the most precise and they show that the maximum error MaxErr is less than equal to 2 2 .When the production manager agrees with that bound, the IPO can be applied successfully.The generated discrete grid points, using rounding, for the line from {0, 0, 0} to   .5], n z } for zn=0, zn ≤ Lk, zn++.
3. 3D-PRM-ipo ( §1.9, Case (#B) and algorithm constant speed 3D-PRM-ipo ): A PRM-ipo looks as a PRM-cs, and the 2D-PRM-ipo is given in §1.8.The PRM-ipo is the fastest of all line IPO's, but it is also a major axis IPO.The generated 3D-line is identical with the results of Bresenham's extended 3D-line.4. Toutant's best 3D-line [26]: Toutant corrects the DAG-ipo and Bresenham's extended 3D-line when the decimal value of the coordinate of an intersection point equals 0.5 but the limitations (a) and (b) of §1.7.2 remain.Toutant defines his best discrete 3D-line, in our terminology, as: "the minimal 26-connected set of closest integer points".When you compare his definition with our definition of §1.3, then his "Minimal" is wrongly defined but it certainly means that the major axis principle holds, and that is wrong, too.The papers [27,28] of C.E. KIM of respectively of 1981 and 1983: "two projections along the major axis of the 3D-line produce two 2D-lines and these suffice to compute the 3D-line", caused that for a discrete 3D-line the major axis principle must hold.That is right for the projections along any axis ( n L F 0  , n L0  ), as well for the continuous 3D-line as for the discrete 3D-line.The trouble, when you want to apply the projections along a minor axis, is that you don't know the right value for the component of that minor axis.So, the rule of the major axis principle simplifies the design of IPO's and the global definition of the discrete 3Dline is just a property of that design and it is much easier to start the design with the global definition of the discrete lines and extend that definition to discrete objects, without saying that the major axis principle must hold.

Discussion of the major axis 3D-ipo's for the major z-axis L={Li,Lj,Lk}={49,74,82} 3D-line
Initially, we wanted to treat all lines in this part, but that is impossible, therefore, we split the paper into three parts, the 2 nd part will discuss the IPO's of the perfect 3D-lines and the 3 rd part will treat the QSICs and 3D-NURBS.Table 3 The causes of inaccurate discrete of 3D-lines:

3D Rounding is not equivalent with 3D LSD
The rounded grid points of a 2D-line are always the LSD grid points, but the rounded grid points of a 3D-line are, generally, not the LSD grid points, and that is the cause of the limitation (a) of §1.

Infrequently, the dual of Bellman's principle of optimality does not hold for 3D-lines
The LSD criterium applies, locally, the dual of Bellman's principle of optimality, this means that, when locally, the closest points are selected, then one obtains also, globally, the minimum Cost.We know that the dual of Bellman's principle of optimality does not hold for 3D-6-connected curves [5, pp. 27], but, occasionally, it is also not valid for a 26connected 3D-line.The path A1 and B1 of Table 3 have the same MaxErr (0.477707), but the Cost of path B1 is less than the Cost of path A1, hence path B1 is the best path, although Bellman's principle is not valid for path B1.

The major axis principle, generally, does not hold for 26-connected 3D-lines or curves
The major axis principle holds for 8-connected LSD-ipo's, but, generally, not for 26connected LSD-ipo's, and that is not an exception, but it applies to most 3D-lines.
For the lines {49,74,74+i} with i from 1 to 100, 92% of the lines had at least one and at most 5 possible major-z axis errors; for the lines with i from 101 to 200, 22% of the lines had at least one possible major-z axis error.The minimum MaxErr of the "best" 3D-line {Li, Lj, Lk}={49,74,82} equals 0.497924.The major axis principle holds for the four IPO's of §1.7.3 and their MaxErr equals 0.682438, hence the accuracy is 37% worse.The path A2 and B2 of Table 3 have the same MaxErr (0.487077), but the cost of B2 is smaller than the cost of A2, but path B2 is not 26-connected as the y-move from {03, 04, 05} to {04, 06, 06} is impossible.The major axis principle for path A2 is not valid, nevertheless, it is the best path.
Similar to the three first 3D-IPO's of §1.7.3, we also have three major axis IPO's but that poses no problems as 2D-rounding for 2D-lines is equivalent to the LSD criterium.Mostly, one does not apply the "priority principle" and 2D-IPO's which do not apply this principle will be called nearly-perfect IPO's.So, the nearly-perfect IPO's are major axis 2D IPO's, the major axis principle holds, one applies the LSD-criterium (or Rounding), but not the priority principle.
These nearly-perfect 2D-IPO's are: The 2D-BRES-ipo is a perfect IPO, the major axis is not, a priori, used, therefore the monotonic segment must not be subdivided.These four IPO's must, intrinsically, use the same decision variable; therefore, we naturally take the decision variable ACipo of the PRMipo and the decision variable dH or dV of the BRES-ipo.In §1.5, we defined the three decision variables for the BRES-ipo using the polar line of a conic, and as the polar of a line is identical with the line, these decision variables are also valid for the 2D-line Fp.The decision variables We consider two cases: ❖ Case1: The major x-axis holds.
The major y-axis holds.
• Most of the time FA[0] is zero, but the major x-axis PRM-ipo is always different from the major y-axis PRM-ipo.Therefore, a quarter circle cannot be realized with one PRM-ipo.• All published PRM-ipo's or comparable IPO's use a wrong initialization.

The initialization of the PRM-cs:
We suppose that 0 < Lj < Li, then

Properties of the PRM-ipo and the PRM-cs:
• For case1, ACipo corresponds with the residue in the point Ph, and for case2, ACipo corresponds with the residue in the point Pv (Fig. 4).Therefore, the PRM-ipo is, in essence, a midpoint algorithm.• The simulated npuls of the PRM-cs equals, in real-time, the rounded length of the generated discrete line, • The PRM-ipo is a major axis IPO, and the PRM-cs expects that the cascaded IPO is a major axis IPO, • The tangential speed of the cascaded IPO is the reverse of the pulse rate nkey npuls of the PRM-cs, • A PRM-cs applies to 2D-and 3D-IPO's ( Circles, Conics, 3D-lines, QSICS, LSD-NURBS), • In general, a PRM-ipo cannot be applied successfully, to Circles, Conics, because the monotonic segment must be subdivided into major axis segments, • The PRM-cs is a pulse-rate-multiplier which is independent of the major axis of the line or the curve.Therefore, the PRM-cs is valid for the complete monotonic segment, but when Li and Lj changes, the changes of the tangent must be communicated to the PRMcs.

Errors of all published PRM-ipo's:
• All published PRM-ipo's or comparable IPO's use a wrong initialization.
• The MaxErr depends on the initialization of ACipo, e.g. for the line {4,3}, the MaxErr increases with 50% and the Cost with 130% when the initialization of ACipo[0] becomes ACipo[0] =0 or ACipo[0] =LNipo=4, but the constant speed is independent of the initialization of the PRM-ipo.

Possible errors of a PRM-cs:
• The ratio LS npuls depends on the initialization of ACcs, e.g. for the line {4,3}, that ratio increases with 25% for ACcs[0]=0, and the ratio decreases with 16.7% for ACcs[0]=LNcs=5, but the MaxErr and the Cost are independent of the initialization of the PRM-cs.• PRM-cs is, as far as we know, completely new.You have to be aware that the PRM-cs looks like a PRM-ipo, this means that the PRM-cs expects a major axis IPO, that does not mean that the PRM-cs, itself, must be changed; that will be explained in Part II.

Constant Speed BRM-ipo or Software DDA-IPO
The Symmetric DDA-algorithm [19, pp.70-71] is a constant speed IPO, not based on the major axis principle.The increments, for a 2D-line, are and the incremental The calculation error of the increments accumulates, and that is one of the main reasons that the symmetric-DDA-IPO's became obsolete.But we can write, the symmetric-DDA, directly as . We can create npuls very easily with a PRMcs and the integer coordinates become .We can faster implement the Floor function with a PRM-ipo and delete the PRM-cs, except the increment npuls=npuls+1.We call this implementation with two PRM-ipo's in cascade and where npuls functions as the major axis, the BRM-ipo.Danielson [22, Fig. 4, 5] called it the "Binary Rate Multiplier", Spiros Papaioannou [23] called it the "linear DDA IPO with speed control", he also used a "pulse rate multiplier", but John Peatman [21, pp. 350-353] defines the PRM-ipo much clearer.Koren [9], [10 ] called the BRM-ipo a "software IPO" and [11, pp.79, Fig. 3.7] calls it a "software DDA IPO".The Fig. 3.7 {L,Q1,A,Q2,B} of [11] resembles the BRM-ipo: A==|Li|, B==|Lj], L==LS, the decision variables of their Q1-ipo and our ACx-ipo are identical, hence -(Q1+Sx*Li-LS) == ACx-Sx*Li ==> Q1==LS -ACx and analogous Q2==LS -ACy .They initialize Q1 and Q2 as zero and that corresponds with the wrong initialization of ACx and ACy as LS.
When we convert their decision variables to our decision variable, then the published BRMipo's used LS (sometimes zero) as initialization, in our ACipo terminology.So, all published BRM-ipo's or software DDA's use the wrong initialization and their results were not good.They applied the linear BRM-ipo's to circle BRM-ipo's, and the results got worse.
The best linear BRM-ipo uses the proved initialization, but even in that case it does not make sense to use a BRM-ipo, it can better be replaced with a PRM-cs in cascade with a PRM-ipo, and the circle BRM-ipo must be replaced with a PRM-cs in cascade with a circle BRES-ipo (Table 6 (#A) versus (#B) and 1.10.2 ).In many publications the word DDA is misused, [29] even calls Bresenham's 2D-line IPO a DDA-algorithm.We don't further discuss the non-major axis DDA-algorithms, but there exist, many, even well-known and referenced, non-constant speed, major axis DDA-ipo's, derived from the Simple DDA-ipo [19].

Possible errors of a linear 2D-BRM-ipo and 3D-BRM-ipo:
Results (2) 0.465 8 0.689 MaxErr: OK, Cost: OK, npuls: OK ACx=ACy=LS/2 (3) 0.58 8 0.973 MaxErr: Wrong, Cost: Wrong, npuls: OK ACx=ACy=0 (4) 0.697 9 0.865 MaxErr: Wrong, Cost: Wrong, npuls: OK ACx=ACy=LS (5) 0.697 9 0.865 MaxErr: Wrong, Cost: Wrong, npuls: OK Q1=Q2=0 Table 5 Cases (#1) and (#2), and cases (#4) and (#5) in Table 4 and Table 5 are identical.Case (#5) is the software DDA IPO of [11] with initial Q1 and Q2 equal to zero and the equivalent BRM-ipo with initial ACx and ACy equal to LS. Case (#1) calculates {xn,yn} as is the best, but as the principle of priority cannot be applied, the 2D-BRM-ipo is not a perfect 2D-BRM-ipo, therefore the Cost is not always the best, but the MaxErr is OK.To my knowledge, we do not know any paper which discusses the initial value of a 2D-BRM-ipo.] The non-orthogonal IPO of [39,Fig. 4. B] is a non-constant speed reference pulse IPO.The example Fig. 4. B shows that the MaxErr equals one, and that it is greater than the upper bound 0.5, therefore we do not consider these IPO's.The results of a PRM-cs plus the BRESipo, for the ellipse

Real-Time flowchart of constant-speed 2D-IPO with PRM-cs (Fig. 6)
The PRM-cs waits until an interrupt arrives.In the interrupt loop, ACcs is decremented with LMcs, once per interrupt.When ACcs becomes less or equal to zero then LNcs is added to ACcs, and one continues the BRES-ipo or the near-perfect 2D-ipo ( §1.8).In the latter case, the major LMcs-axis principle holds, and nkey becomes the coordinate of the major axis.The LIST-routine outputs the discrete coordinates and returns to the wait-routine with a positive ACcs or the IPO ends.The npuls can be deleted for a real-time system.We can also delete the interrupt system and simulate the real-time system with a VIRT-ipo instead of the BRES-ipo.In that case we create, in LIST, the array listSIM == { {xn,yn,npuls}, } x y R y x 22 The constant speed Circle-ipo is identical with the algorithm of §1.6, when we replace Note, we can create the array listSIM for every curve, and the results at the sampling points will be perfect, provided we measured the length at the sampling points accurately, but that listSIM is not a discrete curve where the error of every point is smaller than MaxErr.

Constant Speed NURBS
In the introduction, we found very fast constant speed IPO's for implicit curves.It is generally accepted that parametric curves can be drawn easier than implicit curves, although everyone prefers the faster circle LSD-ipo of §1.10.2.above the circle NURB-ipo.We can make a full R-circle NURB with 9 points, a knot vector with 3 double knots and a weight vector such that the weights of the intermediate points equal wi 1 2 = (Piegle [36] gives a full circle with 6 points).So, with pts= { {R,0}, {R,R}}, {0,R}, {-R,R}, {-R,0}, {-R,-R}, {0,-R}, {R,-R}, {R,0} }, knots={ 0, 0, 0, 0.25, 0.25, 0.5, 0. + are the sampled data points and the fixed sampling time Ts equals 1/K.The array listxyT is not a major axis generated list, and cascading the listxyT-ipo with the PRM-cs does not convert this sampled data IPO to a constant speed IPO.The line segments of listxyT can easily be drawn with constant speed using the PRM-cs for each line segment, but the chord error must be smaller than a given maximum error MAX  and at the sampling points, the tangent is not continuous.Chapter 3.5.3 of [11] describes the sampled-data interpolation method for NURBS, and they conclude that "Due to the demand for high-speed machining, the sampled-data interpolation method is typically used in today's CNC system."We will use the reference pulse method instead of the sampled-data method, hence highaccuracy machining poses no problems, but we have to show that our method is suitable for high-speed machining.The circle NURB with 9 points is identical with the composite rational Bézier curves , and we compute the conic Fk[x,y] using the method of implicitization [37] with the resultant We can discretize the conics [6] very fast and with constant speed using the PRM-cs.We calculate the monotonic segments (the extreme points) using the NURB, instead of using the implicit equations, and that is really a big simplification.Fig. 7 The five conics Fig. 8 The 3 rd -degree and 2 nd degree NURB As an example, we take the trident of [13].This trident is 3 rd -degree NURB fnurb3, and we converted this NURB to a rational 2 nd -degree using the method of [31,32,33,34,35].So, the 3 rd -degree NURB was approximated to a 2 nd -degree NURB fnurb2, and we can always do it when we apply algorithm 6 of [35] for a given maximum approximation error MAX  .The NURB fnurb2 is identical with the five composite rational Bézier curves CBk[t] (Appendix 4.1, Convert NURB to Conics).Fig. 7 and Fig. 8 show the results.The scale factor SC=1000 converts the dimensions of the Trident from mm to µm, Peng [13, Table 1] uses the maximum chord error of 1 µm, and the maximum error MaxErr of the MIDP-ipo is 0.5 µm.pts3=SC*{ p0, p1, p2, p3, p4, p5, p6 } = SC*{ {20,0}, {40,40}, {24,16}, {20,40}, {16,16}, {0,40}, {20,0} }, knots3={ 0, 0, 0, 0, 0.25, 0.5, 0.75, 1, 1, 1, 1 }, weights3={1, 1, 1, 1, 1, 1, 1}, fnurb3= BSplineFunction[ pts3, SplineDegree → 3, SplineKnots → knots3, SplineWeights , , , , , , , , Fig. 8 shows the contour and the control points of the 3 rd -degree Trident fnurb3[t] in orange and the contour and control points of the 2 nd -degree Trident fnurb2[t] in blue.The two contours overlap rather well.The piecewise conics fit exactly the 2 nd -degree NURB fnurb2.Fig. 7 shows the contour of the 3 rd -degree Trident and the five individual conics of the composite Bézier.The lengths of the conics were not calculated, but LSnpuls=97518.RegionNearest ,P  , hence the tangent, LMcs, and LNcs could be calculated.The maximum error was less than 0.5 µm and for a resolution of 1 µm (SC equal to 1000) the execution time was about a day.The causes are the error function dNURBErr and the slow programming language Mathematica.Therefore, we used the relative fast programming language Alaska Xbase++ 1.9 from Alaska Software, Germany.We could easily import the conics calculated with Mathematica and import or export other data.So, we used Mathematica and converted the 3 rd -degree NURB to the 2 nd -degree Trident NURB.We converted this NURB to 5 conics with coefficients {Ak, Bk, Dk, Ik, Jk, Mk} , and exported the conics, the startpoints, endpoints, the extreme points (monotonic points), the direction of the conics (CCW or CW) and the determinant of the conics to our Alaska program.This all took, with a lot of graphics, about 9 seconds.The Alaska program created the Trident-ipo using the very fast Berserkless Midpoint Algorithm [6] based on [5].This program did not calculate the MaxErr, because it does not need an error function, but it created the array listSIM        nn x ,y ,npuls , ,   .This array was also exported to Mathematica; hence we could compare the execution time of the listSIM-ipo using Mathematica (132 seconds) and Alaska (0.07 seconds).This clearly shows the difference of the execution speed of the two programming systems.The MaxErr of the MIDP-ipo is less than 0.5 µm, and the maximum chord error of [13, Table 1] equals 1 µm, and they used a real-time motion control card based on DSP + FPGA for the AM-method and the IAM method [13, Table 2].

Fig. 1
Fig. 1 Velocity-position system based on the reference pulse IPO practice  equals one.

4 )
The signed distance of a point Pn={xn,yn} to the 2D-line is n  = sErr[Pn]= M n is the square distance of the point Pi, then the comparison 22 CB    can be written as dM=-2*SLxy*FM[xM,yM]>0 [5, pp 24, 25], SLxy  SLEFT*Sx*Sy, FM[xM,yM] is the residue of the conic or the line in the midpoint 1 / -1 when the residue is negative/positive on the left side of the line or conic, hence SLxy is a fixed constant in the monotonic segment {Sx, Sy}.Analogous, 22 DB    corresponds with dH=-2*SLxy*FH[xH,yH]>0, and 22 CD    corresponds with dV=-2*SLxy*FV[xV,yV]>0

Table 2 The
Cost, npuls} of the discrete line of the best IPO equal {0.497924, 10.0968, 121}.The simulated length of the four inaccurate IPO's equals npuls and that equals the rounded length of the line: (Round[Norm[L]]=Round[120.835]), hence the four IPO's generate constant speed discrete lines when one adds a proper PRM-cs (Table 1).The Cost of the inaccurate IPO's of §1.7.3 increases with 7%, but the MaxErr increases with 37.1 %.
8} and for nkey  4, {5,5}.This means that the value 8 or 9 of npuls, can be considered as a good result for Table5and that the value 5 of npuls is a good result for Table4.

Table 6
shows the result of three 3D-line constant speed IPO's.The feedrate is constant as npuls, equal to Round[LS] shows.Item (#A) corresponds with a well-designed 3D-BRM, nevertheless the Cost is bad and the MaxErr is 46.8 larger than the minimum MaxErr.Item (#B) corresponds with the 3D-PRM of §1.7.3, and although it contains one PRM-cs and two 2D-PRM-ipo's, it is better than the 3D-BRM-ipo, which contains three 2D-PRM-ipo's.This, once again, shows that the BRM-ipo must be replaced by a PRM-cs in cascade with an actual non-constant speed IPO, and preferably the BRES-ipo.Item (#C) corresponds with the Best 3D-line BRES-ipo.