# intersection

I need to know at what point a line crosses a surface. Is there a routine in Opengl for finding the intersection point?

• None in opengl - sorry.

But its simple enough to do.

Get the surface normal. Then take the first point of line and get the dot product of the of plane normal and that vector.

If the dot product is less than 0 then its behind the plane. Else its in front of the plane. if its 0 then its touching the plane.

Hope this helps.

: I need to know at what point a line crosses a surface. Is there a routine in Opengl for finding the intersection point?
:

• Fayetteville, NC, USA
This is something I am trying to figure out myself. My problem is not enough math. Would finding the dot-product be something I can call in 'math.h'? How about the others?? I've got my 3D engine running FINE, but you can clip like crazy!

-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

• [code]
float DotProduct(const vector3 &a, const vector3 &b)
{
return a.x*b.x + a.y*b.y + a.z*b.z;
}
[/code]

Its just the product of each element of both vectors.

: This is something I am trying to figure out myself. My problem is not enough math. Would finding the dot-product be something I can call in 'math.h'? How about the others?? I've got my 3D engine running FINE, but you can clip like crazy!
:
:
: -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
:
: