@c gssolfig.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: gssolfig.texi,v 1.5 2004/01/12 18:37:48 lfinsto1 Exp lfinsto1 $
 
@node Solid Figures, Pictures, Plane Figures, Top
@chapter Solid Figures

@menu
* Cuboid Getstart::             
* Polyhedron Getstart::         
@end menu

@node Cuboid Getstart, Polyhedron Getstart, Solid Figures, Solid Figures
@section Cuboids

@tindex Cuboid 
A @dfn{cuboid} is a solid figure consisting of six rectangular faces
that meet at right angles.  A cube is a special form of cuboid, whose
faces are all squares.  The constructor for the class @code{Cuboid}
follows the pattern familiar from the constructors for the plane
figures:  The first argument is the center of the @code{Cuboid},
followed by three @code{real} arguments for the height, width, and
depth, and then three more @code{real} arguments for the angles of
rotation about the x, y, and z-axes.  The @code{Cuboid} is first 
constructed with its center at the origin.  Its width, height, and depth
are measured along the x, y, and z-axes respectively.  If rotations are
specified, it is rotated about the x, y, z-axes in that order.  Finally,
it is shifted such that its center comes to lie on its @code{Point}
argument, if the latter is not the origin.

If the width, height, and depth arguments are equal, the @code{Cuboid}
is a cube:

@example
Cuboid c0(origin, 3, 3, 3, 0, 30);
c0.draw();
@end example

@iftex
@tex
\ifmakeexamples
\BEX
\BGRP
\immediate\write\examples{default_focus.set(2, 5, -10, 2, 5, 10, 10);}
\immediate\write\examples{Cuboid c0(origin, 3, 3, 3, 0, 30);}
\immediate\write\examples{c0.draw();}
\OEX{}
\EGRP
\EEX 1
\fi
\PEX
@end tex
@end iftex

@ifhtml
@html
<p align="center">
<br>
<img src="./graphics/png/3DLDFmp.37.png"
alt="[Figure 37. Not displayed.]"
/>
<br>
<br>
Fig. 37.
<br>
</p>
@end html
@end ifhtml

@ifinfo
[Figure 37 not displayed.]
@end ifinfo

In the following example, the @code{Cuboid} is ``filldrawn'', so that
the lines dilineating the hidden surfaces of the @code{Cuboid} are 
covered.

@example
Cuboid c1(origin, 3, 4, 5, 0, 30);
c1.filldraw();
@end example

@iftex
@tex
\ifmakeexamples
\BEX
\BGRP
\immediate\write\examples{Cuboid c1(origin, 3, 4, 5, 0, 30);} 
\immediate\write\examples{c1.filldraw();}
\OEX{}
\EGRP
\EEX 1
\fi
\PEX
@end tex
@end iftex

@ifhtml
@html
<p align="center">
<br>
<img src="./graphics/png/3DLDFmp.38.png"
alt="[Figure 38. Not displayed.]"
/>
<br>
<br>
Fig. 38.
<br>
</p>
@end html
@end ifhtml

@ifinfo
[Figure 38 not displayed.]
@end ifinfo

@node Polyhedron Getstart,  , Cuboid Getstart, Solid Figures
@section Polyhedron

@tindex Polyhedron 
The @code{class Polyhedron} is meant for use only as a base class;
no objects of type @code{Polyhedron} should be declared.  Instead, there 
is a class for each of the different drawable polyhedra.  Currently,
3DLDF defines only three: @code{Tetrahedron}, @code{Dodecahedron}, and
@code{Icosahedron}.  There's no need for a @code{Cube} class, because
cubes can be drawn using @code{Cuboid} (@pxref{Cuboid Getstart}). 

Polyhedra have a high priority in my plans for 3DLDF.  
I intend to add @code{Octahedron} soon, which will complete the set of regular
Platonic polyhedra.  Then I will begin adding the semi-regular
Archimedean polyhedra, and their duals.  

The constructors for the classes derived from @code{Polyhedron} follow
the pattern familiar from the classes already described.  The constructors
for the classes described below have identical arguments:  First, a
@code{Point} specifying the center, then a @code{real} for the 
diameter of the surrounding circle (@emph{Umkreis}, in German) of one of
its polygonal faces, followed by three
@code{real} arguments for the angles of rotation about the main axes.

@menu
* Tetrahedron Getstart::        
* Dodecahedron Getstart::       
* Icosahedron Getstart::        
@end menu
 
@node Tetrahedron Getstart, Dodecahedron Getstart, Polyhedron Getstart, Polyhedron Getstart
@subsection Tetrahedron

