Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Calculate whether a point is above or below a plane

Subject: Calculate whether a point is above or below a plane

From: Ian Pereira

Date: 11 Jul, 2010 07:13:10

Message: 1 of 6

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.

Subject: Calculate whether a point is above or below a plane

From: Roger Stafford

Date: 11 Jul, 2010 08:04:06

Message: 2 of 6

"Ian Pereira" <pereirai@rogers.com> wrote in message <i1bqu5$ig2$1@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

Subject: Calculate whether a point is above or below a plane

From: us

Date: 11 Jul, 2010 09:36:05

Message: 3 of 6

"Ian Pereira" <pereirai@rogers.com> wrote in message <i1bqu5$ig2$1@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

Subject: Calculate whether a point is above or below a plane

From: Jan Simon

Date: 11 Jul, 2010 14:51:04

Message: 4 of 6

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

Subject: Calculate whether a point is above or below a plane

From: Ian Pereira

Date: 12 Jul, 2010 17:50:19

Message: 5 of 6

"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <i1cloo$s4h$1@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.

Subject: Calculate whether a point is above or below a plane

From: Jan Simon

Date: 12 Jul, 2010 18:59:06

Message: 6 of 6

Dear Ian,

If you have 50k points, you can rotate the 3D coordinates such that the normal vektor of the plane is parallel e.g. to the Z-axis.
Then a simple >= operation of the Z-component of the points is enough to decide if they are over or under the plane.

Jan

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us