
-----------------------------------
wOOhooo
Thu Feb 28, 2008 5:10 pm

Collision Detection : oval+rectagle
-----------------------------------
well i have a problem. Ive looked all over the fourms and have not found an rectangle, oval collision. Could some one just post the code for a rectangle, oval collision? :) thx in advance

-----------------------------------
Tony
Thu Feb 28, 2008 5:28 pm

RE:Collision Detection : oval+rectagle
-----------------------------------
try harder, we most definitely have both available in the tutorials section.

-----------------------------------
wOOhooo
Thu Feb 28, 2008 5:57 pm

RE:Collision Detection : oval+rectagle
-----------------------------------
-_- ive been searching for like and hour, and trying to figure it out.. i just cant find it

-----------------------------------
richcash
Thu Feb 28, 2008 6:00 pm

Re: Collision Detection : oval+rectagle
-----------------------------------
Do you mean intersection between an oval and a rectangle? Well, for horizontal/vertical ovals (the ones you can draw in Turing using Draw.Oval) and rectangles it's not too hard.

First, you have to check if one of the four corners of the rectangle are inside the oval. Then, you have to check if the highest or lowest point on the oval is inside the rectangle or if the furthest left or furthest right point on the oval is inside the rectangle. I call these the central points of the oval because they are the points on the oval which share the same x OR y coordinate as the center.

If you don't know how to check if a point is inside of a rectangle/oval(ellipse) then you should search for collision detection tutorials on this site. [url=http://compsci.ca/v3/viewtopic.php?t=13661&start=24]This tutorial contains a point vs ellipse section.

Post back if you can't figure out which points on the oval I am talking about or if you can't figure out how to find the 4 corners of your rectangle.

-----------------------------------
Tony
Thu Feb 28, 2008 6:44 pm

RE:Collision Detection : oval+rectagle
-----------------------------------
we have a [url=http://compsci.ca/v3/search.php]search page.

-----------------------------------
richcash
Thu Feb 28, 2008 7:07 pm

Re: Collision Detection : oval+rectagle
-----------------------------------
Well, if he is talking about oval vs. rectangle intersection, then there is no tutorial on these forums to my knowledge that specifically covers that. But I still don't know for sure if that's what he's talking about. If it is, I think the easiest way to do it would be the way I described above.

But I did miss one condition in my above post. You would also have to check if the center of the oval/ellipse is inside of the rectangle.
