Notices
Results 1 to 7 of 7

Thread: find intersecting line between 2 planes

  1. #1 find intersecting line between 2 planes 
    Forum Ph.D.
    Join Date
    Dec 2006
    Location
    Norway
    Posts
    927
    hello, i'm trying to implement an interval overlap triangle-triangle collision detection method for a space combat simulator i'm working on, based on this

    http://www.google.no/url?sa=t&source...F9yy4iJg<br />

    this is how far i got.

    "triangle1"
    U0 = $triangle1.verts[1].pos
    U1 = $triangle1.verts[2].pos
    U2 = $triangle1.verts[3].pos
    "triangle2"
    V0 = $triangle2.verts[1].pos
    V1 = $triangle2.verts[2].pos
    V2 = $triangle2.verts[3].pos

    "normal2"
    normvector = cross (V1-V0) (V2-V0)
    n2 = normalize normvector

    d2 = dot -n2 V0
    "signed distances"
    n2*U0+d2
    n2*U1+d2
    n2*U2+d2

    however, i'm struggling with creating the point O in the formula
    L = O+tD. i managed to get tD from the formulas, but there doesn't seem to be an explanation on how to get O. what it tells me is that O is a point on the line where the planes cross.


    when you have eliminated the impossible, whatever remains, however improbable, must be the truth
    A.C Doyle
    Reply With Quote  
     

  2.  
     

  3. #2  
    Forum Radioactive Isotope MagiMaster's Avatar
    Join Date
    Jul 2006
    Posts
    3,440
    Without checking that link for now, I thought I should point out that the usual way of doing collision detection is with the separating axis theorem. If you project one triangle onto the normal of the other, there should be a gap, which is easy to check since it's then 1D. (Of course, when you have an object composed of a bunch of triangles, things can get a little more complex.)


    Reply With Quote  
     

  4. #3  
    Forum Ph.D.
    Join Date
    Dec 2006
    Location
    Norway
    Posts
    927
    Quote Originally Posted by MagiMaster
    Without checking that link for now, I thought I should point out that the usual way of doing collision detection is with the separating axis theorem. If you project one triangle onto the normal of the other, there should be a gap, which is easy to check since it's then 1D. (Of course, when you have an object composed of a bunch of triangles, things can get a little more complex.)
    well, this works like SAT, but on a per-triangle basis. what i need the axis for is to project the points of the triangles so that the line segments of the triangles can be compared, on the 1D line where the planes intersect.
    when you have eliminated the impossible, whatever remains, however improbable, must be the truth
    A.C Doyle
    Reply With Quote  
     

  5. #4  
    Forum Ph.D.
    Join Date
    Dec 2006
    Location
    Norway
    Posts
    927
    http://en.wikipedia.org/wiki/Plane_(geometry)#Line_of_intersection_between_two_ planes
    wiki seems to have something. now i just need to understand what that something is
    :P
    when you have eliminated the impossible, whatever remains, however improbable, must be the truth
    A.C Doyle
    Reply With Quote  
     

  6. #5  
    Forum Ph.D.
    Join Date
    Dec 2006
    Location
    Norway
    Posts
    927
    hum, well, tried implementing this:

    http://paulbourke.net/geometry/planeplane/

    but seems like it's 2-dimensional (if c1 and c2 are x and y coordinates.. urrh)


    "triangle1"
    U0 = $triangle1.verts[1].pos
    U1 = $triangle1.verts[2].pos
    U2 = $triangle1.verts[3].pos
    "triangle2"
    V0 = $triangle2.verts[1].pos
    V1 = $triangle2.verts[2].pos
    V2 = $triangle2.verts[3].pos

    "normal triangle1"
    normvector1 = cross (U1-U0) (U2-U0)
    n1 = normalize normvector1
    "d1"
    d1 = dot -n1 U0

    "normal triangle2"
    normvector2 = cross (V1-V0) (V2-V0)
    n2 = normalize normvector2
    "d2"
    d2 = dot -n2 V0

    "D direction of line"
    d = cross n1 n2

    "signed distances"
    n2*U0+d2
    n2*U1+d2
    n2*U2+d2

    determinant = (dot N1 N1)*(dot n2 n2)-(dot n1 n2)^2

    "possibly an arbitrary point on the line"
    c1 = (d1*(dot n2 n2)-d2*(dot n1 n2))/determinant
    c2 = (d2*(dot n1 n1)-d1*(dot n1 n2))/determinant
    when you have eliminated the impossible, whatever remains, however improbable, must be the truth
    A.C Doyle
    Reply With Quote  
     

  7. #6  
    Forum Ph.D.
    Join Date
    Dec 2006
    Location
    Norway
    Posts
    927
    finally found something that worked!

    normal a = [1,1,4]
    normal b = [3,1,1]

    determinant = cross a b = [-3,11,-2]

    t=1

    x= -3.*t
    y = 11.*t+4./3.
    z = (-2.*t)+5./3.
    when you have eliminated the impossible, whatever remains, however improbable, must be the truth
    A.C Doyle
    Reply With Quote  
     

  8. #7  
    Forum Ph.D.
    Join Date
    Dec 2006
    Location
    Norway
    Posts
    927
    hum, no still stuck :x

    normal1 = [1,1,4]
    normal2 = [3,1,1]

    "direction of the intersecting line"
    determinant = cross normal1 normal2

    t=1
    "point on the intersecting line"
    x= -3.*t
    y = 11.*t+4./3.
    z = (-2.*t)+5./3.

    need to figure out how he got 4/3 and 5/3
    when you have eliminated the impossible, whatever remains, however improbable, must be the truth
    A.C Doyle
    Reply With Quote  
     

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