Sign in to follow this  

Which side of a plane is a vector

This topic is 4490 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have the following function to return on which side of the plane given by vectors X and Y a vector a is (side "true" or side "false")
bool sideOfPlane(Vector3 a, Vector3 X, Vector3 Y)
{
    Vector3 Z = cross(X, Y);
    Scalar aproj = dot(a, Z);
    if(aproj < 0) return false; else return true;
}
It works, but I wonder, is there a simpler way to do this? Thanks.

Share this post


Link to post
Share on other sites
The last line can be reduced to return aproj >= 0;, but except for that, if your plane is defined by a pair of base vectors, then your function is already as simple as it can get.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If you define the plane using a normal and distance from the origin, you can calculate a point on the plane and do the following .... (testpoint - pointonplane) * planenormal .... this will give you the perpendicular distance of the point from the plane

Share this post


Link to post
Share on other sites

This topic is 4490 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this