User talk:Huypens

Clarification:
Bresenham’s algorithm digitizes a curve. The digital points are the grid points, and the selection of the best grid points, happens using the “midpoint” technique. It starts with the best grid point (the starting point), and because the direction is given, the two possible candidate grid points are known. The midpoint is the arithmetic mean of the two candidate points. For a line, the candidate-point at the minimal Euclidean distance to the line, is chosen. For an ellipse, a parabola, or a hyperbola, the candidate-point at the minimal Euclidean distance to the polar of the midpoint versus the conic, is chosen. The selected point is in fact the result of a relative measurement and we can prove, (the proof is extremely complex), provided that the measurement is not Out-of-Control (OoC), that the selected point is at the minimal Euclidean distance to the conic, taking into account the possible measurement error, which is less than half of the distance between the candidate-points. Non quadratic curves can be approximated by “piecewise conics”, called quadratic Bézier splines (also called conic splines or squines). So far, the general algorithm, could not be converted into hardware : very often, the digitization will be berserk (unstable)  , when the measurement becomes OoC. The midpoint algorithms or the general Bresenham algorithms are reputed to be unstable algorithms. Recently, Valere Huypens found an ultra fast solution, namely the "Berserkless ultra fast 4-Connected Midpoint Algorithm" and the “Berserkless ultra fast 8-Connected Midpoint Algorithm"

Stable 4-connected digitization of general conics
In, Donal E. Knuth has written the ultra fast algorithm T. Algorithm T can also be written using the midpoint technique. Algorithm T and the midpoint algorithms have major drawbacks. First, they do not detect when they become unstable. Second, they cannot avoid, in practice, that they become berserk. Therefore, the algorithm cannot be transformed to hardware. The new algorithm is 100% stable. The 4-connected algorithm will be presented in pseudocode, but the 8-connected algorithm will not be given. Paper gives a very good overview of the work done. Donald Knuth writes: "Algorithms for discrete geometry are notoriously delicate; unusual cases tend them berserk, see page 180 of . A. van Dam is really pessimistic about digitizing general conics:"Digitizing general conics is very hard ... Do it only if you have to".

Berserkless 4-connected Midpoint Algorithm
The conic can be described as :
 * $$2f(x,y)\triangleq A{{x}^{2}}+B{{y}^{2}}+2Dxy+2Ix+2Jy+M=0$$
 * $$X\triangleq Ax+Dy+I,\,\,\,\,\,\,\,\,\,\,\,\,\,\,Y\triangleq Dx+By+J,\,\,\,\,\,\,\,\,\,\,\,\,\,\,W\triangleq Ix+Jy+M$$
 * $$\mathbf{G}\triangleq \mathbf{Grad}\,f(x,y)=X\mathbf{i}+Y\mathbf{j},\,\,\,\,\,\,\,\,\,\,\,\,\,\,\Delta \equiv \text{grid distance}$$

T-2.

 * Calculate $${{\mathbf{P}}_{X}},\,{{\mathbf{P}}_{Y}},\,{{\mathbf{M}}_{X}}\text{ and }{{\mathbf{M}}_{Y}}$$: the extreme points and/or the intersection points with the border of a given frame, given 2f(x,y)=0 and the frame.

T-1.

 * Calculate the boolean of the determinant $$DET\triangleq \left| \begin{matrix}

A & D & I \\ D & B & J \\ I & J & M \\ \end{matrix} \right|\ne 0$$
 * $${{b}_{DET}}=IF(\,DET>0,\,\,1,\,\,0\,)$$

i)

 * Real-valued points $$({{\xi }_{0}},{{\eta }_{0}})$$ and $$({{\xi }_{4}},{{\eta }_{4}})$$ exist such that $$2f\,({{\xi }_{0}},{{\eta }_{0}})=2f\,({{\xi }_{4}},{{\eta }_{4}})=0$$

ii)

 * The curve travels from $$(\xi ,\eta )$$ to $$({\xi }',{\eta }')$$ monotonically in both coordinates
 * from $$(\xi ,\eta )=({{\xi }_{0}},{{\eta }_{0}})$$ to $$({\xi }',{\eta }')=({{\xi }_{1}},{{\eta }_{1}})$$,
 * from $$(\xi ,\eta )=({{\xi }_{1}},{{\eta }_{1}})$$ to $$({\xi }',{\eta }')=({{\xi }_{2}},{{\eta }_{2}})$$, etc.
 * T-2 is necessary to test the monotonic conditions and to find $$({{\xi }_{i}},{{\eta }_{i}})$$.

