[metapost] Constructing ellipse from 4 points

Laurence Finston lfinsto1 at gwdg.de
Wed Nov 2 22:37:26 CET 2005


On Wed, 2 Nov 2005, Brooks Moses wrote:

> > >    http://steiner.math.nthu.edu.tw/ne01/whw/Ellipse1/part2.htm

This page has a little movie that demonstrates the ruler-and-compass
construction, but there's no explanation.  The library system here
doesn't list the reference, T.H. Eagle, _Constructive Geometry For
Plane Curves_, but I've ordered a couple of other books in the field.

> > >    http://mathworld.wolfram.com/ConicSection.html
> > >    http://mathworld.wolfram.com/Ellipse.html

There's a lot of information on these pages, but no constructions
are given, unless I missed them.

> >I can get more points by finding the intersections of the plane with more
> >of the ellipses on the ellipsoid, and I can get as many of those as I
> >want.
>
> Ah, indeed.  Now I'm wondering if the best option might not be to do that
> in a general way,

I've attached a PostScript file with an illustration of an ellipsoid
and a square, with red dots where a selection of ellipses intersects
the plane of the square.  I've also attached the 3DLDF code.

> then take the derivative of the distance between the
> points,

Could you explain this?  I'm only familiar with derivatives of functions,
but I haven't taken a derivative since my college days.

> and thus find the maximum distance -- and thereby find the major
> axis of the ellipse, assuming the equations are tractable.

You mean algebraically, don't you?  I'm afraid I don't have a clue
of how to go about doing this.

I thought about looking for the maximum distance from a selection of
points, and then using binary search to find the maximum in the
neighborhood of my first approximation.  The problem is, I would have to
generate an ellipse and transform it at least once for every try.
I do something similar, but which doesn't require quite so much work,
to find the intersection points of two coplanar ellipses.  Someone
explained a better way to do this to me, but it involves mathematical
concepts that I (still) don't understand.  Given a choice, I'd almost
always rather solve problems like this algebraically.

Thanks again for your help.

Laurence

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ellpln01.ps.gz
Type: application/octet-stream
Size: 194691 bytes
Desc: 
Url : http://tug.org/pipermail/metapost/attachments/20051102/7cb9bfa1/ellpln01.ps-0001.obj
-------------- next part --------------
%%%% ellpln01.ldf
%%%% Created by Laurence D. Finston (LDF) Wed Nov  2 22:11:38 CET 2005

%% * (1) Copyright and License.

%%%% 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 
%%%% it under the terms of the GNU General Public License as published by 
%%%% 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




%% * (1) The intersection of an `ellipsoid' and a `plane'.
%%          The figure formed is an `ellipse'.
%%          LDF 2005.11.02.

verbatim_metapost "verbatimtex  \magnification=\magstep3 \font\large=cmr17 etex";

picture save_picture;

focus f;

set f with_position (-1, 5, -20) with_direction (-1, 5, 10) 
      with_distance 20;


ellipsoid e;
set e with_center (0, 0, 0) with_axis_x 15 with_axis_y 8 with_axis_z 10
      with_divisions_x 16 with_divisions_y 16 with_divisions_z 2
      with_point_count 64;


rotate e (0, 15, 0);
shift e (-1, -1, 3);

ellipse g;

rectangle r;
r := unit_rectangle scaled 15;

rotate r (0, 15, 45);
shift r by 1;

path_vector pv;

%% ***** (5) Figure 1.

beginfig(1); 

   draw r with_color blue;
   draw e;
   
   string s;

   pickup pencircle scaled (1.5mm, 1.5mm);

   bool_point_vector bpv;

   point pt;

   e_size := size e;

   for i = 0 upto e_size - 1:
   g := get_ellipse (i) e;
       bpv := g intersection_points r;
       	 for j = 0 upto size bpv - 1:
            pt := bpv[j];
            if pt is_on_ellipse g:
               drawdot bpv[j] with_color red;
            fi;
       	 endfor;
         clear bpv;
    endfor;

   save_picture := current_picture;
   output current_picture with_focus f no_sort;   

   clear current_picture;

   label("{\large Perspective}", (2, -15));

endfig with_projection parallel_x_y;

%% ***** (5) 

beginfig(2);
output save_picture with_projection parallel_x_y;  
label("{\large X-Y}", (0, -10));
endfig with_projection parallel_x_y;


%% ***** (5) 

beginfig(3);
output save_picture with_projection parallel_x_z;  
label("{\large X-Z}", (0, -10));
endfig with_projection parallel_x_y;

%% ***** (5) 

beginfig(4);
output save_picture with_projection parallel_z_y;  
label("{\large Z-Y}", (0, -10));
endfig with_projection parallel_x_y;

verbatim_metapost "end";

end;


More information about the metapost mailing list