@c cuboid.texi

@c This file is part of the 3DLDF User and Reference Manual.
@c Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The Free Software Foundation 
@c See the section "GNU Free Documentation License" in the file 
@c fdl.texi for copying conditions.

 
@node Cuboid Reference, Polyhedron Reference, Faced Solid Reference, Top
@chapter Cuboid Reference

@tindex Cuboid
Class @code{Cuboid} is defined in @file{cuboid.web}.
It is derived from @code{Solid_Faced} using public derivation.

@menu
* Cuboid Data Members::         
* Cuboid Constructors and Setting Functions::  
* Cuboid Operators::            
@end menu
 
@node Cuboid Data Members, Cuboid Constructors and Setting Functions, Cuboid Reference, Cuboid Reference
@section Data Members

@deftypevr {Protected variables}  real height
@deftypevrx {}  real width
@deftypevrx {}  real depth
The height, width, and depth of the @code{Cuboid}, respectively.

Please note, that ``@code{height}'', ``@code{width}'', and
``@code{depth}'' are conventional terms.  There are no restrictions on
the orientation of a @code{Cuboid}.  
@end deftypevr 

@node Cuboid Constructors and Setting Functions, Cuboid Operators, Cuboid Data Members, Cuboid Reference
@section Constructors and Setting Functions

@deftypefn {Default constructor} void Cuboid (@code{void})
Creates an empty @code{Cuboid}.
@end deftypefn 


@deftypefn {Copy constructor} void Cuboid ({const Cuboid&} @var{c})
Creates a new @code{Cuboid} and makes it a copy of @var{c}.
@end deftypefn 

@deftypefn {Constructor} void Cuboid ({const Point&} @var{c}, {const real} @var{h}, {const real} @var{w},  {const real} @var{d}, [{const real} @var{x} = 0, [{const real} @var{y} = 0, [{const real} @var{z} = 0]]])
Creates a @code{Cuboid} with @code{center} at the origin, with
@code{height} @equiv{} @var{h}, @code{width} @equiv{} @var{w}, and
@code{depth} @equiv{} @var{d}.  If @var{x}, @var{y}, or @var{z} is
non-zero, the @code{Cuboid} is rotated by the amounts indicated around
the corresponding main axes.  Finally, the
@code{Cuboid} is shifted such that @code{center} comes to lie at
@var{c}. 

@example
Point P(-3, -2, 12);
Cuboid c(P, 3, 5, 2.93, 35, 10, 60);
@end example

@iftex 
@tex
\ifmakeexamples
\BEX
\BGRP
\immediate\write\examples{default_focus.set(3, 3, -10, 3, 3, 10, 20);}
\immediate\write\examples{Point P(-3, -2, 12);}
\immediate\write\examples{P.dotlabel("$P$"); }
\immediate\write\examples{Cuboid c(P, 3, 5, 2.93, 35, 10, 60);}
\immediate\write\examples{c.draw();}
\immediate\write\examples{draw_axes(gray); }
\OEX{}
\EGRP
\EEX 1
\fi
\PEX  
@end tex
@end iftex

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

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

@end deftypefn 


@deftypefn {Template specializations} Cuboid* create_new<Cuboid> ({const Cuboid*} @var{c})
@c
@deftypefnx {} Cuboid* create_new<Cuboid> ({const Cuboid&} @var{c})
@c
Pseudo-constructors for dynamic allocation of @code{Cuboids}.
They create a @code{Cuboid} on the free store and allocate memory for it using 
@code{new(Cuboid)}.  They return a pointer to the new @code{Cuboid}.  

If @var{c} is a non-zero pointer or a reference,
the new @code{Cuboid} will be a copy of
@var{c}.  If the new object is not meant to be a
copy of an existing one, @samp{0} must be passed to
@code{create_new<Cuboid>()} as its argument.
@xref{Dynamic Allocation of Shapes}, for more information. 
@end deftypefn 

@deftypefn {Destructor} {void} {~Cuboid} (@code{void})
Deallocates the @code{Rectangles} pointed to by the pointers on
@code{rectangles} (a @code{Solid} data member), and calls
@code{rectangles.clear()}.  @code{Cuboids} consist entirely of
@code{Rectangles}, so nothing must be done to the other vectors.
@end deftypefn 

@node Cuboid Operators,  , Cuboid Constructors and Setting Functions, Cuboid Reference
@section Operators

@deftypefn {Assignment operator} void {operator=}  ({const Cuboid&} @var{c})
Makes the @code{Cuboid} a copy of @var{c}.  The old contents of @code{*this}
are deallocated (where necessary) and discarded. 
@end deftypefn 



