# where a point is in relation to another point

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

## 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 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 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 on other sites
That depends if you define the look at vector facing towards or facing away from the camera.

##### Share on other sites
And no, the vectors don't need to be normalized.

##### 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 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

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 9
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
633715
• Total Posts
3013494
×