Hit testing
-
Hi How to find hit testing of Circle/ellipse using mathematical formulas(not using Regions)? thanks :)
-
Hi How to find hit testing of Circle/ellipse using mathematical formulas(not using Regions)? thanks :)
one way would be to store the centers and radius of circle(In case of ellipse it depends on the length of the major and minor chords) and when the mouse is clicked you can get the point of click and check if the coordinates are within the range of the circle or the ellipse. For ex: in case of a circle, if you have a circle with center at (100,100) and radius as 100 then if the user clicks on x,y then check if the new points are still in the space occupied by the circle. In other words you can check if x,y both lie between 0 and 200 There will be some refinements required though with this approach. EDIT: BTW circle is a special case for ellipse with the major and minor chords of the same length, called the radius in a circle.
I am a HUMAN. I have that keyword (??? too much) in my name........ ;-)_AnsHUMAN_b>
modified on Wednesday, September 15, 2010 2:54 AM
-
Hi How to find hit testing of Circle/ellipse using mathematical formulas(not using Regions)? thanks :)
The straight way is: use the curve equations for finding possible intersections. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]