From: Ian Pereira on
Does anyone know an efficient algorithm to check if a 3D point lies above or below a plane?

I believe Yamaguchi has an algorithm, but I am not sure if it can be implemented into Matlab efficiently.

Tx.
From: Roger Stafford on
"Ian Pereira" <pereirai(a)rogers.com> wrote in message <i1bqu5$ig2$1(a)fred.mathworks.com>...
> Does anyone know an efficient algorithm to check if a 3D point lies above or below a plane?
>
> I believe Yamaguchi has an algorithm, but I am not sure if it can be implemented into Matlab efficiently.
>
> Tx.
- - - - - - -
It would depend on what is meant by "above" and "below". On the (almost) spherical earth, what is above a great circle plane and what is below it? Which way is up?

If you consider the z-axis as being the up and down axis, then what would you say about a plane that is orthogonal to the x-y plane?

If a plane in an xyz cartesian coordinate system is characterized by the equation

a*x+b*y+c*z+d = 0

then a point with coordinates x, y, and z, lies to one side of the plane in accordance with the sign of a*x+b*y+c*z+d. Positive, it is on one side; negative, it is on the opposite side; and zero, it lies right on the plane. However, which side is which depends on the particular coeffficients selected for a, b, c, and d. If one reverses all their signs, then the above criterion reverses even though the plane is the same.

Roger Stafford
From: us on
"Ian Pereira" <pereirai(a)rogers.com> wrote in message <i1bqu5$ig2$1(a)fred.mathworks.com>...
> Does anyone know an efficient algorithm to check if a 3D point lies above or below a plane?
>
> I believe Yamaguchi has an algorithm, but I am not sure if it can be implemented into Matlab efficiently.
>
> Tx.

this NG deals with ML language problems...

us
From: Jan Simon on
Dear Ian,

> Does anyone know an efficient algorithm to check if a 3D point lies above or below a plane?

If you ask for "above or below", you obviously have defined a direction. This is usually the normal vector of the plane. To define the plane completely, you need also one point which is any element of the plane.

The rest is easy: Measure the angle between 1. the vector from the point in your plane to the tested point and 2. the normal vector. How angles between vectors are measured efficiently has been discussed last week.

Did you ask your teacher for help also?
Jan
From: Ian Pereira on
"Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <i1cloo$s4h$1(a)fred.mathworks.com>...
> Dear Ian,
>
> > Does anyone know an efficient algorithm to check if a 3D point lies above or below a plane?
>
> If you ask for "above or below", you obviously have defined a direction. This is usually the normal vector of the plane. To define the plane completely, you need also one point which is any element of the plane.
>
> The rest is easy: Measure the angle between 1. the vector from the point in your plane to the tested point and 2. the normal vector. How angles between vectors are measured efficiently has been discussed last week.
>
> Did you ask your teacher for help also?
> Jan

Worked perfectly.

The main issue was the sign convention that matlab used, but I worked it out with a few test cases.

This was part of an algorithm to select all mesh vertices above a user-selected plane in a 3D reconstruction and manipulation app. Currently I'm scrolling through all mesh vertices and using the angles to see if they are above or below the plane. As some meshes are rather large (>50k faces), this can be a bit time-consuming, but at least it works now.