where a point is in relation to another point
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.
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.
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?
That depends if you define the look at vector facing towards or facing away from the camera.
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.
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.
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
xA + xV = xB
yA + yV = yB
zA + zV = zB
xV = xB - xA
yV = yB - yA
zV = zB - zA
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement