Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

intersection

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

Comments

  • gautamgautam Member Posts: 642
    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?
    :

  • SephirothSephiroth Fayetteville, NC, USAMember Posts: 1,035
    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]

  • gautamgautam Member Posts: 642
    [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]
    :
    :

Sign In or Register to comment.