Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: pixel in ellipsis:

by roboticus (Chancellor)
on Jun 03, 2015 at 23:02 UTC ( [id://1129012]=note: print w/replies, xml ) Need Help??


in reply to Re: pixel in ellipsis:
in thread Graphics math.

BrowserUk:

Just a couple weeks ago I had to do something pretty similar (reduce a complex outline to a simpler one) and found a pretty simple starting point: Ramer Douglas Peucker algorithm. I'd suggest taking the leftmost and rightmost points to use as the endpoints, and make two paths (upper and lower). Then, if you're finding the error at the left and right ends to be apparent, then select a couple points near the left and right sides and run on the shorter paths. Then merge them. I didn't need to do that, so I contented myself with the upper and lower paths it created. Worked nicely, and pretty simple to code, too. It was actually *harder* to find the appropriate search terms than to code it.

Update: forgot to mention it--the first step would be to provide a list of points defining the boundary. Then use the algorithm to cull the list of points to the most efficient set.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^3: pixel in ellipsis:
by BrowserUk (Patriarch) on Jun 04, 2015 at 14:43 UTC

    I took a look at this, but it requires at least 8 lines segments to even vaguely approximate a circle or ellipse -- and double that to get somewhat close.

    Even once several are combined, the inflection points created by compound curves crossing compound curves mean that there is very little scope for reduction in the total number of lines without loosing even the general shape.

    And in the end, the point in polygon algorithm requires substantially more work/runtime than using one formula per ellipse; even when there is considerable overlap between them.

    I knew it was a long shot from the outset; but I've been pleasantly surprised by such stabs in the dark before.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
    In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1129012]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-03-28 13:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found