@tindex Tetrahedron 
The center of a tetrahedron is the intersection of the lines from a
vertex to the center of the opposite side.  At least, in 3DLDF, this is
the @code{center} of a @code{Tetrahedron}.  I'm not @DEG{100} certain
that this is mathematically correct.

@example
Tetrahedron t(origin, 4);
t.draw();
t.get_center().dotlabel("$c$"); 
@end example

@iftex
@tex
\ifmakeexamples
\BEX
\BGRP 
\immediate\write\examples{Tetrahedron t(origin, 4);}
\immediate\write\examples{t.draw();}
\immediate\write\examples{t.get_center().dotlabel("$c$"); }
\OEX{}
\EGRP
\EEX 1
\fi
\PEX
@end tex
@end iftex

@ifhtml
@html
<p align="center">
<br>
<img src="./graphics/png/3DLDFmp.39.png"
alt="[Figure 39. Not displayed.]"
/>
<br>
<br>
Fig. 39.
<br>
</p>
@end html
@end ifhtml

@ifinfo
[Figure 39 not displayed.]
@end ifinfo

@node Dodecahedron Getstart, Icosahedron Getstart, Tetrahedron Getstart, Polyhedron Getstart
@subsection Dodecahedron

@tindex Dodecahedron 
A dodecahedron has 12 similar regular pentagonal faces.
The following examples show the same @code{Dodecahedron} using different
projections: 

@example  
default_focus.set(2, 5, -10, 2, 5, 10, 10);
Dodecahedron d(origin, 3);
d.draw();
@end example

@iftex
@tex
\ifmakeexamples
\BEX
\BGRP
\immediate\write\examples{Dodecahedron d(origin, 3);}
\immediate\write\examples{d.draw();}
\immediate\write\examples{Point P(0, -2.5);}
\immediate\write\examples{P.label("Parallel projection, x-y plane", "bot");}
\OEX{PARALLEL_X_Y}
\EEX 1
\fi
\PEX
@end tex
@end iftex

@ifhtml
@html
<p align="center">
<br>
<img src="./graphics/png/3DLDFmp.40.png"
alt="[Figure 40. Not displayed.]"
/>
<br>
<br>
Fig. 40.
<br>
</p>
@end html
@end ifhtml

@ifinfo
[Figure 40 not displayed.]
@end ifinfo

@c *****************************

@iftex
@tex
\ifmakeexamples
\BEX
\immediate\write\examples{d.draw();} 
\immediate\write\examples{P.set(0, 0, -3);}
\immediate\write\examples{P.label("Parallel projection, x-z plane", "bot");}
\OEX{PARALLEL_X_Z}
\EEX 1
\fi
\PEX
@end tex
@end iftex

@ifhtml
@html
<p align="center">
<br>
<img src="./graphics/png/3DLDFmp.41.png"
alt="[Figure 41. Not displayed.]"
/>
<br>
<br>
Fig. 41.
<br>
</p>
@end html
@end ifhtml

@ifinfo
[Figure 41 not displayed.]
@end ifinfo

@c *****************************

Please note that the @code{Dodecahedron} in @NEXTFIG{} is drawn, and not
filldrawn!  

@iftex
@tex
\ifmakeexamples
\BEX
\immediate\write\examples{d.draw();} 
\immediate\write\examples{P.set(0, -2.5);}
\immediate\write\examples{P.label("Parallel projection, z-y plane", "bot");}
\OEX{PARALLEL_Z_Y}
\EEX 1
\fi
\PEX
@end tex
@end iftex

@ifhtml
@html
<p align="center">
<br>
<img src="./graphics/png/3DLDFmp.42.png"
alt="[Figure 42. Not displayed.]"
/>
<br>
<br>
Fig. 42.
<br>
</p>
@end html
@end ifhtml

@ifinfo
[Figure 42 not displayed.]
@end ifinfo

@c *****************************

@iftex
@tex
\ifmakeexamples
\BEX
\immediate\write\examples{d.draw();}
\immediate\write\examples{P.set(0, -3.5);} 
\immediate\write\examples{P.label("Perspective projection", "bot");}
\OEX{}
\EEX 1
\fi
\PEX
@end tex
@end iftex

@ifhtml
@html
<p align="center">
<br>
<img src="./graphics/png/3DLDFmp.43.png"
alt="[Figure 43. Not displayed.]"
/>
<br>
<br>
Fig. 43.
<br>
</p>
@end html
@end ifhtml

@ifinfo
[Figure 43 not displayed.]
@end ifinfo

@c **********************************

In @NEXTFIG{}, @code{d} is filldrawn.  In this case, 
the surface hiding algorithm has worked properly.
@xref{Surface Hiding}.

