Results 1 to 4 of 4

Thread: line segments intersect

  1. #1

    Thread Starter
    Hyperactive Member dogfish227's Avatar
    Join Date
    Oct 2002
    Location
    GA
    Posts
    409

    line segments intersect

    is this right equation to find wether 2 line segments intersect where
    ab and cd are the segments

    r=((ay-cy)(dx-cx)-)ax-cx)(dy-cy))/((ay-cy)(bx-ax)-(ax-cx)(by-ay))

    s=((ay-cy)(bx-ax)-(ax-cx)(by-ay))/((bx-ax)(dy-cy)-(by-ay)(dx-cx))

    and they intersect where r and s are >=0 and <=1

    thanxs

  2. #2

    Thread Starter
    Hyperactive Member dogfish227's Avatar
    Join Date
    Oct 2002
    Location
    GA
    Posts
    409
    also in both these equation if the denomator turns out to be 0 are the lines not intersecting??

  3. #3
    Fanatic Member sql_lall's Avatar
    Join Date
    Jul 2002
    Location
    Up Above (i.e. AUS)
    Posts
    571

    Talking Factorise??

    I'm not exactly sure what the a,b,c...etc are, but i factorised them and found:

    r=((ay-cy)(dx-cx)-(ax-cx)(dy-cy))/((ay-cy)(bx-ax)-(ax-cx)(by-ay))
    =(xy(a-c)(d-c)-xy(a-c)(d-c))/(xy(a-c)(b-a)-xy(a-c)(b-a))
    =((a-c)(d-c)-(a-c)(d-c))/((a-c)(b-a)-(a-c)(b-a))
    =((d-c)-(d-c))/((b-a)-(b-a))
    =0/0 = undefined.
    sql_lall

  4. #4
    Addicted Member
    Join Date
    Nov 2002
    Posts
    155
    I don't think he means terms like 'ay' to mean a*y; I think he means the y value of point a, ie ay.

    If I have a chance I'll check the equations and respond later. Mathworld gives a solution using matrices.

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