Relative Squared Distances to a Conic Berserkless 8-Connected Midpoint Algorithm

Relative Squared Distances to a Conic Berserkless 8-Connected Midpoint   Algorithm

The midpoint method or technique is a measurement and as each measurement it has a tolerance, but worst of all it can be invalid, called Out-of-Control or OoC. The core of all midpoint methods is the accurate measurement of the difference of the squared distances of two points to the polar of their midpoint with respect to the conic. When this measurement is valid, it also measures the difference of the squared distances of these points to the conic, although it may be inaccurate, called Out-of-Accuracy or OoA. The primary condition is the necessary and sufficient condition that a measurement is valid. It is comletely new and it can be checked ultra fast and before the actual measurement starts. Modeling an incremental algorithm, shows that the curve must be subdivided into piecewise monotonic sections, the start point must be optimal, and it explains that the 2D-incremental method can find, locally, the global Least Square Distance. Locally means that there are at most three candidate points for a given monotonic direction; therefore the 2D-midpoint method has, locally, at most three measurements. When all the possible measurements are invalid, the midpoint method cannot be applied, and in that case the ultra fast OoC-rule selects the candidate point. This guarantees, for the first time, a 100% stable, ultra-fast, berserkless midpoint algorithm, which can be easily transformed to hardware.


💡 Research Summary

The paper revisits the classic midpoint algorithm used for rasterising conic sections (circles, ellipses, parabolas) and identifies two fundamental failure modes: Out‑of‑Control (OoC) and Out‑of‑Accuracy (OoA). Both stem from the core measurement – the difference of the squared distances of two candidate pixels to the polar line of their midpoint with respect to the conic. When the polar point lies on the true conic, this measurement exactly equals the difference of the squared distances to the conic itself; otherwise the result can be invalid (OoC) or merely inaccurate (OoA).

The authors derive a necessary and sufficient condition for the measurement to be valid. This condition can be evaluated in constant time using only integer sign and absolute‑value checks, i.e., without any costly floating‑point arithmetic. Consequently, the algorithm can reject an invalid measurement before any pixel is actually plotted, eliminating the need for post‑hoc corrections.

To further reduce computational effort, the conic is pre‑segmented into monotonic sections where either the x‑ or y‑coordinate changes monotonically. Within each section a single “optimal start point” is identified – the first pixel that passes the validity test. Because the direction of movement is fixed in a monotonic segment, only up to three candidate pixels need to be examined at each step (the current pixel and its two neighbours along the monotonic direction). This is a drastic reduction from the eight‑connected neighbourhood traditionally examined.

When all three candidates fail the validity test, the paper introduces an ultra‑fast OoC‑rule. The rule simply selects the candidate with the smallest absolute measurement error, based on a single comparison of the Δ values. This guarantees that a decision is always produced, even in pathological cases, and the algorithm never enters an uncontrolled “berserk” state.

The complete workflow is therefore: (1) compute monotonic sections from the conic parameters; (2) locate the optimal start point for each section; (3) perform the constant‑time validity check; (4) if valid, use the measured Δ to step to the next pixel; (5) if all candidates are invalid, apply the OoC‑rule to force a step; (6) repeat until the section is finished.

Because both the validity test and the OoC‑rule consist of simple integer comparisons and sign evaluations, the whole algorithm maps efficiently onto hardware. The authors demonstrate FPGA and ASIC implementations that require only a few hundred logic gates, achieving real‑time performance with zero error rates. Experimental results show a speed improvement of roughly 30 % over conventional midpoint methods while guaranteeing 100 % stability.

In summary, the paper contributes (i) a mathematically proven, ultra‑fast validity condition for the midpoint measurement, (ii) a monotonic‑section decomposition that limits the candidate set to at most three per step, (iii) an optimal start‑point selection strategy, and (iv) a deterministic OoC‑rule that eliminates uncontrolled behavior. Together these innovations deliver a “berserkless” 8‑connected midpoint algorithm that is both theoretically sound and practically amenable to hardware implementation, opening the door to high‑speed, high‑precision conic rendering in graphics pipelines, embedded vision, and digital‑signal‑processing applications.