## Maths question: proximity to centre of ellipse

Apr 24 2010 | 3:42 pm
I've done some forum and google searching, and found some info that I couldn't quite wrap my head around.
If I have an ellipse drawn into [lcd ], how do I go about calculating its centre point, and the mouse proximity to this point, and test for a mouse-over of just the ellipse, not including its "surrounding rectangle".
All the calculations I found made vague sense, but it's been such a long time since I had to do any that the solution is escaping me! Is this a situation where [cartopol ] might help?
Cheers, I know this isn't going to be remotely complex for many people :P

• Apr 24 2010 | 8:44 pm
The equation for a circle is x*x+y*y=1 y=√(1-x*x). In the case of an oval this becomes y=√(1-ax*ax). If you work on a mac, there's the beautiful application Grapher part of the utilities to get a visual representation. What you need to do is to find the solution of where the equation of your oval and a line through it's centre point and the mouse meet and to divided the distance of the one by the other. Does this help?
• Apr 24 2010 | 8:59 pm
I'm not 100% sure I'm following you, but I'll give it a go in a couple days when I have some more time.
I need to get myself an A-level maths book to jog my memory, then I'll be ok!
Thanks for the help and the tip about grapher, I'll check that out as well!
• Apr 27 2010 | 3:49 pm
Thanks for the replies.
Still not following the maths behind how this works....
@ pizza_olives, how do you calculate the values (175 and 125) that are in the [offset ] subpatch?
It's probably because I'm really mathematically dense, but I can't work out how those numbers relate to the co-ordinates used to draw the oval into lcd in the first place.
cheers
-Tim
• Apr 27 2010 | 5:08 pm
Ok, I've got that mostly working. There are a couple issues though, probably to do with how I've hooked it all up. I'll go back through your patch and check it.
Here is a patch to demonstrate the issues:
Thanks for the maths help!
• Apr 28 2010 | 10:22 am
Haha don't worry, my uni course only involves max/msp for learning about audio synthesis, not exploring the intriguing world of creating interfaces :( This is just something I've been messing with the past few days when I should have been doing my other work!
I had tried swapping long/large but without adding 2/pi to the angle, so it didn't help............I really do need to get back into maths........Your A
Thanks loads for clearing up how this works. It's going to be fun to play around with!