- #1

- 43

- 1

I'm trying to write a C program to build an ellipse given 3 points and the focus equals to (0,0); can someone help me out?

Regards,

CPtolemy

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter cptolemy
- Start date

- #1

- 43

- 1

I'm trying to write a C program to build an ellipse given 3 points and the focus equals to (0,0); can someone help me out?

Regards,

CPtolemy

- #2

HallsofIvy

Science Advisor

Homework Helper

- 41,847

- 966

- #3

AlephZero

Science Advisor

Homework Helper

- 7,002

- 293

unknownfocus. Then the total distance (squared) from that focus to the point (x,y) to the known focus (x_{0}, y_{0}) is [itex](x- a)^2+ (y- b)^2+ (x-x_0)^2+ (y- y_0)^2[/itex]. Do that for the three given points as (x, y) and set them equal in pairs. That gives two equations for a and b.

I think the Halls's equations are more horrible than that, because "distance (squared)" should actually be "distance" so you get the sum of two square roots.

However you can solve this by "classical" geometry that translates into square-root-free equations.

Call the known focus F and the unknown one G, and the three points P Q and R.

Then from the properties of an ellipse,

The distances FP + PG = FQ + QG = FR + RG.

So

PG - QG = FQ - FP

Which says that G lies of a hyperbola with foci P and Q and a known eccentricity (fixed by the distances PQ and FQ-FP)

.

Similarly G lies on two other hyperbolas with equations

QG - RG = FR - FQ

and

RG - PG = FP - FR

You can set up the equations of these hyperbolas in the standard quadratic form and solve them for the position of G. It may be easier to use all three equations to take advantage of the symmetry, rather than work with just two of them.

Last edited:

- #4

- 4,254

- 1

- #5

AlephZero

Science Advisor

Homework Helper

- 7,002

- 293

That seems to be the case. If you write the general homogeneous quadratic equation

ax^2 + 2hxy + bc^2 + 2gx + 2fy + c = 0

You only have 5 independent parameters out of the 6 a,b,c,f,g,h, to determine ANY conic.

For this problem you have 3 unknown parameters, the x,y coordinates of the other focus, and the eccentricity.

On the other hand, you can always draw a circle through 3 points (if you count a straight line as a circle with infinite radius) but 3 points have 6 independent parameters not 5. So counting the number of independent variables is not as simple as it would be if all the equations were linear

I seem to remember a theorem that you can draw a conic through any set of 5 points. But 5 points is 10 independent parameters, not 5

(Clearly all the points must be coplanar for any of this to be interesting)

- #6

- 4,254

- 1

I share your confusion. Something very interesting is going on. There must be some way to determine the number of necessary and sufficient coordinates for each family of curves.

Here's one idea in my attempt to make sense of things. Take the simplest example, a straight line specified by 2 points or 4 coordinates, but where y=mx+b has only 2 constant parameters.

So instead, consider a straight line in N dimensions, parametric in λ.

x = aλ+p

y = bλ+q

z = cλ+r

...

The line can be described by two points each with N coordinates or 2N constant parameters, so in this case the (constant) parameter count is equal.

This is more than only a line in N space, but a curve with an origin at (p,q,r). (not to be confused with the coordinate origin) I'm curious as to whether this could make the difference in constant parameter count in the more general case. There may also be something interesting with afine transform of the variable λ, φ=αλ+β --or maybe not.

Here's one idea in my attempt to make sense of things. Take the simplest example, a straight line specified by 2 points or 4 coordinates, but where y=mx+b has only 2 constant parameters.

So instead, consider a straight line in N dimensions, parametric in λ.

x = aλ+p

y = bλ+q

z = cλ+r

...

The line can be described by two points each with N coordinates or 2N constant parameters, so in this case the (constant) parameter count is equal.

This is more than only a line in N space, but a curve with an origin at (p,q,r). (not to be confused with the coordinate origin) I'm curious as to whether this could make the difference in constant parameter count in the more general case. There may also be something interesting with afine transform of the variable λ, φ=αλ+β --or maybe not.

Last edited:

- #7

- 43

- 1

Hi,

Thanks to all. Problem solved.... :)

Kind regards,

CPtolemy

Thanks to all. Problem solved.... :)

Kind regards,

CPtolemy

- #8

AlephZero

Science Advisor

Homework Helper

- 7,002

- 293

Here's one idea in my attempt to make sense of things. Take the simplest example, a straight line specified by 2 points or 4 coordinates, but where y=mx+b has only 2 constant parameters.

So instead, consider a straight line in N dimensions, parametric in λ.

x = aλ+p

y = bλ+q

z = cλ+r

...

The line can be described by two points each with N coordinates or 2N constant parameters, so in this case the (constant) parameter count is equal.

This is more than only a line in N space, but a curve with an origin at (p,q,r). (not to be confused with the coordinate origin) I'm curious as to whether this could make the difference in constant parameter count in the more general case. There may also be something interesting with afine transform of the variable λ, φ=αλ+β --or maybe not.

I think one way to resolve this is to consider the curve as a set of points, not as an "equation". The set of points on straight line (in any number of dimenensions) can be described by 2 points, i.e. the set {P | there exists λ s.t. P = P_1 + λ P_2 }

Then, the fact that in R^n you can reduce this to a set of n-1 equations with apparently fewer independent parameters (e.g. y = mx + c in R^2) is because the definition of the set involves a linear function of λ.

Similarly you can define the set of points on any circle in R^n for any n using two points, which define a vector of length equal to the radius, from the center, normal to the plane of the circle. Proving that that you can draw a circle through any 3 non-collinear points is then an exercise in vector algebra. (I'm not sure if the fact that this definition only works in R^2 if you consider R^2 as a subspace of R^3 is "interesting", or not...)

One would hope there is a sub-branch of math where this stuff has been sorted out already.

- #9

HallsofIvy

Science Advisor

Homework Helper

- 41,847

- 966

You are right. I started by thinking that the total distances were equal and that therefore the distancesI think the Halls's equations are more horrible than that, because "distance (squared)" should actually be "distance" so you get the sum of two square roots.

Nice.However you can solve this by "classical" geometry that translates into square-root-free equations.

Call the known focus F and the unknown one G, and the three points P Q and R.

Then from the properties of an ellipse,

The distances FP + PG = FQ + QG = FR + RG.

So

PG - QG = FQ - FP

Which says that G lies of a hyperbola with foci P and Q and a known eccentricity (fixed by the distances PQ and FQ-FP)

.

Similarly G lies on two other hyperbolas with equations

QG - RG = FR - FQ

and

RG - PG = FP - FR

You can set up the equations of these hyperbolas in the standard quadratic form and solve them for the position of G. It may be easier to use all three equations to take advantage of the symmetry, rather than work with just two of them.

Share:

- Replies
- 2

- Views
- 10K