iii)

 * $${{x}_{A}}=\left\lfloor \frac{\xi }{\Delta }+\frac{1}{2} \right\rfloor \Delta ,\,\,\,\,\,\,\,\,\,\,{{y}_{A}}=\left\lfloor \frac{\eta }{\Delta }+\frac{1}{2} \right\rfloor \Delta ,\,\,\,\,\,\,\,\,\,\,{{x}_{E}}=\left\lfloor \frac{\Delta }+\frac{1}{2} \right\rfloor \Delta ,\text{ and }{{y}_{E}}=\left\lfloor \frac{\Delta }+\frac{1}{2} \right\rfloor \Delta $$
 * /* must be modified if optimal rounding is applied */

iv)

 * Input traveling direction $$\Leftrightarrow {{b}_{CC{{W}_{user}}}}=\text{IF}\left( \text{ Traveling Counterclockwise}\,,\text{ 1},\text{ }0\text{ } \right)$$
 * $${{b}_{LEFT}}\triangleq {{b}_{CC{{W}_{user}}}}\oplus {{b}_{DET}}\text{  /*  }\oplus \text{ is the logical xor operation  */}$$

v)

 * The condition “No edge of the integer grid contains two roots of Q” is not necessary anymore, see page 46 of.

T1.

 * Define $$({{b}_{x}},{{b}_{y}})$$ given $$({{x}_{A}},{{y}_{A}})$$,$$({{x}_{E}},{{y}_{E}})$$ using,
 * $${{b}_{x}}=IF({{x}_{E}}-{{x}_{A}}\ge 0,\,1,\,0),$$
 * $${{b}_{y}}=IF({{y}_{E}}-{{y}_{A}}\ge 0,\,1,\,0).$$
 * Note: $${{S}_{x}}=IF({{b}_{x}}==1,\,\,1,\,\,-1),\,\,{{S}_{y}}=IF({{b}_{y}}==1,\,\,1,\,\,-1)$$.
 * Do TF: $$bEND=\text{Filter given }(x={{x}_{A}},y={{y}_{A}}),\,\,({{x}_{E}},{{y}_{E}}),\,\,({{b}_{x}},{{b}_{y}})$$.
 * Define $$({{b}_{x}},{{b}_{y}},{{b}_{Lxy}}={{b}_{x}}\oplus {{b}_{y}}\oplus {{b}_{LEFT}})$$ given $$({{x}_{A}},{{y}_{A}}),\,\,({{x}_{E}},{{y}_{E}}).$$
 * Calculate the boolean of the control factor defined as $$\lambda \triangleq \frac{A+B-2{{S}_{x}}{{S}_{y}}D}{8}{{\Delta }^{2}}$$:
 * $${{\Lambda }_{\lambda }}=A+B-2{{S}_{x}}{{S}_{y}}D\,\,,\,\,\,\,\,\,\,\,\,\,{{b}_{\lambda }}=IF(\,{{\Lambda }_{\lambda }}\,\,\ge \,\,0\,,\,\,1,\,\,0\,)\,\,.$$
 * Put $$x={{x}_{A}},\,\,\,y={{y}_{A}},\,\,\,bEND=0\,\,.$$
 * Do T12 = Calculate $$({{X}_{A}},{{Y}_{A}},{{W}_{A}},2{{f}_{A}})$$ given $$({{x}_{A}},{{y}_{A}})$$.
 * Do T13 = Calculate $$({{X}_{M}},{{Y}_{M}},2{{f}_{M}},{{b}_{xmove}})$$ given $$({{X}_{A}},{{Y}_{A}},2{{f}_{A}})$$ and $$({{b}_{x}},{{b}_{y}},\Delta )$$
 * Go to Ti  /*  D. Knuth at pages 46-47 uses go to $$Tj:j=2\overline+\overline+2$$  */

