Results 1 to 5 of 5

Thread: Help needed: collisiondetection in 2d

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    14

    Question

    Okay, here's the deal:
    I have a threesided polygon, aka a triangle,
    vertices are defined as following

    For i = 0 To 2
    Line1(i).X1 = Sin((v + (120 * i)) / 57) * 200 + ox
    Line1(i).Y1 = Cos((v + (120 * i)) / 57) * -200 + oy
    Line1(i).X2 = Sin((v + (120 * (i + 1))) / 57) * 200 + ox
    Line1(i).Y2 = Cos((v + (120 * (i + 1))) / 57) * -200 + oy
    Next i

    Whereas ox and oy as offset variables
    as to where the triangles'centrum in
    the void is.

    Problem being: I need a routine
    (algorithm, whatever) to find out
    if the point p (p.x, p.y) is inside
    the triangle.

    Any help would be greatly appreciated.
    Well, it's a pentium parrot, besides, it's only a decimal.

  2. #2
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Sorry, can't help you.

    But I have a similar problem: for a 3d engine I'm making (not from a tutorial or something, I'm doing it ON MY OWN so I'm having lots of problems), I'd like to have a fast way of detecting if a dot is inside a triangle or rectangle if possible... sort of I give the function the X, Y and Z coordinates of each point of the triangle, and the X, Y and Z coordinates of the point, and it would return True if it was inside it...

  3. #3
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    And could you please elaborate a bit more on that function, maybe give me a working example of what it does, because I don't know much on trigonometry...

  4. #4
    Guest
    My site shows how to detect if an object is within a box.
    The site is http://www.gamecreator.cjb.net. That site shows how to detect a box collision. Go into collision detection.
    Hope it helps :-)
    Dan

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    14
    Uhm.. what you're describing is boundingbox-detection, which is a bit to rough to use unless you divide the
    object into several parts.
    Well, it's a pentium parrot, besides, it's only a decimal.

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