# [metapost] Re: Constructing ellipse from 4 points

Laurence Finston lfinsto1 at gwdg.de
Thu Nov 3 19:59:11 CET 2005

```Just in case anyone's interested, I've found a solution
to the problem of finding the ellipse determined by 6 (not 4)
non-colinear points.  It's called the "Braikenridge-Maclaurin
Construction" and is the converse of Pascal's Theorem.  I found it here:
http://www.maths.gla.ac.uk/~wws/cabripages/trace.html
and
http://www.maths.gla.ac.uk/~wws/cabripages/conpascal.html

It seems to require 6 to start with, but then you use the
other 5 to find as many more as you want.

I've attached an image and the 3DLDF code that generates it.
Since it's 2D, I could have done it with MetaPost, but converting
it should be straightforward, if anyone is so inclined.

The text on the first website states that the ellipse is traced by F when
the line XYZ is rotated about X.  I believe this to be an error.  At least,
I couldn't get it to work.  Instead, I shifted Z' along the line AE and
took Y' as the intersection point of XZ' and BE.

Since I can generate as many points as I want this way, I believe it
should be possible to find a pair of parallel secants, or a pair of
conjugate axes.  There are then easy ways to find the main axes,
center, and foci.  I think I will do this another day, though.

For the intersection of a plane with an ellipsoid,
I'll have to transform my points to a major plane and then transform the
ellipse using the inverse of the first transformation, but I do this often
anyway.  So, with a bit of luck, I should be be able to solve the problem
now.  Then I can start working on the intersection of a line with an
ellipsoid.

Laurence
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ellpcn01.ps.gz
Type: application/octet-stream
Size: 13953 bytes
Desc:
Url : http://tug.org/pipermail/metapost/attachments/20051103/2184e01a/ellpcn01.ps.obj
-------------- next part --------------
%%%% ellpcn01.ldf
%%%% Created by Laurence D. Finston (LDF) Thu Nov  3 19:41:14 CET 2005

%%%% This file is part of GNU 3DLDF, a package for three-dimensional drawing.
%%%% Copyright (C) 2003, 2004, 2005 The Free Software Foundation

%%%% GNU 3DLDF is free software; you can redistribute it and/or modify
%%%% the Free Software Foundation; either version 2 of the License, or
%%%% (at your option) any later version.

%%%% GNU 3DLDF is distributed in the hope that it will be useful,
%%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%%%% GNU General Public License for more details.

%%%% You should have received a copy of the GNU General Public License
%%%% along with GNU 3DLDF; if not, write to the Free Software
%%%% Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

%% Braikenridge-Maclaurin Construction.
%% Constructing an ellipse from 6 points.
%% LDF 2005.11.03.

verbatim_metapost "verbatimtex  \magnification=\magstep2 etex";

beginfig(1);

ellipse e;
e := unit_ellipse scaled (4, 0, 3);

pen path_pen;

path_pen := pencircle scaled (.7mm, .7mm);
pickup path_pen;

draw e;

point A, B, C, D, E, F;

A := get_point (15) e;
B := get_point (11) e;
C := get_point (8)  e;
D := get_point (6)  e;
E := get_point (3)  e;
F := get_point (0)  e;

pen dot_pen;
dot_pen := pencircle scaled (1mm, 1mm);

pickup dot_pen;

dotlabel.rt("A", A) with_dot_color red;
dotlabel.bot("B", B) with_dot_color red;
dotlabel.lft("C", C) with_dot_color red;
dotlabel.lft("D", D) with_dot_color red;
dotlabel.top("E", E) with_dot_color red;
dotlabel.rt("F", F) with_dot_color red;

pickup pencircle scaled (.7mm, .7mm);

%% **** (4) Point X

path q[];

q0 := A -- C;
q1 := B -- D;

pickup path_pen;

draw q0;
draw q1;

point X;
X := q0 intersection_point q1;

pickup dot_pen;

dotlabel.llft("\$X\$", X) with_dot_color red;

%% **** (4) Point Y

q2 := B -- E;
q3 := C -- F;

pickup path_pen;

draw q2;
draw q3;

point Y;
Y := q2 intersection_point q3;

pickup dot_pen;

dotlabel.ulft("\$Y\$", Y) with_dot_color red;

%% **** (4) Point Z

q4 := A -- E;
q5 := D -- F;

pickup path_pen;

draw q4;
draw q5;

point Z;
Z := q4 intersection_point q5;

pickup dot_pen;

dotlabel.urt("\$Z\$", Z) with_dot_color red;

%% **** (4)

point Z';
Z' := mediate(Z, E, .5);

dotlabel.urt("\$Z'\$", Z')  with_dot_color red;

point Y';

Y' := (B -- E) intersection_point (Z' -- X);

dotlabel.lrt("\$Y'\$", Y') with_dot_color red;

point G;
G := mediate(C, Y', 2);

dotlabel.rt("G", G);

draw C -- G with_pen path_pen dashed evenly;

point H;
H := mediate(D, Z', 2);

dotlabel.rt("\$H\$", H);

draw D -- H with_pen path_pen dashed evenly;

point J;
J := (C -- G) intersection_point (D -- H);

pickup dot_pen;

drawdot J with_color red;
label.urt("\$J\$", J shifted (0, 0, .25));

endfig with_projection parallel_x_z no_sort;

verbatim_metapost "end";

end;

```