@c intersct.texi
    
@c This file is part of the 3DLDF User and Reference Manual.
@c Copyright (C) 2003, 2004 Laurence D. Finston 
@c See the section "GNU Free Documentation License" in the file 
@c fdl.texi for copying conditions.

@c $Id: intersct.texi,v 1.3 2004/01/12 18:39:16 lfinsto1 Exp lfinsto1 $
 
@node Intersections, Installing and Running 3DLDF, Pictures, Top
@chapter Intersections

@cindex intersection 
@cindex intersection points
@cindex Path intersections
@cindex output file 
@cindex arbitrary Path 
There are no functions for finding the intersection points of two (or
more) arbitrary @code{Paths}.  This is impossible, so long as 3DLDF
outputs MetaPost code.
3DLDF only ``knows'' about the @code{Points} on a
@code{Path};  it doesn't actually generate the curve or other figure
that passes through the @code{Points}, and consequently doesn't ``know''
how it does this.

@cindex arbitrary Path 
@cindex intersection 
@cindex intersection points
@cindex Path intersections
@cindex connectors 
@cindex Path connectors 
In addition, an arbitrary @code{Path} can contain connectors.
In 3DLDF, the connectors are
merely @code{strings} and are written verbatim to the output file,
however, in MetaPost they influence the form of a @code{Path}.
  
@cindex non-arbitrary Path 
@cindex intersection 
@cindex intersection points
@cindex Path intersections
3DLDF can, however, find the intersection points of some
@emph{non-arbitrary} @code{Paths}.  So far, it can find the intersection
point of the following combinations of @code{Paths}:

@findex Point::intersection_points
@enumerate 
@item 
Two linear @code{Paths}, i.e., @code{Paths} 
for which @code{Path::is_linear()} returns @code{true} 
(@pxref{Querying Paths,,Path Reference; Querying}). 
In addition, the @code{static Point} member function 
@code{Point::intersection_points()} can be called with four @code{Point}
arguments.  The first and second arguments are treated as the end points
of one line, and the third and fourth arguments as the end points of the
other.  

@item
A line and a @code{Polygon}.  Currently, @code{Reg_Polygon} and
@code{Rectangle} are the only classes derived from @code{Polygon}.

@item
Two @code{Polygons}.  

@item
A line and a Regular Closed Plane Curve (@code{Reg_Cl_Plane_Curve},
@pxref{Regular Closed Plane Curve Intersections, ,
Regular Closed Plane Curve Reference; Intersections}).  Currently,
@code{Ellipse} and @code{Circle} are the only classes derived from 
@code{Reg_Cl_Plane_Curve}. 

@item
Two @code{Ellipses}.  Since a @code{Circle} is also an @code{Ellipse},
one or both of the @code{Ellipses} may be a @code{Circle}.
@xref{Ellipse Intersections,,Ellipse Reference; Intersections}.
@end enumerate 

Adding more functions for finding the intersections of various geometric
figures is one of my main priorities with respect to extending 3DLDF.

There are currently no special
functions for finding the intersection points
of a line and a @code{Circle} or two @code{Circles}.  Since the
@code{class Circle} is derived from @code{class Ellipse}, 
@code{Circle::intersection_points()} resolves to
@code{Ellipse::intersection_points()}, which, in turn, calls
@code{Reg_Cl_Plane_Curve::intersection_points()}. 
This does the trick, but it's much easier to find the intersections for
@code{Circles} that it is for @code{Ellipses}.  In particular, the
intersections of two coplanar @code{Circles} can be found 
algebraically, whereas I've had to implement a numerical solution for
the case of two coplanar @code{Ellipses} with different centers and/or
axis orientation.  It may also be worthwhile to write
a specialization for 
finding the intersection points of a @code{Circle} and an
@code{Ellipse}. 


@cindex intersection theory 
@cindex theory of intersection 
@cindex future plans 
@cindex contributing to 3DLDF 
The theory of intersections is a fascinating and non-trivial branch of
mathematics.@c
@c
@footnote{The books on computer graphics and the fairly elementary
mathematics books that I own or have referred to don't go into
intersections very deeply.  One that does is 
Fischer, Gerd.  @cite{Ebene Algebraische Kurven}, which is a bit over my 
head.}   
@c
As I learn more about it, I plan to define more
@code{classes} to represent various curves (two-dimensional ones to
start with) and functions for finding their intersection points.

