parametric line is simple just extract the Z
axis direction vector and origin point O
from the direct camera matrix (see the link below on how to do it). Then any point P
on your line is defined as:
P(t) = O + t*Z
where t
is your parameter. The camera view direction is usually -Z
for OpenGL perspective in such case:
t = (-inf,0>
Depending on your projection you might want to use:
t = <-z_far,-z_near>
The problem is there are many combinations of conventions. So you need to know if you have row major or column major order of your matrix (so you know if the direction vectors and origins are in rows or columns). Also camera matrix in gfx is usually inverse one so you need to invert it first. For more info about this see: