Einzelnen Beitrag anzeigen

Kas Ob.

Registriert seit: 3. Sep 2023
457 Beiträge
 
#19

AW: Ellipsenalgo aus Formelsammlung kreieren

  Alt 9. Jul 2025, 17:31
Maybe one solution would be to divide the ellipse into sections, where its equal to circle, where its more dense and where its not so dense, for switching to different optimized algorithms in each segment.
Think about it, no matter how much you divide it will return to check against the last pixel or calculating the new (next) pixel distance form the current:
1) in the first it is easier to simply compare (new pixel vs last pixel) then adjust.
2) in the other you must have the distance is close enough to 1 in four straight direction (up, down, left and right) and close enough to sqrt(2) in 4 diagonal direction, any less than that we are drawing on top of the current (or the last), any bigger we are skipping.

Whole problem is due the arithmetic is in float numbers while drawing and coordination in integers.

i don't think that there is quite real one liner algorithm that can be solve this.
Kas
  Mit Zitat antworten Zitat