I was wondering how to calculate the position of a point when you know the x,y,z coordinates of the viewingpoint(camera) and the rotations(rx,ry,rz) of the viewingpoint. And you know the distance (for instance 4).
Asked
Active
Viewed 105 times
1 Answers
0
The easiest way to solve this issue is to specify the point relative to the camera, then to apply the inverse transformation of the camera in order to place the point in world space.
From the perspective of the camera, the point you described would be
vec4(0, 0, -4, 1)
If your transformations are in homogeneous matrix format,
M = [ R_3x3 T ]
[ 0 0 0 1 ]
then we can compute the inverse as follows (Source):
inv(M) = [ inv(R_3x3) -inv(R_3x3) * T ]
[ 0 0 0 1 ]
This is now our view-space to world-space matrix. We simply apply this transformation to our view-space point:
V_worldspace = M * vec4(0, 0, -4, 1)

Community
- 1
- 1

Emilian Cioca
- 91
- 2
- 6