Ti.

 * do while $$\overline{bEND}$$
 * $$\text{If }({{b}_{xmove}}==1)\,\,x=x+{{S}_{x}}\Delta \text{ else }y=y+{{S}_{y}}\Delta $$.
 * $$\text{Do TF: }bEND=\text{Filter given }(x,y),\,\,({{x}_{E}},{{y}_{E}})$$.
 * If $$\overline{bEND}$$ Do T14 = Calculate $$({{X}_{M}},{{Y}_{M}},2{{f}_{M}},{{b}_{xmove}})$$ given $$({{X}_{M}},{{Y}_{M}},2{{f}_{M}},{{b}_{xmove}})$$ and $$({{b}_{x}},{{b}_{y}},\Delta )$$.
 * Endif
 * end do
 * Next segment or Terminate

TF.

 * If $$y=={{y}_{E}}$$ go to T10; if $$x=={{x}_{E}}$$  go to T11; Return

T10.

 * $$bEND=1$$; While $$x\ne {{x}_{E}}$$ set $$x=x+{{S}_{x}}\Delta $$; Next segment or Terminate.

T11.

 * $$bEND=1$$; While $$y\ne {{y}_{E}}$$ set $$y=y+{{S}_{y}}\Delta $$; Next segment or Terminate.

T12.

 * /* Calculate $$({{X}_{A}},{{Y}_{A}},{{W}_{A}},2{{f}_{A}})$$ given $$({{x}_{A}},{{y}_{A}})$$*/
 * $${{X}_{A}}=(A{{x}_{A}}+D{{y}_{A}}+I)\,\,\,\,\,\,\,\,\,\,{{Y}_{A}}=(D{{x}_{A}}+B{{y}_{A}}+J)\,\,\,\,\,\,\,\,\,\,{{W}_{A}}=(I{{x}_{A}}+J{{y}_{A}}+M)$$
 * $$2{{f}_{A}}=({{x}_{A}}{{X}_{A}}+{{y}_{A}}{{Y}_{A}}+{{W}_{A}})$$
 * Return	 (* end of T12  *)

T13.

 * /* Calculate $$({{X}_{M}},{{Y}_{M}},2{{f}_{M}},{{b}_{xmove}})$$ given $$({{X}_{A}},{{Y}_{A}},2{{f}_{A}},{{b}_{x}},{{b}_{y}},\Delta )$$ */
 * $$2{{f}_{M}}=2f({{x}_{A}}+{{S}_{x}}{\Delta }/{2}\;,{{y}_{A}}+{{S}_{y}}{\Delta }/{2}\;)=2{{f}_{A}}+[{{S}_{x}}{{X}_{A}}+{{S}_{y}}{{Y}_{A}}+(A+B+2{{S}_{x}}{{S}_{y}}D){\Delta }/{4}\;]\Delta $$
 * $${{X}_{M}}=X({{x}_{A}}+{{S}_{x}}{\Delta }/{2}\;,{{y}_{A}}+{{S}_{y}}{\Delta }/{2}\;)={{X}_{A}}+({{S}_{x}}A+{{S}_{y}}D){\Delta }/{2}\;$$
 * $${{Y}_{M}}=Y({{x}_{A}}+{{S}_{x}}{\Delta }/{2}\;,{{y}_{A}}+{{S}_{y}}{\Delta }/{2}\;)={{Y}_{A}}+({{S}_{x}}D+{{S}_{y}}B){\Delta }/{2}\;$$
 * $${{b}_}=IF(\,{{f}_{M}}\ge 0,\,\,1\,,\,\,0\,)$$
 * $${{b}_}=IF(\,{{f}_{M}}==0,\,\,\overline,\,\,{{b}_}\,)$$ /* if optimal rounding is applied  */
 * $${{b}_{M}}=\text{IF}(\,\,{{S}_{y}}{{Y}_{M}}-{{S}_{x}}{{X}_{M}}\ge 0,\,\,1\,,\,\,0\,\,)$$
 * $${{b}_{\lambda }}=IF(\,{{\Lambda }_{\lambda }}\,\,==\,\,0\,,\,\,\overline,\,\,{{b}_{\lambda }}\,)$$
 * // The next 2 lines can be put in a subroutine T15
 * $${{b}_}=IF(\,{{b}_{M}}\oplus {{b}_{Lxy}}==0,\,\,\overline,\,\,{{b}_}\,)$$
 * $${{b}_{xmove}}={{b}_}\oplus {{b}_{Lxy}}$$
 * /* $${{Q}_{DK}}\equiv 2{{f}_{M}}\,\,\,\,\,\,\,\,\,\,{{R}_{DK}}\equiv 2{{X}_{M}}+{{S}_{x}}A\Delta \,\,\,\,\,\,\,\,\,\,{{S}_{DK}}\equiv 2{{Y}_{M}}+{{S}_{y}}B\Delta $$  */
 * /* $$2{{f}_{M}}=2{{f}_{A}}+[{{S}_{x}}({{X}_{M}}+{{X}_{A}})+{{S}_{y}}({{Y}_{M}}+{{Y}_{A}})]{\Delta }/{2}\;$$  */
 * Return (* end of T13  *)

