Finding if a point is in front or behind a plane

The question is how to find, if specified point is behind a plane. And by plane I rather mean a point with a given direction.

Let’s say the plane is a point A with direction dirA, and the point we want to check is B
My thoughts were to check if dot product of dirA and a vector, that represents the length from the “plane” to the point B. But the thing is that vector would need to be perpendicular to the plane, and I got no idea how to get that vector.

Is my concept right? If it is, how do I get the vector I need?

The general prodecure would be this, as you already stated:
[ul]
[li] vec normalA;[/li][li] vec AB = B - A;[/li][li] double dot = dot(AB, normalA);[/li][li] bool inFront = (dot > 0);[/li][/ul]

Of course you need the normal of the plane; with only one direction parameter of the plane, this task can’t be solved. Which information do you have, or rather what do you mean by “point A with direction dirA”? A small sketch would be helpful and might answer the question to yourself :wink:

I actually tried doing it this way, but it didn’t work.

Perhaps an explanation will be better than a picture :slight_smile:

Try to imagine a a vertex with a normal. Then, imagine a plane that is perpendicular to that normal. Now my goal is to check if different point lies on the side that normals points at, or at the opposite one.

I think the error is in AB = B - A, since A is not perpendicular to B.
I imagine it like this. The picture itself is 2D, but it should work the same for 3D.

A is not perpendicular to B… how can a point be perpendicular to another point? :smiley:
What you’ve drawn is correct… if you have the normal, which is normalA in my formula, and have the points A and B, you have everything you need.
dot(normalA, AB) basically gives you a hint about the angle between the two vectors. If the vectors are perpendicular, i.e. if B lies in your plane, the dot product is 0.
It is >0 if the angle is <90° and <0 if the angle is >90°. Maybe you could try to calculate it for test values to see if it is correct.

I meant A as a plane :slight_smile:

It actually works fine when I try with test values. I must did something wrong in the actual code.
Big thanks!