Results 1 to 3 of 3

Thread: Please help me with this function

  1. #1

    Thread Starter
    Frenzied Member cyborg's Avatar
    Join Date
    May 2000
    Location
    Sweden
    Posts
    1,755

    Please help me with this function

    I'm pretty sucky at C/C++ and math, so I need some help with this function:
    http://www.acm.org/jgt/papers/Moller...re97/code.html


    The function should check if a line intersects a triangle...

    Now the problem is that I don't know exactly how to call this function...

    Should all the points be [x,y,z]?
    Is dir[] a point in space or what?


    (Sorry for double posting)
    Check out the FAQ and do a search before you post.
    My tutorials: Anti-Alias Pixels, Accurate Game Loop, Resource File

  2. #2
    Fanatic Member twanvl's Avatar
    Join Date
    Dec 2001
    Posts
    771

    Re: Please help me with this function

    From the names it seems that:
    - orig is the origin of the line, dir is its direction.
    - vert0..2 are the corners of the triangle
    - all points should be [x,y,z], but the function itself doesn't care which order you put the components in (they are all treated the same), as long as it is consistent.
    - t will contain the time of intersection along the line. The intersection point will be orig + t * dir
    If you have a line between p0 and p1, choose orig = p0 and dir = p1 - p0

  3. #3

    Thread Starter
    Frenzied Member cyborg's Avatar
    Join Date
    May 2000
    Location
    Sweden
    Posts
    1,755

    Re: Please help me with this function

    Ok... Sounds about right! I'll try that!
    Check out the FAQ and do a search before you post.
    My tutorials: Anti-Alias Pixels, Accurate Game Loop, Resource File

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width