Re: Searching algorithm for determining voxels in pyramid
- From: Richard Heathfield <rjh@xxxxxxxxxxxxxxx>
- Date: Wed, 20 Feb 2008 09:48:49 +0000
Marco Körner said:
Hello,
I'm working with a optical sensor. This sensor has a pyramidal field
of view. For updating my environmental model, I need to know the
voxels lying within this pyramid.
I know:
- points of a pyramide with square base
- dimensions of each voxel
Does anybody have an idea how to solve this problem analytically?
Let the sensor be at S. "Looking" straight ahead, it can see an arbitrarily
distant point I. Around I are four other points, also arbitrarily distant,
which we will call E1, E2, E3, E4 (such that E1 is opposite E3), and which
form, not the corners, but the mid-points of the edges, of the pyramidal
field. You can choose the arbitrary distance R yourself. It represents the
range of the sensor. But I adopt the convention that E1 is "up" from the
midpoint, E2 is "right", E3 is "down", and E4 is "left":
+--------E1--------+
| V | N
| |
E4 I E2
| |
| |
+--------E3--------+
Imagine your eye is the sensor at S (not shown, because ASCII won't let me
poke my arm out of the monitor to jab you in the eye). If all you can see
is the above rectangle, then it represents an arbitrarily distant
"backplane" to the pyramidal viewfield. V is a Visible Voxel, and N is a
Non-visible Non-entity.
We're about to look at some angles. The baseline for angles is SI, with
lines striking the arbitrarily distant backplane "up" and "right" being
positive angles. Skip to the next paragraph if you understand this! Okay,
I want you to imagine that you are pointing your arm along the line SI.
Now, without moving it left or right, rotate your arm up towards E1.
That's a positive angle. Now move it towards E3. As you pass I, your arm
goes negative. Now point it at I again, and move it right (but not up or
down) towards E2. That's a positive angle, too. But move it left and, as
it passes I and heads towards E4, it goes negative.
A voxel V is within the field of view if it obeys six constraints:
1) Its distance SV from the sensor is < R.
2) Its distance SV from the sensor is >= 0. (i.e. we do not consider points
behind the sensor.)
3) The angle formed by the voxel V, the sensor S, and the arbitrarily
distant point I, i.e. the angle VSI, is less than the angle formed by E1,
S, and I.
4) The angle VSI is less than the angle formed by E2, S, and I.
5) The angle VSI is greater than the angle formed by E3, S, and I.
6) The angle VSI is greater than the angle formed by E4, S, and I.
If you are just detecting whether a given point is within the viewfield,
that's how to do it. But if you want to find ALL such voxels, it's a lot
quicker to start at the backplane (because that gives you sensible
leftrightupdown limits), determine or calculate E1, E2, E3, E4 to give you
those limits, accept all the points with co-ordinates in the range E1y to
E3y and E2x to E4x, and then just lather, rinse and repeat (bringing the
backplane forward by one voxel's depth) until R is 0.
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.
- Follow-Ups:
- Re: Searching algorithm for determining voxels in pyramid
- From: Clive D. W. Feather
- Re: Searching algorithm for determining voxels in pyramid
- References:
- Searching algorithm for determining voxels in pyramid
- From: Marco Körner
- Searching algorithm for determining voxels in pyramid
- Prev by Date: Searching algorithm for determining voxels in pyramid
- Next by Date: Re: Results of the memswap() smackdown from the thread "Sorting" assignment
- Previous by thread: Searching algorithm for determining voxels in pyramid
- Next by thread: Re: Searching algorithm for determining voxels in pyramid
- Index(es):
Relevant Pages
|