Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Finding points in a parallelepiped

576 views
Skip to first unread message

M

unread,
Sep 30, 2010, 6:53:04 PM9/30/10
to
I have a set of data (~ 5000 points) specified in 3 coordinates. I want to differentiate points that lie within a region from those that do not. My region is in the shape of a parallelepiped askew from the coordinate frame. I currently have my region described by a mesh of points covering the parallelepiped region's volume and have also easily identified the vertexes of parallelepiped. How do I determine if one of my data points lies within the boundaries of my parallelepiped region? I think I need, more or less, a 3D equivalent to the "inpolygon" function. Any ideas?
Thanks in advance for your help.
- Mary

M

unread,
Sep 30, 2010, 6:54:04 PM9/30/10
to

Roger Stafford

unread,
Sep 30, 2010, 7:10:20 PM9/30/10
to
"M " <m...@gmail.com> wrote in message <i834cg$kal$1...@fred.mathworks.com>...

> I have a set of data (~ 5000 points) specified in 3 coordinates. I want to differentiate points that lie within a region from those that do not. My region is in the shape of a parallelepiped askew from the coordinate frame. I currently have my region described by a mesh of points covering the parallelepiped region's volume and have also easily identified the vertexes of parallelepiped. How do I determine if one of my data points lies within the boundaries of my parallelepiped region? I think I need, more or less, a 3D equivalent to the "inpolygon" function. Any ideas?
> Thanks in advance for your help.
> - Mary
- - - - - - - -
It should be relatively easy to do this for a parallelepiped. Its six faces are contained in three parallel pairs of planes, and the condition for a point lying between two parallel planes is of the form:

d1 <= a*x + b*y + c*z <= d2

This gives you six inequalities that must be satisfied by any point within the parallelepiped. You should be able to determine these coefficients from the eight vertices.

Roger Stafford

Saurabh Mahapatra

unread,
Sep 30, 2010, 7:48:06 PM9/30/10
to
The first approach is about the property of parallelopipeds since they asuch nice regular objects: The three sides emanating from a vertex will form the basis of the 3D vector space. If you choose them as positive x, y, z axes, then any point can be expressed as a linear combination of them.

A point lies inside iff all the coefficients are positive and are less than lengths of the corresponding sides.

My second approach here is about reducing your problem to a more general one for convex volumes not necessarily parallelopipeds: The parallelopiped object is a convex object. The notion of a convex hull is but an elastic surface that wraps around a collection of points in 3D space. Since you have identified these vertices, doing a convex hull of them should give you the parallelopiped.

http://www.mathworks.com/help/techdoc/ref/convhulln.html

Plot it to verify. If you are successful, then the problem reduces to finding if a point belongs within a convex 3D volume for which we have the second term v

[K, v] = convhulln(...)

If the point is within the volume, then the volume should not change. And I am going to keep mum about the computational complexity of doing this:)

0 new messages