My Math Forum Get coordinates of every point inside an ellipse and detect intersection of 2 ones.

 Geometry Geometry Math Forum

 August 27th, 2014, 09:25 PM #1 Newbie   Joined: Aug 2014 From: Baku, Azerbaijan. Posts: 5 Thanks: 1 Get coordinates of every point inside an ellipse and detect intersection of 2 ones. 1. Get coordinates of every point inside the ellipse. 2. Detect intersection of 2 ellipses. You can assign your own variables, the next is just an example: (x, y) = coordinates of the common system. (a1, b1) = width and height of the ellipse 1. r1 = radius of the ellipse 1. (a2, b2) = width and height of the ellipse 2. r2 = radius of the ellipse 2. Just write an algorithm i can apply to my program. Last edited by Ziya1995; August 27th, 2014 at 10:10 PM.
 August 28th, 2014, 02:45 AM #2 Senior Member   Joined: Apr 2014 From: Glasgow Posts: 2,161 Thanks: 734 Math Focus: Physics, mathematical modelling, numerical and computational solutions Have you made an attempt yourself yet? If so, can you post your first attempt? We are generally happy to help you, but we (usually) won't do your work for you. Thanks from topsquark
August 28th, 2014, 03:53 AM   #3
Math Team

Joined: May 2013
From: The Astral plane

Posts: 2,273
Thanks: 943

Math Focus: Wibbly wobbly timey-wimey stuff.
Quote:
 Originally Posted by Benit13 Have you made an attempt yourself yet? If so, can you post your first attempt? We are generally happy to help you, but we (usually) won't do your work for you.
Attempted solution? I haven't even got to the point of understanding what the question is in the first place??

C'mon Ziya1995...Clear this up!

-Dan

 August 28th, 2014, 09:27 AM #4 Newbie   Joined: Aug 2014 From: Baku, Azerbaijan. Posts: 5 Thanks: 1 I make it plain: What do we have? We have: 1. The common coordinate system. 2. First ellipse on some part of the system. 3. Second ellipse on some part of the system. 4. We have coordinates of ellipses and their width and height. What do we need for? We need for: 1. Points inside e.g. first ellipse. Yes, it makes up too much, but we need for a common formula. 2. Points of intersection of the ellipses (let's consider they intersect). Ellipses are not complete circles, they can be curved. I just need for a formula. Thank you. Thanks from topsquark
 August 28th, 2014, 09:59 AM #5 Math Team   Joined: Dec 2013 From: Colombia Posts: 7,685 Thanks: 2665 Math Focus: Mainly analysis and algebra Hint: the equation of an ellipse centred on $(p,q)$ with axes $a$ (horizontal) and $b$ (vertical) is: $$\frac{(x-p)^2}{a^2} + \frac{x-q)^2}{b^2} = 1$$ You should easily be able to find an equation for all the points on the ellipse from that. What happens when the elllipse isn't square to the axes? Thanks from topsquark
August 29th, 2014, 12:15 AM   #6
Newbie

Joined: Aug 2014
From: Baku, Azerbaijan.

Posts: 5
Thanks: 1

Quote:
 Originally Posted by v8archie Hint: the equation of an ellipse centred on $(p,q)$ with axes $a$ (horizontal) and $b$ (vertical) is: $$\frac{(x-p)^2}{a^2} + \frac{x-q)^2}{b^2} = 1$$ You should easily be able to find an equation for all the points on the ellipse from that. What happens when the ellipse isn't square to the axes?

How does it work and called? I placed a and b as width and height and found some number of x and what should it mean?
I guess i should place different numbers instead of x to find matching numbers and i can do it by programming.
Can you give examples of solving using this equation?
I wanna use it in my program to make a game.

What happens when the elllipse isn't square to the axes?
Second x is y, so they are not same ones, when it is not a square.

Now i am going to check out this formula by programming.

Last edited by Ziya1995; August 29th, 2014 at 12:40 AM.

 August 29th, 2014, 03:27 AM #7 Newbie   Joined: Aug 2014 From: Baku, Azerbaijan. Posts: 5 Thanks: 1 I applied the formula and it works, but it is right for a circle, not for a curved ellipse. How to alter it for an ellipse? Or what is a formula for an ellipse? There is the right formula at the next link, but i can't understand what do variables mean, if you can recognize them, i wanna know: http://math.stackexchange.com/questi...hin-an-ellipse Last edited by Ziya1995; August 29th, 2014 at 03:49 AM.
 August 29th, 2014, 04:03 AM #8 Math Team   Joined: Dec 2013 From: Colombia Posts: 7,685 Thanks: 2665 Math Focus: Mainly analysis and algebra If you pick different values for $a$ and $b$ you will get an ellipse. Only if $a=b$ (or if your axes are not to the same scale) will you get a circle.
 August 29th, 2014, 04:55 AM #9 Senior Member   Joined: Apr 2014 From: Glasgow Posts: 2,161 Thanks: 734 Math Focus: Physics, mathematical modelling, numerical and computational solutions My advice would be that if you're making a game and you want to calculate collision detection, you're better off using rectangles, even for things which are not rectangular. It is reasonably common for programmers to use rectangles even for collisions between circles. The algorithms for testing collisions of rectangles are fast and often integrated in existing libraries. You can also calculate the response of a collision as if the object were curved, so a user would never know you actually used a rectangle (unless you make your rectangle a silly size). I don't recommend using pixel matching algorithms if your sprite has an arbitrary shape because it is computationally expensive. Some libraries even supply different primitives with their own collision detection, so you could always, for example, try and find an existing algorithm for circles/ellipses. However, if you're dead set on the circle/ellipse route (because, for example, you're making some sort of packing game) there is a method of calculating whether a collision occurs or not, but it's quite complex; I tried something similar when I was looking at extra-solar planet detection with overlapping circles of different sizes. I'll see what I can come up with this weekend.
 August 29th, 2014, 05:04 AM #10 Newbie   Joined: Aug 2014 From: Baku, Azerbaijan. Posts: 5 Thanks: 1 Benit13, i don't need a rectangle collision, i need an ellipse collision drawn inside rectangle, otherwise i'd already did it, if i had such a ready ability in my program. So, i have a formula to detect a square ellipse collision, but i wanna use it for NOT a square ellipse collision. Can anyone give such a common formula? Last edited by Ziya1995; August 29th, 2014 at 05:06 AM.

 Tags coordinates, detect, ellipse, inside, intersection, point

 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post supremegrandruler Algebra 5 June 29th, 2012 06:50 PM Andromedus Algebra 18 February 3rd, 2012 12:03 PM 1101 Algebra 2 February 28th, 2011 11:27 AM ace11 Algebra 4 July 12th, 2009 09:29 PM tom-9000 Algebra 1 June 17th, 2009 01:40 PM

 Contact - Home - Forums - Cryptocurrency Forum - Top