T14.

 * /* Calculate $$({{X}_{M}},{{Y}_{M}},2{{f}_{M}},{{b}_{xmove}})$$ given $$({{X}_{M}},{{Y}_{M}},2{{f}_{M}},{{b}_{xmove}})$$, $$({{b}_{x}},{{b}_{y}},\Delta )$$ */
 * $$2{{f}_{M}}=2{{f}_{M}}+{{b}_{xmove}}({{S}_{x}}2{{X}_{M}}+A\Delta )\Delta +\overline({{S}_{y}}2{{Y}_{M}}+B\Delta )\Delta $$
 * $${{X}_{M}}={{X}_{M}}+{{b}_{xmove}}{{S}_{x}}A\Delta +\overline{{S}_{y}}D\Delta $$
 * $${{Y}_{M}}={{Y}_{M}}+{{b}_{xmove}}{{S}_{x}}D\Delta +\overline{{S}_{y}}B\Delta $$
 * $${{b}_}=IF(\,{{f}_{M}}\ge 0,\,\,1\,,\,\,0\,)$$
 * $${{b}_}=IF(\,{{f}_{M}}==0,\,\,\overline,\,\,{{b}_}\,)$$ /* if optimal rounding is applied */
 * $${{b}_{M}}=\text{IF}(\,\,{{S}_{y}}{{Y}_{M}}-{{S}_{x}}{{X}_{M}}\ge 0,\,\,1\,,\,\,0\,\,)$$
 * $${{b}_{\lambda }}=IF(\,{{\Lambda }_{\lambda }}\,\,==\,\,0\,,\,\,\overline,\,\,{{b}_{\lambda }}\,)$$
 * // The next 2 lines can be put in a subroutine T15
 * $${{b}_}=IF(\,{{b}_{M}}\oplus {{b}_{Lxy}}==0,\,\,\overline,\,\,{{b}_}\,)$$
 * $${{b}_{xmove}}={{b}_}\oplus {{b}_{Lxy}}$$
 * Return (*  end of T14  *)

Reference
* Category:Euclidean solid geometry Category:Algebraic curves Category:Analytic geometry Category:Geometric algorithms Category:Digital geometry

Your submission at Articles for creation
 Thank you for your recent submission to Articles for Creation. Your article submission has been reviewed. However, the reviewer felt that a few things need to be fixed before it is accepted. Please view your submission to see the comments left by the reviewer. You are welcome to edit the submission to address the issues raised, and resubmit once you feel they have been resolved. (You can do this by adding the text to the top of the article.)
 * If you would like to continue working on the submission, you can find it at Articles for creation/Berserkless 4-Connected Ultra Fast Midpoint Algorithm for General Conics.
 * To edit the submission, you can use the edit button at the top of the article, near the search bar
 * If you need any assistance, you can ask for help at the Help desk or the [ reviewer's talk page]. Alternatively you can ask a reviewer questions via live help
 * Thank you for your contributions to Wikipedia!  Chzz  ► 08:46, 19 December 2011 (UTC)

Wikipedia talk:Articles for creation/Berserkless 4-Connected Ultra Fast Midpoint Algorithm for General Conics concern
Hi there, I'm HasteurBot. I just wanted to let you know that Wikipedia talk:Articles for creation/Berserkless 4-Connected Ultra Fast Midpoint Algorithm for General Conics, a page you created has not been edited in at least 180 days. The Articles for Creation space is not an indefinite storage location for content that is not appropriate for articlespace. If your submission is not edited soon, it could be nominated for deletion. If you would like to attempt to save it, you will need to improve it. You may request Userfication of the content if it meets requirements. If the deletion has already occured, instructions on how you may be able to retrieve it are available at WP:REFUND/G13. Thank you for your attention. HasteurBot (talk) 14:08, 14 August 2013 (UTC)