@iftex
@tex
\ifmakeexamples
\BEX
\immediate\write\examples{d.filldraw();} 
\immediate\write\examples{P.label("Perspective projection", "bot");}
\OEX{}
\EGRP
\EEX 1
\fi
\PEX
@end tex
@end iftex

@ifhtml
@html
<p align="center">
<br>
<img src="./graphics/png/3DLDFmp.44.png"
alt="[Figure 44. Not displayed.]"
/>
<br>
<br>
Fig. 44.
<br>
</p>
@end html
@end ifhtml

@ifinfo
[Figure 44 not displayed.]
@end ifinfo

@node Icosahedron Getstart,  , Dodecahedron Getstart, Polyhedron Getstart
@subsection Icosahedron

@tindex Icosahedron 
An icosahedron has 20 similar regular triangular faces.
The following examples show the same @code{Icosahedron} using different
projections: 

@example
default_focus.set(3, 0, -10, 2, 0, 10, 10); 
Icosahedron i(origin, 3);
i.draw(); 
@end example

@iftex
@tex
\ifmakeexamples
\BEX
\BGRP
\immediate\write\examples{Icosahedron i(origin, 3);}
\immediate\write\examples{i.draw(); }
\immediate\write\examples{Point P(0, -2.5);}
\immediate\write\examples{P.label("Parallel projection, x-y plane", "bot");}
\OEX{PARALLEL_X_Y}
\EEX 1
\fi
\PEX
@end tex
@end iftex

@ifhtml
@html
<p align="center">
<br>
<img src="./graphics/png/3DLDFmp.45.png"
alt="[Figure 45. Not displayed.]"
/>
<br>
<br>
Fig. 45.
<br>
</p>
@end html
@end ifhtml

@ifinfo
[Figure 45 not displayed.]
@end ifinfo

@c ***************

@iftex
@tex
\ifmakeexamples
\BEX
\immediate\write\examples{i.draw();}
\immediate\write\examples{P.set(0, 0, -3);}
\immediate\write\examples{P.label("Parallel projection, x-z plane", "bot");}
\OEX{PARALLEL_X_Z}
\EEX 1
\fi
\PEX
@end tex
@end iftex

@ifhtml
@html
<p align="center">
<br>
<img src="./graphics/png/3DLDFmp.46.png"
alt="[Figure 46. Not displayed.]"
/>
<br>
<br>
Fig. 46.
<br>
</p>
@end html
@end ifhtml

@ifinfo
[Figure 46 not displayed.]
@end ifinfo

@c ***************

@iftex
@tex
\ifmakeexamples
\BEX
\immediate\write\examples{i.draw();}
\immediate\write\examples{P.set(0, -2.5);}
\immediate\write\examples{P.label("Parallel projection, z-y plane", "bot");}
\OEX{PARALLEL_Z_Y}
\EEX 1
\fi
\PEX
@end tex
@end iftex

@ifhtml
@html
<p align="center">
<br>
<img src="./graphics/png/3DLDFmp.47.png"
alt="[Figure 47. Not displayed.]"
/>
<br>
<br>
Fig. 47.
<br>
</p>
@end html
@end ifhtml

@ifinfo
[Figure 47 not displayed.]
@end ifinfo

@c ***************

@iftex
@tex
\ifmakeexamples
\BEX
\immediate\write\examples{default_focus.set(3, 0, -10, 2, 0, 10, 10);} 
\immediate\write\examples{i.draw();}
\immediate\write\examples{P.set(0, -3.5);}
\immediate\write\examples{P.label("Perspective projection---drawn", "bot");}
\OEX{}
\EEX 1
\fi
\PEX
@end tex
@end iftex

@ifhtml
@html
<p align="center">
<br>
<img src="./graphics/png/3DLDFmp.48.png"
alt="[Figure 48. Not displayed.]"
/>
<br>
<br>
Fig. 48.
<br>
</p>
@end html
@end ifhtml

@ifinfo
[Figure 48 not displayed.]
@end ifinfo

@c ***************

In @NEXTFIG{}, @code{i} is filldrawn.  In this case, 
the surface hiding algorithm has worked properly.
@xref{Surface Hiding}.

@iftex
@tex
\ifmakeexamples
\BEX
\immediate\write\examples{i.filldraw();}
\immediate\write\examples{P.label("Perspective projection---filldrawn", "bot");}
\OEX{}
\EGRP
\EEX 1
\fi
\PEX  
@end tex
@end iftex

@ifhtml
@html
<p align="center">
<br>
<img src="./graphics/png/3DLDFmp.49.png"
alt="[Figure 49. Not displayed.]"
/>
<br>
<br>
Fig. 49.
<br>
</p>
@end html
@end ifhtml

@ifinfo
[Figure 49 not displayed.]
@end ifinfo

