Sign in to follow this  
u235

where a point is in relation to another point

Recommended Posts

I know how to find the distance between two 3D points, but I was wondering if there is a way to tell if point A is behind or in front another point, B, given a normal vector for point B, or in the case of a camera's position, it's look at vector? Thanks.

Share this post


Link to post
Share on other sites
Find the vector from A to B. Take the dot product of that vector with the orientation of the camera. The sign will tell you if A is in front of B or vice versa.

Share this post


Link to post
Share on other sites
Thanks. For clarification, I am assuming that a negative sign means behind and positive is in front? Also, do the vectors need to be normalized prior to taking the dot product?

Share this post


Link to post
Share on other sites
Ok, all that makes sense and all, but I am having a bit of trouble finding the vector from camera position to the point in question. I found this formula that almost makes sense except for one thing. Here's the formula:

v = (xb-xa)i + (yb-ya)j + (zb-za)k

The i, j and k have carets over them, meaning they are unit vectors. I'm not exactly sure what they are though. The page I got this from doesn't explain what they are. My initial assumption is that they are the unit vectors of each respective axis, which makes sense, but I just want to make sure. Thanks.

Share this post


Link to post
Share on other sites
Ok, let's say you have points A and B. Where A is (xA, yA, zA) and B is (xB, yB, zB). The vector from A to B is the vector that when added to (xA, yA, zA) equals (xB, yB, zB). So let's say the vector is (xV, yV, zV). Then you'd have

xA + xV = xB
yA + yV = yB
zA + zV = zB

xV = xB - xA
yV = yB - yA
zV = zB - zA

Share this post


Link to post
Share on other sites

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