|
-
Dec 25th, 2000, 05:22 PM
#1
Thread Starter
New Member
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.
-
Dec 26th, 2000, 10:54 AM
#2
Frenzied Member
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...
-
Dec 26th, 2000, 10:57 AM
#3
Frenzied Member
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...
-
Dec 27th, 2000, 10:30 AM
#4
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
-
Dec 27th, 2000, 04:10 PM
#5
Thread Starter
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|