I have a list of vertices, I want to clip these inside the view frustum.
Here's what I am planning to do :
First I will loop through my list and check vertex $v$ for $|v.x| \le |v.w|$, $|v.y| \le |v.w|$ and $|v.z| \le |v.w|$.
If it fails then I will remove it from the list and add it to a
failedVertex
list.If it passes the test, then I will set up a inner loop to iterate through
failedVertex
list. For each vertex infailedVertex
, I will find the intersection of the line between my "passed" vertex and current failed vertex with the view frustum. I will then add the intersection point to myout
list.- Eg: if $v$ is a passed vertex and $w^i$ is
failedVertex[i]
, then I need the intersection between $r = v + \lambda(v - w^i)$ and my view frustum.
- Eg: if $v$ is a passed vertex and $w^i$ is
At the end of the inner loop I will add the passed vertex to my
out
list.
I have one problem with this approach, how do I find the intersection between my line and the view frustum ? I don't know the equations of the six planes of my view frustum, I don't really want to calculate the equation of the 6 planes.
I am not using OpenGL or Direct3D ...