POV-Ray : Newsgroups : povray.general : Something like "nearest neighbour"? : Re: Something like "nearest neighbour"? Server Time
4 Aug 2024 16:08:17 EDT (-0400)
  Re: Something like "nearest neighbour"?  
From: Tim Nikias v2 0
Date: 18 Mar 2003 13:39:45
Message: <3e7767f1$1@news.povray.org>
Never mind. I've just thought of a way to do it:

Take the point I want to map onto the grid. Calculate
the intersection of a line passing through that given
point (using the normal of the plane) and the water-plane.
Dissect the intersection-point with the span-vectors,
and calculate their lengths. Divide lengths by respective
distance between nodes. Round the results, and voila!
I got the indices for the nearest node.

I'm a little proud of myself. :-)
Anyone know if this algorithm already exists, or if there
is a faster way?

--
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights
Email: Tim### [at] gmxde


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.