Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Interesting problem fitting points to a template (algorithm?)

by FoxtrotUniform (Prior)
on Oct 05, 2004 at 21:22 UTC ( [id://396767]=note: print w/replies, xml ) Need Help??


in reply to Interesting problem fitting points to a template (algorithm?)

I need to select the points with in the regions that closest match the template, with the knowlede that the region may not contain any valid points.

A Voronoi diagram of your template will give you a set of "nearest-neighbour" regions. That is, each template point will have a Voronoi cell associated with it; every input point in that cell is closer to that cell's template point than to any other template point. (That would be so much easier to say in LaTeX math-mode.)

If your points are on a grid, you can build a bitmap from the Voronoi diagram, with a unique colour for each template point's Voronoi cell. Checking inputs is simply a matter of looking up their position in the bitmap (finding the colour, and thus which template point they're closest to), and calculating the distance to that point. Simple and O(n) once you have the Voronoi diagram.

In the continuous domain, things are probably a bit trickier. Find a good computational geometry text in your local university library; it should have plenty of stuff on this matter.

--
F o x t r o t U n i f o r m
Found a typo in this node? /msg me
% man 3 strfry

  • Comment on Re: Interesting problem fitting points to a template (algorithm?)

Replies are listed 'Best First'.
Re^2: Interesting problem fitting points to a template (algorithm?)
by tachyon (Chancellor) on Oct 05, 2004 at 22:40 UTC
    Here is a nice Voronoi applet that graphically shows the cells.

    cheers

    tachyon

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-25 16:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found