\part{Outline of the AXFI Data Model}
\vspace{.5em}
\section{Types of Image Annotations}
\p{The most fundamental kinds of image annotations
are geometric primitives such as points, lines,
and polygons.  Many other forms of annotations
are possible, however, mostly supplemental
data which is associated with these primitives
or, in some cases, with the image as a whole.
In general, \AXFI{} classifies annotations into
the following groups:

\begin{description}
\item[Geometric Primitives]  These annotations
delineate spatial/geometric regions in zero, one,
or two dimensions (or potentially higher dimensions
when working in non-\TwoD{} contexts).  At a minimum,
\AXFI{} data should support points, lines,
polygons, polylines (considered a superkind of
polygons where a polygon is a closed polyline), circles,
and ellipses.  Additionally, \AXFI{} recognizes
generic \q{closed} and \q{open} \textit{curves}, which
are nonlinear one-dimensional regions (or boundaries
of two-dimensional regions) that are neither
elliptical or circular arcs.  Depending on
context, \AXFI{} can be extended to provide
more detailed subkinds of curves generated
by different sorts of mathematical equations,
along with notations for the formulae
(e.g., b-splines) that generate a particular
curve.\footnote{In formal statements,
this and other \sAXFI{} documentation will
use the term \q{kind,} as well as \q{superkind}
and \q{subkind,} to indicate groups of values/entities
identified via a classification.  Vocabulary
based on \q{kind} is preferred to \q{type} or
\q{class} because of the distinct meanings these
latter terms have in computational contexts
which are also discussed in reference to \sAXFI{}.}
More information about encoding
ellipse data as well as other sorts of
curves is outlined below (page~\lpageref{ph:curves}).

A variation on the polygon/polygon-line alternative
are polygon-lines demarcating spatial regions
whose boundaries extend to one or more sides/corners
of the image (e.g., a \q{quadrant} is defined
via one central point with line segments
parallel to and implicitly
extended to the edges).  These poly-lines
may not explicitly represent the overall image
boundary as part of their own boundary.
Conceptually, treating the image-border itself
as a different \textit{sort} of boundary than
those explicitly notated may be more accurate
than eliding these distinctions.  This
applies also to segment boundaries.  For instance,
the sand/ocean border in a beach scene represents
a physical discontinuity between two different
material substances, and so it records an
observable detail of the depicted scene.
On the other hand, the edge of the sand-region
at the bottom of the image is not a physical
boundary, but an artifact of the camera position;
we assume the beach itself extends further than
what the camera captures.  All told, then,
in addition to polygons (or curves or segment-boundaries)
being \textit{open} or \textit{closed}, \AXFI{}
recognizes a third form of closure dubbed
\q{incomplete,} meaning that a spatial region is
geometrically closed by the edge of the image but
that this closure has no observational or semantic
significance.  \lAXFI{} allows a notation that
a spatial region is \q{closed by fiat} when the closure
results from the intrusion of the global image boundary.
A polygonal line may be closed by fiat when it does
not explicitly include lines along the global boundary,
but forms a closed polygon when such lines are
included in practice; the result is called a
\textit{fiat polygon} (similarly an annotation
can be classified as a \textit{fiat curve} or
\textit{fiat segment}).

\item[Segments and Regions]  A \textit{segment} is
considered to be, canonically, an integral
subimage with a semantically precise
separation of \q{foreground} from \q{background.}
There may be vagueness or approximation
in how the segment is precisely individuated
from its surroundings, but these ambiguities
are considered to be practical limitations
due to limited computer power, limiting pixel
resolution, and so forth.  A \textit{region}
or \textit{region of interest} is similar to a
segment, but defined more loosely; regions
can have vague descriptors, and spatially
disconnected parts of an image could be treated
as parts of one same region.  In a photograph
of a flock of birds, for example, there may be
multiple segments, each outlining one single bird.
However, the flock as a whole may be outlined
by one \textit{region}, which could (without
being deemed approximative) include some of the
background sky.  A \textit{segment} can be seen
as subkind of \textit{region} with stricter
granular and topological requirements.

A \textit{partition} of an image is a segmentation
which exhaustively classifies every point into
one or another segment.  A \textit{selective}
segmentation, unlike a complete partition, only
isolates certain segments or regions of
interests.  \lAXFI{} adopts these terms
as parameters that can characterize
segmentation processes, and by extension the
resulting segments/regions.

\item[Locations]  In \AXFI{}, \textit{locations}
are considered to be designations of areas
within an image (of varying dimensions) which
are significant by virtue of their directional,
morphological, or topological relations to
the rest of the image, rather than by virtue
of their intrinsic shape.  Conceptually,
a \textit{location} is in many cases similar
to a \textit{point}, but \AXFI{} does not require
locations to be zero-dimensional.  A location
may be designated by a small disk, or even a
region/segment.  The distinguishing feature
of locations is that their spatial shape or extent
are not semantically significant; instead,
what is important about locations is their
position in the image and how this position
relates to surrounding image content.  For
instance, a location might be the point/position
where two roads intersect, or it could
be the leftmost point on the segment-boundary of
a car's fender or a bird's wings, or the
geometric center of a car's body or a bird's torso.

\lAXFI{} distinguishes location-annotations from
secondary annotations used to identify locations
(insofar as these may be visually distinct).  For
instance, a position may be modeled as a single
point, but visually conveyed by an arrow, or by
a circle hovering above the relevant point.

\item[Focal Points]  The concept of \textit{focal
points} integrates locations and geometric primitives
for certain analytic tasks.  In general, focal points
are important for positional rather than morphological
regions, similar to locations.  However, focal points
may function more like segments or geometric objects
when used as part of an analytic objective.  For
instance, points embodying the center of a car's body
or a bird's torso could be used to count the number
of birds or cars appearing in a photograph.
In this case the concept of \q{geometric center} has
no meaningful morphological properties, so it
is analogous to a location.  On the other hand, the
center may be treated as a proxy for, or a most
significant component of, a segment or region; in this
sense the point is \textit{part of} a segment.
This mereological aspect makes focal points
act conceptually more like geometric primitives than
like locations.  In short, the classification
\textit{focal point} is available for spatial
objects which behave somewhere between locations
and regions/points, and particularly when they
are used in some proxying or indicative relation
to other regions (e.g. for counting).

\item[Secondary Images]  In some contexts, such
as segmentation, image-transforms are used to
convey image-processing operations, in contrast
to geometric-style annotations that can be
defined via vertex coordinates.  A crisp
segment can be defined via a two-toned image
with the same dimensions as the annotated
image, but with only two logical colors
(colors are called \q{logical} insofar as the
relevant detail is how the colors compare to
one another, irregardless of the optical colors
used to render them\footnote{In \sQt{}, for instance,
the \textbf{QColorConstants::Color0} and
\textbf{QColorConstants::Color1} color values
are considered to be special \q{colors}
(i.e., \textbf{QColor} instances) which define
the foreground and background of a two-toned
image; they are not formally assigned to a
visual color, like black or white.}).
A \q{fuzzy} segment can likewise be defined
via a greyscale image (anything which
is pure-background becoming either pure white,
or pure transparent, depending on context).
Secondary images can be used to denote annotations
which are too granular to be summarized by
any mathematical expression.  In these cases,
the actual annotation data should identify the
secondary image (e.g., via a file path) and
explain how it relates to the primary
(or \q{ground}) image, whereas the secondary
file itself fills in the annotation details.

Secondary images may be derived from ground
images merely to present annotations, but they
may also be intermediate analysands which are
themselves annotated.  In the latter case,
annotations on secondary images are usually
meaningful also as annotations on ground
images, so the interrelations between both
images should be notated in the annotation data.

\item[Proscriptive Annotations]  \lAXFI{}
allows for the designation of certain annotations
as \q{proscriptive} when they do not
formally delineate a geometric object, but
indirectly express such an object's shape
or how it may be derived.  A canonical
example is the use of color --- perhaps
color-enhanced secondary images --- to
designate segments or regions of interest.
For instance, one common segmentation technique
uses color simplification; smoothing out color
patches can facilitate image partitioning
by reinforcing the boundaries between different
regions.  With sufficient color manipulation,
image-segments can potentially be described
chromatically: a region may for instance
be identified as \q{the area all of whose
pixels display a red channel above} some
threshold.  \lAXFI{} data should therefore
allow such indirect designations of
segments (and spatial/geometric regions in
general) to be encoded as annotations.

The concept of proscriptive annotations is not
only chromatic --- one can imagine other scenarios
where morphological features, such as symmetries,
may be employed to similar effect.  In describing
a chess board, for instance, a set of image-regions
(each square on the board) can be derived
via translational transforms of an initial
two-segment kernel (one black square and one white).
This representation is possible because of
translational symmetries in the underlying image.
Such geometric transforms and symmetries can
sometimes be used to \q{generate} meaningful
image segments, so they should be notated
in \AXFI{} data when appropriate.

\item[Semantic Labels]  Some annotations supply data
about other annotations (what \AIM{} calls
\q{Annotation on Annotation} as opposed to
\q{Annotation on Image}).  In general, we
can supply a label, description, or semantic
classification indicating what an image segment
or region is \q{about}, i.e., what it \q{depicts}
(a bird, a flock of birds, a car, a traffic
jam, and so forth).  Such meta-annotation may be
seen as a semantic postlude to an imaging
process, but it may also be seen as providing further
detail about the process itself.  For instance,
suppose segmentation isolates a bird from the
sky: the epilogue to this operation is an ability
(for a human user or a computer algorithm) to
classify the segment as \q{bird.}  However, we
can also say that the given fact of the segment
capturing the optics of a bird (with its apparent
anatomical outline and coloration) is what
allowed the segmentation to be possible in the
first place.  Therefore, the label \q{bird}
serves both to utilize the segmentation for
further analytic/classificatory purposes and
also, potentially, to characterize the
inner workings or effectiveness of
achieving the desired processing objective.
It should be kept in mind, in short, that
label annotations are not exclusively
intended to be used for practical labeling
in the contexts of tasks such as subject-marking
images in corpora; labeling could also
be used to notate how semantic properties
of the image make segmentation (and other
processing objectives) more or less
feasible, or computationally intensive/error-prone.

The semantics of labels themselves is outside
the scope of \AXFI{}.  \lAXFI{} makes no effort
to proscibe what sorts of terms are useful
as labels (\q{bird,} \q{car,} \q{ocean,}
\q{tumor,} etc.), or whether labels are
simple strings/words or have internal structure
of their own.  \lAXFI{} does, however,
make the following minimal stipulations about
labels.  First, \AXFI{} distinguishes
\q{mass,} \q{count,} and \q{plural} label
targets --- e.g., \textit{ocean}, \textit{one bird},
\textit{two birds}.  These distinctions are
directly relevant to how segments are bounded and
counted; for instance, labeling a body of water
as \textit{a lake} (e.g. on a satellite image where
the lake's full shore is visible) versus \textit{ocean}
(continuing to the horizon) implies different
desiderata for how the labeled region spatially extends
in relation to the surrounding image.  Secondly,
with respect to semantic labels, \AXFI{} recommends
that applications and libraries enable
labels to be typed values --- instances of
application-specific data types --- as well
as simple character strings (like \q{bird.})
This is consistent with \AXFI{}'s general
approach to application integration and
type systems, to be discussed further in
Part II.

In addition to labels being second-order annotations
--- assertions attached to an image segment,
for example, or any other image feature deemed
semantically relevant in some context --- labels
may be applied to the image as a whole.  In this
context labels would be an example of
\textit{metadata} annotations (discussed next),
which apply to the image itself
rather than any proper part.

%\item[Data Transformations]

\item[Image Metadata]   This category
of annotation concerns any information
\q{about} an image which is apart from
the specific image content.  Such details could encompass
computational/encoding details such
as color depth, pixel dimensions, and image
file format; or acquisition details
such as the make and settings of the camera
whose photograph yields the current image.
In theory, any information prerequisite to
displaying an image may potentially
be relevant to how annotations are
used and interpreted.  Therefore,
\AXFI{} should support representations of
image metadata where such information is needed
to fully specify annotation data; the metadata
would then, typically, be considered an
annotation on the entire image.  It is
outside the scope of \AXFI{} to present
image-related data which is applicable
to the sharing or rendering of images but
not, in a particular context, important to
annotations themselves --- unlike \DICOM{},
for instance, which is designed as a
standard for ensuring that images are correctly
rendered and therefore includes detailed
specifications of image formats and
prerequisites, \AXFI{} introduces
image metadata only where such information
can be considered intrinsic to the
specific objectives and operations of image
annotation.

\item[Acquisition Context]  Among the class of
annotations which apply to the image as a whole,
\AXFI{} recognizes a distinct kind of annotation
covering what \AIM{} calls the \q{context,}
or the purpose and concrete goal which compels
users to initiate image-processing operations.
In general, some of this contextual data
should be preserved as a supplement to
the overall information generated by image-processing
operations.  Often image processing itself is only
one stage in a multi-faceted scientific workflow,
and contextual information which exists prior to
the image-annotation step may still be important
for subsequent steps.  For example, clinical data
which motivates a radiographic study should remain
linked to images and annotations which result from
that study; this is why \DICOMSR{} includes
clinical as well as imaging data.
%More details about \AXFI{} context descriptions are provided
%below (section ?).
\end{description}

This outline covers the different kinds
of annotation data recognized by \AXFI{}.
The following section will fill in some
missing details by addressing other
sorts of information, apart from annotations
themselves, which might be included in an
\AXFI{} data package.}


\section{Sliding Game}
Our metric for algorithmic performance involves running A* on the sliding game (see the Youtube video for a demonstration). The sliding game is a particularly convenient search problem for two reasons: the state representation is small and the state space is very large. It blows up exponentially with respect to the puzzle dimensions. This is particularly important since our goal was to measure the effectiveness of a parallel A* algorithm, and the expansive state space would decrease potential overhead.
\newline\newline
\begin{tabular}{ |p{3cm}||p{3cm}|p{3cm}|p{3cm}|  }
\hline
\multicolumn{4}{|c|}{Sliding Game Sequential Execution times} \\
\hline
Board Size& Runtime (ns)&Runtime (ms)& Runtime (s)\\
\hline
2x3 & 35880 & 0 & 0\\
3x3 & 84711 & 0 & 0\\
3x4 & 258638033 & 259 & 0\\
4x4 & 171623957677 & 171624 & 172\\
\hline
\end{tabular}
\newline
\begin{figure}[h]
    \includegraphics[scale=0.5]{figures/4x4.png}
    \caption{The puzzle grid used for the 4x4 measure}
    \label{fig:gastar_ds}
\end{figure}
\newline
The object of the game is to order the tiles in increasing numerical order. The 0 tile represents an empty tile where adjacent tiles can "slide" to. Thus, every turn can result in 4 more possible states (exponential). The graph below is a visual representation of the above runtimes in log scale.

\begin{tikzpicture}[scale=0.91]
    \begin{axis}[
        xlabel=$area$,
        ylabel=$time(ns)$,
        ymode=log
                ]
    \addplot[mark=*,blue] plot coordinates {
        (6,35880)
        (9,84711)
        (12,258638033)
        (16,171623957677)
    };
    \addlegendentry{Runtime}

    \end{axis}
    \node[above,font=\large\bfseries] at (current bounding box.north) {Sequential Execution times (log scale)};
\end{tikzpicture}

\section{Evaluating Performance}
For this problem, we evaluated our implementations by checking the wall time of the implementations. We found this to be appropriate for the serial algorithm given that we were not able to properly evaluate speedup for the GA* GPU method.

\section{Scaling the Problem Space}
Considering our sequential performance in the graph above, we see that the line is roughly linear. This supports our hypothesis that as the number of cells grow, the runtime grows roughly exponentially. In particular, we see that because most nodes on the frontier have 3 or 4 neighbors, the number of states being added as we go further from the initial state increases exponentially. Due to the nature of the problem, a small change in workload could result in dramatically larger runtime.

\section{Limitations of our Approach}
The main source of issues with our CUDA implementation came from our hash map. Our implementation of the hash map involves a table and two hash functions where the second can search for new locations in the table for a node if another element collides with it per the first hash function. Although this simplification allows us to not need sychronization in this section, it means that we need a very large hash table. If the hash table is small compared to the number of states, it is possible that an element has collisions with both the hash functions. In this case, the hash map will \textit{lose information} that could potentially be important for the final path.\newline\newline
Another limitation of our approach was the amount of global memory that we allocate in this method. We use it for the large array \verb|S| as well as the hash table. If we scale up the hash table size in order to reduce the likelihood of collisions, we will increase the global memory allocated. In the GPU, global memory is far less efficient to update than shared memory. \textbf{As a result, the global memory brought upon by the hash table would likely be our main bottleneck in the CUDA implementation.}

\section{Changing the Hardware}
As we have discovered through this project, a GPU implementation of A* is not too pragmatic. In particular, the memory constraint of GPUs especially for search problems of this magnitude is quite restrictive. In contrast, using MPI would alleviate this. \textbf{MPI is not restricted by a single device and can be used across a network of devices, thus relaxing the space constraints}. Furthermore, MPI is a more task oriented system whereas CUDA is more data oriented, which is more suitable for search problems.


\section{$@4v2?%b%G%j%s%05!G=(J}

\subsection{$@4v2?%b%G%j%s%0$N4pK\5!G=(J}

$@K\@a$G=R$Y$k5!G=$KBP1~$9$k%=!<%9%U%!%$%k$O!"(J\ $geopack.l$\ $@$G$"$k!#(J

\subsubsection{$@4pK\=hM}4X?t(J}

\begin{description}
\item[vplus {\em vertices}]\hfill\\
vertices$@$O(J3$@<!85%U%m!<%H%Y%/%?$N%j%9%H!#A4(Jvertices$@$NOB$r5a$a$k!#(J
\item[vector-mean {\em vertices}]\hfill\\
3$@<!85%U%m!<%H%Y%/%?$N%j%9%H(Jvertices$@$N=E?4$r5a$a$k!#(J
\item[triangle {\em a b c \&optional (normal \#f(0 0 1))}]\hfill\\
a,b,c $@$O(J3$@<!85%U%m!<%H%Y%/%?$G$"$j!"(J3$@3Q7A$,7A@.$5$l$k!#(Jtriangle$@$O$3$N(J3$@3Q(J
$@7A$NLL@Q$N(J2$@G\$KEv$?$kNL$r5a$a$k!#(Jnormal$@$O!"$3$N(J3$@E@$,:\$C$F$$$kJ?LL$N@55,(J
$@2=$5$l$?K!@~%Y%/%H%k$rI=$9!#K!@~$N8~$-$K$7$?$,$C$F!"(Jtriangle$@$O@5!"$^$?$OIi(J
$@$NCM$H$J$k!#(Ja,b,c $@$,H?;~7W2s$j$KJB$s$G$$$k;~!"(Jtriangle$@$O@5$G$"$k!#(Ja,b,c $@$,(J
$@;~7W2s$j$KJB$s$G$$$l$PIi$G$"$k!#$^$?!"(Jtriangle$@$,@5$G$"$l$P!"(Jc $@$OD>@~(Jab$@$N:8(J
$@B&$K$"$j!"Ii$G$"$l$PD>@~(Jab$@$N1&B&$K$"$k$3$H$,$o$+$k!#(J
\item[triangle-normal {\em a b c}]\hfill\\
$@H?;~7W2s$j$KJB$s$@(J3$@E@(Ja,b,c $@$N:\$kJ?LL$N@55,2=$5$l$?K!@~%Y%/%?$r5a$a$k!#(J
\item[vector-angle {\em v1 v2 normal}]\hfill\\
2$@$D$NJ}8~%Y%/%?(Jv1,v2 $@$N$J$93QEY!J%i%8%"%s!K$r5a$a$k!#(Jv1, v2, normal$@$O$$$E$l(J
$@$bA00J$F@55,2=$5$l$F$$$kI,MW$,$"$k!#(J
\item[face-normal-vector {\em vertices \&optional rotatep}]\hfill\\
1$@J?LL>e$N(J3$@<!85%U%m!<%H%Y%/%?$N%j%9%H(Jvertices$@$+$i@55,2=$5$l$?K!@~%Y%/%?$r(J
$@5a$a$k!#(Jvertices$@$N:G=i$NMWAG$H:G8e$NMWAG$,F10l$NE@$rI=$9;~!"(Jrotatep $@$r(Jnil
$@$K$7$F8F$V!#(Jrotatep!=nil$@$G$"$l$P!"(Jvertices$@$N:G=i$NMWAG$r:G8e$K%"%Z%s%I$7$F(J
$@K!@~%Y%/%?$r7W;;$9$k!#(J
\item[farthest {\em p points}]\hfill\\
p $@$O%U%m!<%H%Y%/%?!"(Jpoints$@$O%U%m!<%H%Y%/%?$N%j%9%H$G$"$k!#(Jpoints$@$NCf$+$i!"(J
p $@$+$i:G$b1s$$E@$rC5$9!#(J
\item[farthest-pair {\em points}]\hfill\\
points$@$NCf$+$i!"8_$$$K:G$b3V$?$C$?E@BP$rC5$9!#(J
\item[maxindex {\em fv}]\hfill\\
3$@<!85%U%m!<%H%Y%/%?(Jfv$@$N(J3$@$D$NMWAG$N$&$A!"@dBPCM$N:G$bBg$-$$MWAG$N%$%s%G%C(J
$@%/%9(J(0,1,2) $@$r5a$a$k!#(J
\item[random-vector {\em \&optional (range 1.0)}]\hfill\\
3$@<!856u4V$N(Jrange $@$NHO0OFb$G0lMM$KJ,I[$7$?:BI8$r:n@.$9$k!#(J
\item[random-normalized-vector ()]\hfill\\
$@@55,2=$5$l$?%i%s%@%`%Y%/%?$r5a$a$k!#(J(note:$@6K:BI8$rMQ$$$F7W;;$9$Y$-$G$"$k!K(J
\item[random-vectors {\em n range}]\hfill\\
-range/2<x,y,z<range/2$@$N6u4V$K0lMM$KJ,I[$7$?(Jn$@8D$N%i%s%@%`%Y%/%?$r5a$a$k!#(J
\end{description}

\subsubsection{$@4v2?%b%G%k$N$?$a$N%/%i%9(J}

$@K\@a$G$O!"4v2?%b%G%j%s%0$H$=$l$K4p$E$/=hM}$r9T$J$&$?$a$N%/%i%9$K$D$$$F=R$Y$k!#(J
\\ [2.0cm]
{\jLarge surrounding-box}
\\ [0.5cm]

\begin{description}

\item[{\jlarge \bf description}]\hspace{1cm}
\begin{description}
\item[] $@M?$($i$l$?$9$Y$F$N#3<!85$NE@$,$=$NCf$K4^$^$l!"(J
$@%(%C%8$,(Jx,y,z $@<4$KJ?9T$G$"$k$h$&$J:G>.$ND>J}BN$N%/%i%9!#(J
$@43>D8!::$NA0=hM}Ey$KMQ$$$k!#(J
\end{description}

\item[{\jlarge \bf super class}]\hspace{1cm}
\begin{description}
\item[object] ()
\end{description}

\item[{\jlarge \bf slots}]\hspace{1cm}
\begin{description}
\item{minpoint}
\item{maxpoint}
\end{description}

\item[{\jlarge \bf methods}]\hspace{1cm}
\begin{description}
\item[:inner (point)] point $@$,$3$N(Jbox $@Fb$K4^$^$l$k;~(Jt,$@$=$&$G$J$$$H$-(Jnil $@!#(J
\item[:grow (rate)]
$@$?$H$($P(Jrate=0.01 $@$N$H$-!"(Jbox $@$r8=:_$NBg$-$5$+$i(J1\%$@$U$/$i$^$;$k!#(J
\item[:volume ()] $@$3$N(Jbox $@$NBN@Q!#(J
\item[:vectors (vlist)]
floatvector $@$N%j%9%H(Jvlist $@$+$i!"(Jbox $@$N(Jminpoint, maxpoint $@$r@_Dj$9$k!#(J
\item[:vectors2 (v1 v2)]
2$@$D$N(Jfloatvector,v1,v2 $@$+$i(Jminpoint,maxpoint $@$r@_Dj$9$k!#(J
\end{description}

\end{description}

\vfill
\pagebreak
{\jLarge line}
\\ [0.5cm]
\begin{description}

\item[{\jlarge \bf description}]\hspace{1cm}
\begin{description}
\item[] $@D>@~$N%/%i%9!#(J
\end{description}

\item[{\jlarge \bf super class}]\hspace{1cm}
\begin{description}
\item[object] ()
\end{description}

\item[{\jlarge \bf slots}]\hspace{1cm}
\begin{description}
\item[pvert] $@DL2a$9$kE@!#%5%V%/%i%9(Jedge$@$G$O!"%(%C%8$N;OE@!#(J
\item[nvert] $@DL2a$9$kE@!#%5%V%/%i%9(Jedeg$@$G$O!"%(%C%8$N=*E@!#(J
\end{description}

\item[{\jlarge \bf methods}]\hspace{1cm}
\begin{description}
\item[:vertices ()] pvert $@$H(Jnvert $@$N%j%9%H!#(J
\item[:point (parameter)] pvert $@$r(J0.0,nvert $@$r(J1.0 $@$KBP1~$5$;$?$H$-$N(J
$@%Q%i%a%?I=8=$+$i@~J,>e$NE@$N:BI8$r5a$a$k!#$9$J$o$A!"(J
$pvert=(x_{p},y_{p},z_{p})$, $nvert=(x_{n},y_{n},z_{n})$\ $@$H$7!"(J
$@$3$N(J2$@E@$rDL$kD>@~$r!"(J

\begin{equation}
\left(
\begin{array}{c}
x \\ y \\ z \\ 1
\end{array} \right)=\left(
\begin{array}{cc}
(1-t) & t
\end{array} \right) \left(
\begin{array}{cc}
x_{p} & x_{n} \\
y_{p} & y_{n} \\
z_{p} & z_{n} \\
1 & 1
\end{array} \right)
\end{equation}
$@$HI=$7$?$H$-!"(J\ $t$\ $@$rM?$($l$P:BI8(J\ $(x,y,z)$\ $@$rJV$9!#(J
\item[:parameter (point)] :point$@$N5U$GE@$N:BI8$+$i%Q%i%a%?$r5a$a$k!#(J
\item[:box ()]
\item[:boxtest (box)]
:box$@$O$3$N%(%C%8$,4^$^$l$k(Jsurrounding-box $@$r:n@.$9$k!#(J:boxtest$@$O$^$:<+J,(J
$@$N(Jsurrounding-box $@$r:n@.$7!"B>$N(Jbox $@$H$N43>D$r8!::$9$k!#(J
\item[:foot(point)]
$@E@(J\ $point=(x_{1},y_{1},z_{1})$\ $@$+$i$3$ND>@~$K2<$m$7$??b@~$NB-$N%Q%i%a!<%?(J
\ $t$\ $@$rJV$9!#$3$l$O!"(J
\begin{equation}
t=\frac{(x_{n}-x_{p})(x_{1}-x_{p})+(y_{n}-y_{p})(y_{1}-y_{p})
+(z_{n}-z_{p})(z_{1}-z_{p})}
{(x_{n}-x_{p})^{2}+(y_{n}-y_{p})^{2}+(z_{n}-z_{p})^{2}}
\end{equation}
$@$K$h$jM?$($i$l$k!#!J(JRef.$@LpLn7rB@O:Cx!"?^7A$H<0!"(Jp.178$@!"9VCL<R!K(J
\item[:distance(point)]
$@E@(Jpoint$@$+$i$3$ND>@~$^$G$N5wN%$rJV$9!#$3$l$O!"(Jpoint$@$+$i$3$ND>@~$K2<$m$7$?(J
$@?b@~$NB-$H(Jpoint$@$N5wN%$+$i5a$a$F$$$k!#(J
\item[:common-perpendicular(l)]
$@D>@~(J\ $l$\ $@$H$N6&DL?b@~$r5a$a$k!#JV$9CM$O!"(J2$@D>@~$H$N8rE@$N%j%9%H(J
$@$G$"$k!#(J2$@D>@~$,J?9T$N$H$-$O!"(Jparallel$@$rJV$9!#$3$l$O!"0J2<$NMM$K5a$a$F$$$k!#(J
2$@D>@~$,7PM3$9$k(J2$@E@$r$=$l$>$l(J\ $(x_{11},y_{11},z_{11})$\
$(x_{12},y_{12},z_{12})$, $(x_{21},y_{21},z_{21})$\ $(x_{22},y_{22},z_{22})$
\ $@$H$7!"$3$N(J2$@D>@~$N6&DL?b@~(J
$@$H$N8rE@$r(J\ $(x_{31},y_{31},z_{31})$\ $(x_{32},y_{32},z_{32})$\ $@$H$9$k$H!"(J
\begin{equation}
(x_{12}-x_{11}\ y_{12}-y_{11}\ z_{12}-z_{11})^{T}
(x_{32}-x_{31}\ y_{32}-y_{32}\ z_{32}-z_{31})=0 \label{eq:suityoku1}
\end{equation}
\begin{equation}
(x_{22}-x_{21}\ y_{22}-y_{21}\ z_{22}-z_{21})^{T}
(x_{32}-x_{31}\ y_{32}-y_{32}\ z_{32}-z_{31})=0 \label{eq:suityoku2}
\end{equation}
\begin{equation}
\left(
\begin{array}{c}
x_{31} \\ y_{31} \\ z_{31} \\ 1
\end{array} \right)=\left(
\begin{array}{cc}
(1-t_{1}) & t_{1}
\end{array} \right) \left(
\begin{array}{cc}
x_{11} & x_{12} \\
y_{11} & y_{12} \\
z_{11} & z_{12} \\
1 & 1
\end{array} \right)
\label{eq:online1}
\end{equation}
\begin{equation}
\left(
\begin{array}{c}
x_{32} \\ y_{32} \\ z_{32} \\ 1
\end{array} \right)=\left(
\begin{array}{cc}
(1-t_{2}) & t_{2}
\end{array} \right) \left(
\begin{array}{cc}
x_{21} & x_{22} \\
y_{21} & y_{22} \\
z_{21} & z_{22} \\
1 & 1
\end{array} \right)
\label{eq:online2}
\end{equation}
$@$,@.N)$9$k!#(J\ $X_{ij}=(x_{ij},y_{ij},z_{ij})^{T}$\ $@$H$*$-!"(J
(\ref{eq:suityoku1}),(\ref{eq:suityoku2})$@<0$K(J
(\ref{eq:online1}),(\ref{eq:online2})$@<0$rBeF~$9$k$H!"(J
\begin{displaymath}
(X_{12}-X_{11})^{T}(X_{12}-X_{11})t_{1}-(X_{12}-X_{11})^{T}(X_{22}-X_{21})t_{2}
=(X_{12}-X_{11})^{T}(X_{21}-X_{11})
\end{displaymath}
\begin{displaymath}
(X_{12}-X_{11})^{T}(X_{22}-X_{21})t_{1}-(X_{22}-X_{21})^{T}(X_{22}-X_{21})t_{2}
=(X_{22}-X_{21})^{T}(X_{21}-X_{11})
\end{displaymath}
$@$H$J$j!"$3$l$+$i(J\ $t_{1},t_{2}$\ $@$r5a$a!"$=$l$i$r(J(\ref{eq:online1}),
(\ref{eq:online2})$@$KBeF~$9$k$3$H$K$h$j!"6&DL?b@~$H$N(J2$@8rE@$,5a$^$k!#(J
$@!J(JRef.$@LpLn7rB@O:Cx!"?^7A$H<0!"(Jp.178$@!"9VCL<R!K(J
\item[:init (\&key :pvertex :nvertex)]
\end{description}

\end{description}
\vfill
\pagebreak
{\jLarge edge}
\\ [0.5cm]
\begin{description}

\item[{\jlarge \bf description}]\hspace{1cm}
\begin{description}
\item[] 2$@$D$ND:E@(Jpvert $@$+$i(Jnvert $@$K8~$+$&%(%C%8$N%/%i%9!#(Jwing$@>pJs$r4^$^$J$$!#(J
\end{description}

\item[{\jlarge \bf super class}]\hspace{1cm}
\begin{description}
\item[line] (pvert nvert)
\end{description}

\item[{\jlarge \bf slots}]\hspace{1cm}
\begin{description}
\item[pface] $@%(%C%8$N:8B&$NLL(J
\item[nface] $@%(%C%8$N1&B&$NLL(J
\item[(angle float)] pface $@$H(Jnface $@$,$J$93QEY(J
\end{description}
% picture= edge.tex
% \begin{figure}
\begin{minipage}[b]{16cm}
\begin{picture}( 391, 320)
\large\tt
\put( 203.4, 152.8){nface}
\put( 102.2, 152.8){pface}
\put( 152.8,  51.6){pvert}
\put( 152.8, 253.9){nvert}
\thicklines
\put( 168.6, 101.2){\line( 1,-1){  84.3}}
\put( 168.6, 101.2){\line(-1,-1){  84.3}}
\put( 168.6, 101.2){\vector( 0, 1){ 118.0}}
\put( 168.6, 219.2){\line( 1, 1){  84.3}}
\put(  84.3, 303.5){\line( 1,-1){  84.3}}
\end{picture}
\end{minipage}
% \end{figure}

\item[{\jlarge \bf methods}]\hspace{1cm}
\begin{description}
\item[:pvertex (f)]
\item[:nvertex (f)] f $@$O(Jpface $@$^$?$O(Jnface $@!#(Jf $@$K$H$C$F$N(Jpvert,nvert $@$r5a$a$k!#(J
\item[:pface ()] pface$@$rJV$9!#(J
\item[:nface ()] nface $@$rJV$9!#(J
\item[:binormal (f)]
f $@$O(Jpface $@$^$?$O(Jnface $@!#(Jf$@$NK!@~$H$3$N%(%C%8$NN>J}$KD>8r$9$k@55,2=$5$l$?J}8~%Y(J
$@%/%?$r7W;;$9$k!#(J
\item[:angle ()] angle
\item[:set-angle ()] $@LL4V$N3QEY!J(J2$@LL3Q!K$r7W;;$7$F(Jangle $@$KF~$l$k!#(J
\item[:invert ()] $@%(%C%8$NJ}8~$r5UE>$5$;$k!#$9$J$o$A!"(Jpface $@$H(Jnface $@$r(J
$@8r49$9$k!#(J
\item[:set-face (pv nv f)] pvert,nvert $@$KBP1~$9$k(Jpface $@$^$?$O(Jnface $@$r(J
$@%;%C%H$9$k!#(J
\item[:distance (point)] $@E@(Jpoint$@$H!"(Jedge$@>e$N:G6aE@$H$N5wN%$r5a$a$k!#(J
point$@$+$i$3$N(Jedge$@$K2<$m$7$??b@~$NB-$,$3$N(Jedge$@>e$K>h$k$H$-$O$=$NB-$H$N5wN%!"(J
$@$=$&$G$J$$$H$-$O!"6a$$J}$NC<E@$H$N5wN%$G$"$k!#(J
\item[:init (\&key :pface :nface :pvertex :nvertex)]
\end{description}

\end{description}

\vfill
\pagebreak
{\jLarge plane}
\\ [0.5cm]

\begin{description}

\item[{\jlarge \bf description}]\hspace{1cm}
\begin{description}
\item[] $@6-3&$N$J$$J?LL$N%/%i%9(J
\end{description}

\item[{\jlarge \bf super class}]\hspace{1cm}
\begin{description}
\item[object] ()
\end{description}

\item[{\jlarge \bf slots}]\hspace{1cm}
\begin{description}
\item[(normal :type floatvector)]
\item[(distance :type float) )]
\end{description}

\item[{\jlarge \bf methods}]\hspace{1cm}
\begin{description}
\item[:normal ()] normal
\item[:distance (point)] point$@$H$3$NJ?LL$N5wN%$r7W;;$9$k!#(J
\item[:intersection (pv nv)]
2$@E@(Jpv,nv $@$K$h$C$FI=8=$5$l$kD>@~$H$3$NJ?LL$H$N8rE@$r%Q%i%a!<%?$GJV$9!#(J
$@$9$J$o$A!"(J$pvert=(x_{p},y_{p},z_{p})$,\ $nvert=(x_{n},y_{n},z_{n})$\
$@$H$7!"$3$N(J2$@E@$rDL$kD>@~$r!"(J

\begin{equation}
\left(
\begin{array}{c}
x \\ y \\ z \\ 1
\end{array} \right)=\left(
\begin{array}{cc}
(1-t) & t
\end{array} \right) \left(
\begin{array}{cc}
x_{p} & x_{n} \\
y_{p} & y_{n} \\
z_{p} & z_{n} \\
1 & 1
\end{array} \right)
\end{equation}
$@$H$*$$$?$H$-!"J?LL(J

\begin{equation}
\left(
\begin{array}{cccc}
a & b & c & d
\end{array} \right) \left(
\begin{array}{c}
x \\ y \\ z \\ 1
\end{array} \right) = 0
\end{equation}
$@$H$N8rE@$K$*$1$k%Q%i%a!<%?(J\ $t$\ $@$NCM!"(J

\begin{equation}
t=\frac{ax_{p}+by_{p}+cz_{p}+d}{(ax_{p}+by_{p}+cz_{p})-(ax_{n}+by_{n}+cz_{n})}
\end{equation}
$@$rJV$9!#(J
\item[:foot (point)]
$@E@(J\ $point=(x_{1},y_{1},z_{1})$\ $@$+$iJ?LL(J\ $ax+by+cz+d=0$\ $@$K9_$m$7$??b@~$NB-(J
\ $(x_{0},y_{0},z_{0})$\ $@$r5a$a$k!#$3$l$O!"(J
\begin{equation}
\left(
\begin{array}{c}
x_{0} \\ y_{0} \\ z_{0}
\end{array}
\right) = \left(
\begin{array}{c}
x_{1} \\ y_{1} \\ z_{1}
\end{array}
\right) + t \left(
\begin{array}{c}
a \\ b \\ c
\end{array}
\right)
\end{equation}
$@$H$*$-!"$3$l$r(J\ $ax_{0}+by_{0}+cz_{0}+d=0$\ $@$KBeF~$7$F!"(J
\begin{equation}
t=-\frac{ax_{1}+by_{1}+cz_{1}+d}{a^{2}+b^{2}+c^{2}}
\end{equation}
$@$H%Q%i%a!<%?(J\ $t$\ $@$NCM$r5a$a$k$3$H$K$h$jF@$i$l$k!#(J
\item[:intersect-edge (edge)]
edge$@$H$N8rE@$N%Q%i%a!<%?$H:BI8$r%j%9%H$K$7$FJV$9!#(J

\item[:init (normal apoint)]
$@K!@~$,(Jnormal$@$G!"E@(Japoint$@$rDL$k$h$&$JJ?LL$rDj5A$9$k!#(J
\end{description}

\end{description}
\vfill
\pagebreak
{\jLarge closed-region}
\\ [0.5cm]
\begin{description}

\item[{\jlarge \bf description}]\hspace{1cm}
\begin{description}
\item[] $@%(%C%8$K$h$C$F0O$^$l$?J?LL$NNN0h$N%/%i%9(J
$@LL$O4pK\E*$KJ?LLJ}Dx<0$H%(%C%8$r0O$`%(%C%8!"D:E@$N%k!<%W$GI=8=$5$l$k!#(J
$@J?LLJ}Dx<0$O(Jplane $@$KJ];}$5$l!"(Jclosed-region $@$O%k!<%W$rJ];}$9$k!#(J
edges $@$H(Jvertices$@$OLL$rJ*BN$N30It$+$i(J
$@D/$a$?;~!"H?;~7W2s$j$KJB$V$h$&$J%j%9%H$G$"$k!#JL$N8@$$J}$G$O!"(Jedges,
vertices$@$N=g$K%k!<%W$rIA$/$h$&$K$M$8$r2s$9$H$M$8$,?J$`J}8~$,J*BN$N30It$9(J
$@$J$o$ALL$NK!@~J}8~$G$"$k!#$3$N%k!<%W$K$h$C$F%(%C%8!"D:E@$r$?$I$k$3$H$,$G$-$k(J
$@$N$G!"(Jedge$@$K$O%&%#%s%0>pJs$rJ];}$7$J$$!#(J
\end{description}

\item[{\jlarge \bf super class}]\hspace{1cm}
\begin{description}
\item[plane] ((normal :type floatvector) (distance :type float))
\end{description}

\item[{\jlarge \bf slots}]\hspace{1cm}
\begin{description}
\item[convexp] $@FLB?3Q7A$N$H$-(JT
\item[edges] $@LL$NFbIt$,%(%C%8$N:8B&$K$J$k$h$&$KJB$Y$?%(%C%8$N%j%9%H(J
\item[vertices] $@LL$NFbIt$,%(%C%8$N:8B&$K$J$k$h$&$KJB$Y$?D:E@$N%j%9%H!#(J
$v_{1},v_{2},\cdots,v_{n},v_{1})$\ $@$H:G8e$K@hF,$NMWAG$,:F$S8=$l$k$3$H$KCm0U!#(J
\item[(model-normal :type floatvector)]
\item[(model-distance :type float))]
\end{description}

\item[{\jlarge \bf methods}]\hspace{1cm}
\begin{description}
\item[:box ()] $@$3$NJDNN0h$r4^$`(Jsurrounding-box $@$r:n@.$9$k!#(J
\item[:boxtest (box)]
\item[:edges ()] edges
\item[:vertices ()] vertices
\item[:insidep (point)]
point $@$,$3$NJDNN0hFb$K$"$k$H$-(Jinside, $@30It$N;~(Joutside,$@6-3&>e$N;~(Jborder.
$@FLB?3Q7A$N$H$-!"E@$,$9$Y$F$N%(%C%8$N:8B&$K$"$k$+$I$&$+$rD4$Y$k!#FL$G$J$$(J
$@$H$-$OE@$,JU$r8+9~$`3QEY$NAmOB$r7W;;$7!"(J2$@&P$N$H$-FbIt!"(J0$@$N$H$-30It$HH=(J
$@Dj$7$F$$$k!#(J
\item[:intersect-point-vector (point vnorm)]
$@E@(Jpoint $@$+$i@55,2=%Y%/%?(Jvnorm $@$NJ}8~$K8~$+$&H>D>@~$H$N8r:9$r5a$a$k!#(J
$@H>D>@~$HJDNN0h$,J?9T$N$H$-$O!"7k2L$O(Jparallel$@$K$J$k!#(J
vnorm$@$NJ}8~$HJDNN0h$NK!@~%Y%/%?$NFb@Q$,@5!JIi!K$N$H$-$O!"(Jpoint$@$,JDNN0h(J
$@$+$i8+$FK!@~%Y%/%?$N8~$/B&!JH?BPB&!K$K$"$l$P!"H>D>@~$HJDNN0h$O8r$o$i$J$$(J
$@$N$G!"7k2L$O(Joutside$@$K$J$k!#5U$K!"H>D>@~$HJDNN0h$,8r$o$k$H$-$O!"$=$N8rE@$K(J
$@BP$7$F!"(J:insidep$@$N7k2L(J(inside, outside, border) $@$rJV$9!#(J
$@!J?^(J\ref{fig:intersect-point}\ $@;2>H!K(J
% picture = intersect-point.tex
\begin{figure}
\begin{minipage}[b]{16cm}
\begin{picture}( 388, 287)(20,0)
\Large\tt
\put(  17.0,  12.0){p= -(ax+by+cz+d)/dnm  $@J,;R$OE@$NJDNN0h$+$i$N5wN%!#(J
p$@$,@5$J$i8r$o$k!#(J}
\put(  14.5,  45.7){dnm= au+by+cw dnm$@$,@5$J$iH>D>@~$HJDNN0h$NK!@~%Y%/%?$O(J
$@F1$88~$-(J}
\put( 119.0, 113.1){ax+by+cz+d=0}
\put( 216.0, 198.3){(a,b,c)}
\put( 123.3, 232.0){(u,v,w)}
\put( 237.9, 253.1){(x,y,z)}
\thicklines
\put( 223.4, 255.5){\vector(-3,-2){  42.2}}
\put( 231.9, 263.9){\line(-1,-1){  16.9}}
\put( 215.0, 263.9){\line( 1,-1){  16.9}}
\put( 198.1, 145.9){\vector( 0, 1){  67.5}}
\put(  97.0, 112.1){\line( 5,-2){  84.3}}
\put( 265.6, 129.0){\line(-2, 3){  33.7}}
\put( 265.6, 129.0){\line(-5,-3){  84.3}}
\put( 147.6, 196.5){\line( 5,-1){  84.3}}
\put( 147.6, 145.9){\line(-3,-2){  50.6}}
\put( 147.6, 196.5){\line( 0,-1){  50.6}}
\end{picture}
\end{minipage}
\label{fig:intersect-point}
\end{figure}
\item[:intersect-line (p1 p2)]
$@@~J,(Jp1-p2 $@$H$N8r:9$r5a$a$k!#8r:9$,$J$$$H$-(Jnil,$@8r:9$9$k;~!"8rE@$N%Q%i%a%?(J
$@$H8rE@$N:BI8$N%j%9%H$rJV$9!#(J
\item[:intersect-edge (e)]
$@%(%C%8$H$N8rE@!#7k2L$O(J:intersect-line $@$HF1$8!#(J
\item[:intersect-face (fac)]
$@LL(Jfac $@$H$3$NLL$H$N8r:9!#(Jt $@$^$?$O(Jnil $@!#(J
\item[:transform-normal (trans)]
trans $@$O%/%i%9(Jcoordinates $@$N%$%s%9%?%s%9$G$"$j!":BI8JQ49$rI=$9!#K!@~%Y%/%?(J
$@$rJQ49$9$k!#(J
\item[:reset-normal ()]
vertices$@$+$i(Jnormal$@$*$h$S(Jdistance$@$r7W;;$9$k!#(J
\item[:invert ()] $@$3$NLL$NFb!"30$rH?E>$9$k!#(J
\item[:area ()] $@$3$NJDNN0h$NLL@Q$r7W;;$9$k!#(J
\item[:volume (point)] point$@$H$3$NJDNN0h$G:n$i$l$k?mBP$NBN@Q(J
\item[:centroid ()] $@$3$NJDNN0h$N=E?40LCV(J
\item[:perimeter] $@<~0OD9(J
\item[:init (\&key :vertices :edges :normal :distance)]
\end{description}

\end{description}
\vfill
\pagebreak
{\jLarge face}
\\ [0.5cm]
\begin{description}

\item[{\jlarge \bf description}]\hspace{1cm}
\begin{description}
\item[] $@B?LLBN$NLL$N%/%i%9!#(J
\end{description}

\item[{\jlarge \bf super class}]\hspace{1cm}
\begin{description}
\item[closed-region] (convexp edges vertices)
\end{description}

\item[{\jlarge \bf slots}]\hspace{1cm}
\begin{description}
\item[holes] $@LL$K6u$$$?7j!#(J
\item[pbody] $@$3$NLL$,:n@.$5$l$?(Jprimitive\ body$@$X$N%]%$%s%?!#(J
\item[type] $@LL$N%?%$%W(J
\end{description}

\item[{\jlarge \bf methods}]\hspace{1cm}
\begin{description}
\item[:all-edges]
\item[:all-vertices] $@$3$NLL>e$NA4$F$N%(%C%8!&D:E@!"A4$F$NFbIt%k!<%W$rJV$9!#(J
\item[:insidep {\em point}]
\item[:area] $@LL@Q$r5a$a$k!#(J
\item[:centroid {\em \&optional reference-point}] $@LL$N=E?4$r5a$a$k!#(J
$@7j$b9MN8$9$k!#(J
\item[:invert]
\item[:enter-hole {\em hole}] $@7j$rEPO?$9$k!#(J
\item[:init {\em \&key :normal :distance :edges :vertices :holes}]
\end{description}

\end{description}
\vfill
\pagebreak
{\jLarge hole}
\\ [0.5cm]
\begin{description}

\item[{\jlarge \bf description}]\hspace{1cm}
\begin{description}
\item[] $@7j$N%/%i%9!#(J
\end{description}

\item[{\jlarge \bf super class}]\hspace{1cm}
\begin{description}
\item[closed-region] (convexp edges vertices)
\end{description}

\item[{\jlarge \bf slots}]\hspace{1cm}
\begin{description}
\item[myface] $@7j$,B0$9$k(Jface$@%*%V%8%'%/%H(J
\end{description}

\item[{\jlarge \bf methods}]\hspace{1cm}
\begin{description}
\item[:face]
\item[:enter-face {\em face}]
\item[:init {\em \&key :normal :distance :edges :vertices :face}]
\end{description}

\end{description}
\vfill
\pagebreak
{\jLarge body}
\\ [0.5cm]
\begin{description}

\item[{\jlarge \bf description}]\hspace{1cm}
\begin{description}
\item[] $@B?LLBN$N%/%i%9!#(J
\end{description}

\item[{\jlarge \bf super class}]\hspace{1cm}
\begin{description}
\item[cascaded-coords] (parent descendants worldcoords manager)
\end{description}

\item[{\jlarge \bf slots}]\hspace{1cm}
\begin{description}
\item[faces] $@LL$N%j%9%H!#(J
\item[edges] $@%(%C%8$N%j%9%H!#(J
\item[vertices] $@D:E@$N%j%9%H!#(J
\item[model-vertices] $@D:E@$N%j%9%H!#(J:translate $@Ey$GF0$+$7$F$bITJQ!#(J
\item[box]
\item[convexp] $@FLB?3Q7A$N$H$-(JT
\item[evertedp]
\item[csg] body$@$N7A>u$,JQ99$5$l$?MzNr$r<($9(JCSG$@>pJs!#(J
\end{description}

\item[{\jlarge \bf methods}]\hspace{1cm}
\begin{description}
\item[:newcoords {\em rot pos}]
\item[:vertices]
\item[:faces]
\item[:edges]
\item[:box]
\item[:volume {\em \&optional (reference-point \#f(0 0 0))}] $@BN@Q7W;;(J
\item[:centroid {\em \&optional (reference-point \#f(0 0 0))}] $@=E?47W;;(J
\item[:possibly-interfering-faces {\em box}] $@43>D$7$F$$$k2DG=@-$N$"$kLL$r(J
box$@%F%9%H$GC5$9!#(J
\item[:common-box {\em body}]
$@<+J,<+?H$H(Jbody$@$H$N:G>.6&DLH"$rJV$9!#(J
\item[:insidep {\em point}]
\item[:intersect-face {\em face}]
\item[:intersectp {\em body}] $@<+J,<+?H$H(Jbody $@$H$N43>D%A%'%C%/$r$9$k!#(Jt$@$N$H$-(J
$@43>D$,$"$k!#(J
\item[:evert] body$@$NN"I=$rH?E>$5$;$k!#(J
\item[:init {\em \&key :faces :edges :vertices}] :init$@$K$h$C$F:n@.$5$l$?(J
body$@$O!"(J*bodies*$@%j%9%H$K(Jpush$@$5$l$k!#(J
\item[:translate-vertices {\em vector}]
$@:BI87O$H$OFHN)$K!"D:E@!J(Jmodel-vertices$@!K$N0LCV$r0\F0$9$k!#(J
\item[:rotate-vertices {\em radian axis}]
$@F1MM$K!"D:E@$N0LCV$r(Jaxis $@<4!J(J:x,:y or :z$@!K$^$o$j$K2sE>$9$k!#(J
\item[:magnify {\em scale}]
\item[:csg {\em \&optional newcsg}] csg$@>pJs$rJV$9!#(Jnewcsg$@$,$"$l$P!"(Jcsg$@$NCM(J
$@$r99?7$7$F!"?7$7$$CM$rJV$9!#(J
\end{description}

\end{description}

\clearpage
\subsection{$@AGN)BN$N:n@.(J}

\begin{description}
\item[make-plane {\em :normal :point :distance}]
\item[make-prism {\em bottom-vertices sweep \&key name color}]\hfill\\
$@ClBN$N@8@.!#ClBN$H$O!"(J\ $2\frac{1}{2}$\ $@J*BN$N$3$H!#(J
bottom-vertices $@$ODlLL$ND:E@(J\ $V_{1},V_{2},\cdots,V_{n}$\
$@$N%j%9%H!#(J\ $V_{1},V_{2},\cdots,V_{n}$\ $@$O!"$3$N=g$KDlLL$r30$+$i8+$F(J
$@H?;~7W2s$j$K2s$k!#(Jsweep $@$O!"A]0z%Y%/%?!JNc$($P!"(J\#f(0 0 50)$@!K$^$?$O(J
$@C1$KClBN$N9b$5!#:BI886E@$O!"%o!<%k%I$N(J\#f(0 0 0)$@!#(J

% picture = make-prism.tex
\begin{figure}[h]
\begin{picture}( 286, 236)
\thicklines
\put(  21.9, 158.5){\line( 0,-1){  84.3}}
\put(  21.9, 158.5){\line( 1, 1){  50.6}}
\put(  72.5, 209.1){\line( 5, 1){  84.3}}
\put( 156.8, 226.0){\line( 1,-1){  50.6}}
\put(  21.9, 158.5){\line( 4,-3){  67.5}}
\put(  89.4, 107.9){\line( 2, 3){  33.7}}
\put( 123.1, 158.5){\line( 5, 1){  84.3}}
\put(  89.4, 107.9){\line( 0,-1){  84.3}}
\put( 123.1, 158.5){\line( 0,-1){  84.3}}
\put( 207.4, 175.4){\line( 0,-1){  84.3}}
\thinlines
\put(  72.5, 209.1){\line( 0,-1){ 101.2}}
\put( 156.8, 226.0){\line( 0,-1){ 101.2}}
\put( 156.8, 124.8){\line(-5,-1){  84.3}}
\put(  72.5, 107.9){\line(-3,-2){  50.6}}
\put( 156.8, 124.8){\line( 3,-2){  50.6}}
\thicklines
\put(  21.9,  74.2){\line( 4,-3){  67.5}}
\put( 123.1,  74.2){\line(-2,-3){  33.7}}
\put( 207.4,  91.1){\line(-5,-1){  84.3}}
\large\tt
\put( 208.4,  75.2){V1}
\put( 124.1,  58.3){V2}
\put(  90.4,   7.7){V3}
\put(   6.1,  58.3){V4}
\put( 141.0, 108.9){Vm}
\put( 248.9, 127.5){sweep}
\put( 231.0,  92.7){\vector( 0, 1){  84.3}}
\put(  21.9, 158.5){\line( 0,-1){  84.3}}
\put(  21.9, 158.5){\line( 1, 1){  50.6}}
\put(  72.5, 209.1){\line( 5, 1){  84.3}}
\put( 156.8, 226.0){\line( 1,-1){  50.6}}
\put(  21.9, 158.5){\line( 4,-3){  67.5}}
\put(  89.4, 107.9){\line( 2, 3){  33.7}}
\put( 123.1, 158.5){\line( 5, 1){  84.3}}
\put(  89.4, 107.9){\line( 0,-1){  84.3}}
\put( 123.1, 158.5){\line( 0,-1){  84.3}}
\put( 207.4, 175.4){\line( 0,-1){  84.3}}
\thinlines
\put(  72.5, 209.1){\line( 0,-1){ 101.2}}
\put( 156.8, 226.0){\line( 0,-1){ 101.2}}
\put( 156.8, 124.8){\line(-5,-1){  84.3}}
\put(  72.5, 107.9){\line(-3,-2){  50.6}}
\put( 156.8, 124.8){\line( 3,-2){  50.6}}
\thicklines
\put(  21.9,  74.2){\line( 4,-3){  67.5}}
\put( 123.1,  74.2){\line(-2,-3){  33.7}}
\put( 207.4,  91.1){\line(-5,-1){  84.3}}
\put( 208.4,  75.2){V1}
\put( 124.1,  58.3){V2}
\put(  90.4,   7.7){V3}
\put(   6.1,  58.3){V4}
\put( 141.0, 108.9){Vm}
\put( 248.9, 127.5){sweep}
\put( 231.0,  92.7){\vector( 0, 1){  84.3}}
\end{picture}
\caption{make-prism}
\end{figure}
\item[make-cylinder {\em radius height \&key segments name color}]\hfill\\
$@1_Cl$N@8@.!#(Jradius $@$ODlLL$NH>7B!#(Jheight $@$O9b$5!#(Jsegment$@?t$N(Jdefault$@$O!"(J12$@!#(J
$@:BI886E@$O!"DlLL$NCf?4!#(J

% picture = make-cylinder.tex
\begin{figure}[h]
\begin{picture}( 388, 236)
\thicklines
\put( 185.5,  50.6){\vector(-1,-1){  16.9}}
\put( 185.5,  50.6){\vector( 0, 1){  16.9}}
\large\tt
\put( 321.4, 119.0){height}
\put( 303.5,  50.6){\vector( 0, 1){ 134.9}}
\put( 237.1,  17.9){radius}
\put( 185.5,  50.6){\vector( 1, 0){  33.7}}
\thinlines
\put( 134.9,  67.5){\line(-1,-1){  16.9}}
\thicklines
\put( 118.0, 168.6){\line( 0,-1){ 134.9}}
\thinlines
\put( 219.2,  84.3){\line(-1, 0){  50.6}}
\put( 168.6,  84.3){\line(-2,-1){  33.7}}
\put( 219.2, 219.2){\line( 0,-1){ 134.9}}
\thicklines
\put( 252.9, 185.5){\line( 0,-1){ 134.9}}
\put( 236.1,  33.7){\line( 0, 1){ 134.9}}
\put( 202.4,  16.9){\line( 0, 1){ 134.9}}
\put( 252.9,  50.6){\line(-1,-1){  16.9}}
\put( 202.4,  16.9){\line( 2, 1){  33.7}}
\put( 151.8,  16.9){\line( 1, 0){  50.6}}
\put( 118.0,  33.7){\line( 2,-1){  33.7}}
\thinlines
\put( 134.9, 202.4){\line( 0,-1){ 134.9}}
\thicklines
\put( 151.8,  16.9){\line( 0, 1){ 134.9}}
\thinlines
\put( 168.6, 219.2){\line( 0,-1){ 134.9}}
\thicklines
\put( 134.9, 202.4){\line(-1,-1){  16.9}}
\put( 168.6, 219.2){\line(-2,-1){  33.7}}
\put( 219.2, 219.2){\line(-1, 0){  50.6}}
\put( 252.9, 202.4){\line(-2, 1){  33.7}}
\put( 252.9, 185.5){\line( 0, 1){  16.9}}
\put( 252.9, 185.5){\line(-1,-1){  16.9}}
\put( 202.4, 151.8){\line( 2, 1){  33.7}}
\put( 202.4, 151.8){\line(-1, 0){  50.6}}
\put( 151.8, 151.8){\line(-2, 1){  33.7}}
\put( 118.0, 185.5){\line( 0,-1){  16.9}}
\thinlines
\put( 252.9,  67.5){\line(-2, 1){  33.7}}
\thicklines
\put( 185.5,  50.6){\line( 3,-1){  50.6}}
\end{picture}
\caption{make-cylinder}
\end{figure}
\item[make-cube {\em xsize ysize zsize \&key name color}]\hfill\\
$@D>J}BN$N@8@.!#(Jxsize,ysize,zsize $@$O$=$l$>$l(J3$@JU$ND9$5!#:BI886E@$O!"(J
$@=E?4$K0lCW!#(J
\begin{figure}[h]
\begin{picture}( 304, 152)
\large\tt
\put( 253.9, 102.2){zsize}
\put( 135.9,  17.9){ysize}
\put( 237.1,  51.6){xsize}
\put( 168.6,  84.3){\vector( 1, 0){  33.7}}
\put( 168.6,  84.3){\vector(-1,-1){  16.9}}
\put( 168.6,  84.3){\vector( 0, 1){  33.7}}
\put( 134.9,  67.5){\line( 1, 0){ 101.2}}
\put( 134.9,  67.5){\line(-1,-1){  33.7}}
\put( 134.9, 134.9){\line( 0,-1){  67.5}}
\thicklines
\put( 101.2,  33.7){\line( 1, 0){ 101.2}}
\put( 236.1,  67.5){\line(-1,-1){  33.7}}
\put( 236.1, 134.9){\line( 0,-1){  67.5}}
\put( 236.1, 134.9){\line(-1,-1){  33.7}}
\put( 202.4, 101.2){\line( 0,-1){  67.5}}
\put( 101.2, 101.2){\line( 1, 0){ 101.2}}
\put( 134.9, 134.9){\line( 1, 0){ 101.2}}
\put( 101.2, 101.2){\line( 1, 1){  33.7}}
\put( 101.2, 101.2){\line( 0,-1){  67.5}}
\end{picture}
\caption{make-cube}
\end{figure}
\item[make-cone {\em top bottom-vertices \&key name color}]\hfill\\
$@B?3Q?m$N@8@.!#(Jtop $@$O!"D:E@$N:BI8!#(Jbottom-vertices $@$O!"(Jmake-prism $@$N9`;2>H!#(J
\begin{figure}[h]
\begin{picture}( 320, 169)
\small\tt
\put( 186.5, 136.2){top}
\put( 237.1,  51.9){=bottom}
\put( 102.2,  51.9){V4}
\put( 135.9,  18.2){V3}
\put( 186.5,  18.2){V2}
\put( 220.2,  51.9){V1}
\put( 185.5,  67.5){\line( 1,-1){  16.9}}
\put( 151.8,  67.5){\line( 1, 0){  33.7}}
\put( 151.8,  67.5){\line(-1,-1){  16.9}}
\put( 168.6, 134.9){\line( 1,-4){  16.9}}
\put( 168.6, 134.9){\line(-1,-4){  16.9}}
\put( 151.8,  33.7){\line(-1, 1){  16.9}}
\put( 185.5,  33.7){\line(-1, 0){  33.7}}
\put( 202.4,  50.6){\line(-1,-1){  16.9}}
\put( 168.6, 134.9){\line( 2,-5){  33.7}}
\put( 168.6, 134.9){\line( 1,-6){  16.9}}
\put( 168.6, 134.9){\line(-1,-6){  16.9}}
\put( 134.9,  50.6){\line( 2, 5){  33.7}}
\end{picture}
\caption{make-cone}
\end{figure}
\clearpage
\item[make-solid-of-revolution {\em points \&key (segments 16) name key}]
\hfill\\
$@2sE>BN$N@8@.!#(J\ $points=(V_{1},V_{2},\cdots,V_{n})$\ $@$r@\B3$7$?@^@~$r(J
z $@<42s$j$K2sE>$7$?J*BN$r@8@.$9$k!#(Jpoints$@$N(Jy$@:BI8$O#0$K$7$F$*$/$3$H!#(J
% picture = make-revolution
\begin{figure}[h]
\begin{picture}( 219, 169)
\put(  67.5,  33.7){\line( 1, 0){  50.6}}
\small\tt
\put( 135.9,  35.1){V5}
\put( 152.8,  51.9){V4}
\put( 152.8,  85.7){V3}
\put( 135.9, 119.4){V2}
\put( 119.0, 136.2){V1}
\put(  67.5, 134.9){\line( 1, 0){  33.7}}
\thicklines
\put( 134.9,  50.6){\line(-1,-1){  16.9}}
\put( 134.9,  84.3){\line( 0,-1){  33.7}}
\put( 118.0, 101.2){\line( 1,-1){  16.9}}
\put( 118.0, 118.0){\line( 0,-1){  16.9}}
\put( 101.2, 134.9){\line( 1,-1){  16.9}}
\put(  16.9,  67.5){\vector( 1, 0){ 185.5}}
\put(  67.5,  16.9){\vector( 0, 1){ 134.9}}
\end{picture}
\caption{make-solid-of-revolution}
\end{figure}
\item[convex-hull-3d {\em vertices}]\hfill\\
$@D:E@Ns$+$iFLJq$r:n@.$9$k!#(J
\item[make-torus {\em points \&key (segments 16) name color}]
\item[make-icosahedron] {\em \&optional radius}]
\item[make-dodecahedraon {\em \&optional radius}]
\item[make-gdome]
\end{description}
\subsection{$@J*BN4V$N=89g1i;;(J}

$@=89g1i;;$K$O!"OB(J(union)$@!"@Q(J(intersection)$@!":9(J(difference)$@!"$*$h$S(J
$@J?LL$K$h$kJ,N%(J(cut)$@$,$"$k!#$3$l$i$r<B9T$9$k4X?t$O!"(J

\begin{description}
\item[cut-body {\em abody plane}] abody$@$r(Jplane$@$G@ZCG$7$?$H$-$N(J
$@@ZCGLL$r(Jface$@$H$7$F:n@.$7JV$9!#(J
\item[body+ {\em body1 \&rest more-bodies}]\hfill
\item[body* {\em body1 \&rest more-bodies}]\hfill
\item[body- {\em body1 \&rest more-bodies}]\hfill
\item[body/ {\em body cutting-plane}]\hfill
\end{description}
$@$G!"$$$E$l$b4X?t(J\ $compose-body$\ $@$r8F$S=P$9!#$3$l$i$N7W;;$N2aDx$G$O!"(J
$@85$NJ*BN$K$O2?$i$NJQ99$b2C$($J$$!#=>$C$F!"9g@.$,ESCf$G<:GT$7$?$H$7$F$b(J
$@85$NJ*BN$O2?$N1F6A$b<u$1$J$$!#$3$NJ}K!$r:N$C$?7k2L$H$7$F!"Hs>o$KJ#;($J(J
$@J*BN$HC1=c$JJ*BN$NOB$r$H$k$h$&$J>l9g$K$O!"A4BN$NJ#@=$,:n$jD>$5$l$k$3$H(J
$@$+$i=hM}$K;~4V$,$+$+$k!#(J

$@8=:_$N%P!<%8%g%s$G$O!"=89g1i;;$r;\$9(J2$@J*BN$N$$$E$l$+$NLL$I$&$7$,F10l(J
$@J?LL>e$K:\$C$F$$$k!"$"$k$$$O!"Hs>o$K6a$$MM$J>l9g$K$O!"=89g1i;;$,=PMh$J$$!#(J
\clearpage
\subsection{$@J*BN4V$N@\?($K$h$k94B+$NF3=P(J}

\subsubsection{$@%"%k%4%j%:%`$N35MW(J}
$@J*BN$,<+M36u4V$K$"$k$H$9$k$H!"$=$NJ*BN$K$OG$0U$NHy>.JQ0L$,2DG=$G$"$k$,!"(J
$@B>$NJ*BN$KBP$7$FNO$rH/@8$9$k$3$H$O=PMh$J$$!#(J
$@5U$K!"J*BN$,==J,=E$$J*BN$K8GDj$5$l$F$$$k>l9g$O!"$=$NJ*BN$OJQ0L$9$k$3$H$O(J
$@=PMh$J$$$,!"8GDj$7$F$$$kJ*BN$KBP$7$FG$0U$NNO$rH/@8$9$k$3$H$,2DG=$G$"$k!#(J
$@$3$NN>6KC<$N4V$N>uBV$H$7$F!"N>B&94B+$5$l$?J*BN$N>l9g$r9M$($k$H!"(J
$@94B+>r7o$OHy>.JQ0L$HNO$K4X$9$kF1<!J}Dx<0$K$J$j!"(J
$@$=$N2r$G$"$k5v$5$l$kHy>.JQ0L$N=89g$HH/@82DG=$JNO$N=89g$OD>8rJd6u4V$K$J$k!#(J
$@$^$?!"J*BN$,JRB&94B+$5$l$F$$$k>l9g$O!"J*BN$KBP$9$k94B+>r7o$OF1<!ITEy<0$K$J$j!"(J
$@5v$5$l$kHy>.JQ0L$HH/@82DG=$JNO$N=89g$OAPBPFLB?LL?m$K$J$k!#(J

$@K\@a$G$O!"$3$l$iJRB&94B+$dN>B&94B+$r6hJL$9$k$3$H$J$/!"(J
$@G$0U$N7A>u$NB?LLBN$,B>$NB?LLBN$KG$0U$N>uBV$G@\?($7$F$$$k>l9g$K!"(J
$@$=$NEy2A94B+E@$N0LCV$H!"3F!9$NE@$K$*$1$k94B+>r7o$r5a$a$k%W%m%0%i%`(J
$@$K$D$$$F@bL@$9$k!#(J
$@%H%C%W%l%Y%k$N$_;H$&IaDL$N%f!<%6!<$O!"(Jc-body$@$N@bL@$N$_FI$a$P==J,$G$"$k!#(J
$@$3$l$i$N%W%m%0%i%`$r;H$&$?$a$K$O!"(J
$eus/llib/model2const.l$\ $@$r%m!<%I$9$kI,MW$,$"$k!#(J
$@%W%m%0%i%`$NA4BN9=B$$r(JFig.\ref{fig:constraint-program}$@$K<($9!#(J

\begin{figure}[h]
\begin{center}
\epsfile{file=fig-program.ps,width=8cm}
\end{center}
\caption{Structure of the Algorithm}
\label{fig:constraint-program}
\end{figure}
\vfill
\clearpage
\subsubsection{$@%$%s%W%j%a%s%F!<%7%g%s(J}
\vspace{1.0cm}
{\jLarge c-body}
\\ [0.5cm]
\begin{description}

\item[{\jlarge \bf description}]\hspace{1cm}
\begin{description}
\item[] $@94B+>r7o$r3JG<$9$k%9%m%C%H$rDI2C$7$?(Jbody$@$N%5%V%/%i%9(J
\end{description}

\item[{\jlarge \bf super class}]\hspace{1cm}
\begin{description}
\item[body] ()
\end{description}

\item[{\jlarge \bf slots}]\hspace{1cm}
\begin{description}
\item[constraint] $@Ey2A94B+E@$H94B+>r7o(J
\end{description}

\item {\jlarge \bf methods}
\\ [0.5cm]
{\bf :constraint (b)} self$@$H(Jb$@$NEy2A94B+E@$H94B+%Y%/%H%k$r5a$a$k(J
\begin{enumerate}
\item {\bf if}\ self$@$HB?LLBN(Jb$@$N3F!9$N6K>.H"$,43>D$7$J$$(J\ {\bf then}
\begin{description}
\item self$@$OB?LLBN(Jb$@$H@\?($7$F$$$J$$(J
\item $@%"%k%4%j%:%`=*N;(J
\end{description}
\item {\bf if} b$@$+$i<u$1$k94B+$r4{$K5a$a$F$$$k(J {\bf then} return constraint
\item mycontact\ $\leftarrow$\ (send self {\bf :contact-vertices} b)\ $+$\
(send self {\bf :contact-edges} b)
\item hiscontact\ $\leftarrow$\ (send b {\bf :contact-vertices} self)\ $+$\
(send b {\bf :contact-edges} self)
\item constraint $\leftarrow$ constraint $+$
{\bf contact-to-constraint}\ (mycontact\ hisconstact)
\item return constraint
\end{enumerate}
{\bf :contact (b)} self$@$H(Jb$@$N@\?($NEy2A94B+E@$rJV$9!#(J
\begin{enumerate}
\item {\bf if} b$@$+$i<u$1$k94B+$r4{$K5a$a$F$$$k(J {\bf then}
return $@Ey2A94B+E@(J
\item constraint $\leftarrow$ constraint $+$ (send self {\bf :constraint} b)
\item return b$@$+$i<u$1$k94B+$NEy2A94B+E@$N0LCV$N%j%9%H(J
\end{enumerate}
{\bf :draw-constraint (\&optional b (arrow-length 30.0))}
b$@$+$i<u$1$k94B+>r7o$rLp0u$G2hLL$KI=<($9$k!#(J
b$@$r;XDj$7$J$$$H!"$3$l$^$G$K5a$a$?94B+$rA4$FI=<($9$k!#(J
$@Lp0u$ND9$5$r(Jarrow-length$@$G;XDj$9$k$3$H$b=PMh$k!#(J
\vfill
\clearpage
{\bf :contact-vertices (b)} b$@$K@\?($7$F$$$k(Jself$@$ND:E@!"(J
$@BP1~$9$k(Jb$@$N@\?(LL!"FL=89g$NOB=89g$GI=8=$7$?(Jself$@$N6aK5$r5a$a$k(J
\begin{enumerate}
\item cbox\ $\leftarrow$\ self$@$HB?LLBN(Jb$@$N3F!9$N6K>.H"$N6&DL=89g(J
\item {\bf if}\ cbox$@$,6u=89g(J\ {\bf then}
\begin{description}
\item self$@$OB?LLBN(Jb$@$H@\?($7$F$$$J$$(J
\item $@%"%k%4%j%:%`=*N;(J
\end{description}
\item myvertices\ $\leftarrow$\ cbox$@$K4^$^$l$k(Jself$@$ND:E@$N%j%9%H(J
\item hisfaces\ $\leftarrow$\ cbox$@$K4^$^$l$k(Jb$@$NLL$N%j%9%H(J
\item {\bf for\ each}\ v\ $\leftarrow$\ myvertices$@$NA4$F$NMWAG(J
\begin{description}
\item {\bf if}\ v$@$,!"(Jhisfaces$@$N$I$l$+$K@\?($7$F$$$k(J\ {\bf then}
conp\ $\leftarrow$\ conp\ $+$\ (self$@$N@\?(D:E@(Jv\ \ b$@$N@\?(LL$N0l$D(J)
\end{description}
\item {\bf for\ each}\ p\ $\leftarrow$\ conp$@$NA4$F$NMWAG(J
\begin{description}
\item p\ $\leftarrow$\ (self$@$N@\?(D:E@(J\ \ b$@$N@\?(LL$N0l$D(J
\ \ self$@$N@\?(D:E@$rC<E@$H$9$kNG$N%j%9%H(J)
\end{description}
\item {\bf for\ each}\ p\ $\leftarrow$\ conp$@$NA4$F$NMWAG(J
\begin{description}
\item (send p {\bf :to-convex})
\end{description}
\item return\ conp
\end{enumerate}
\begin{itemize}
\item $@%9%F%C%W#6$O!"(Jself$@$N@\?(D:E@$K!"$=$l$,:\$k(Jself$@$NNG$X$N%P%C%/%]%$%s%?(J
$@$rIU$1$F$$$k!#(J
\item $@%9%F%C%W#7$O!"(Jself$@$N6aK5$,FL$G$J$$>l9g$K!"$=$l$rFL=89g$NOB=89g$K(J
$@JQ49$7$F$$$k!#(J
\end{itemize}
{\bf :contact-edges (b)} b$@$K@\?($7$F$$$k(Jself$@$NNG$NFbE@!"(J
$@BP1~$9$k(Jb$@$N@\?(LL!"FL=89g$NOB=89g$GI=8=$7$?(Jself$@$N6aK5$r5a$a$k(J
\begin{enumerate}
\item cbox\ $\leftarrow$\ self$@$HB?LLBN(Jb$@$N3F!9$N6K>.H"$N6&DL=89g(J
\item {\bf if}\ cbox$@$,6u=89g(J\ {\bf then}
\begin{description}
\item self$@$OB?LLBN(Jb$@$H@\?($7$F$$$J$$(J
\item $@%"%k%4%j%:%`=*N;(J
\end{description}
\item myedges\ $\leftarrow$\ cbox$@$K4^$^$l$k(Jself$@$NNG$N%j%9%H(J
\item hisfaces\ $\leftarrow$\ cbox$@$K4^$^$l$k(Jb$@$NLL$N%j%9%H(J
\item {\bf for\ each}\  e\ $\leftarrow$\ myedges$@$NA4$F$NMWAG(J
\begin{description}
\item {\bf for\ each}\ f\ hisfaces$@$NA4$F$NMWAG(J
\begin{description}
\item {\bf if} e$@$,J?9T$G$J$$LL(Jf$@$N$I$l$+$NNG$H@\?($7$F$$$k!"$+$D!"(J
$@@\?(E@$,(Jconp$@$NMWAG$G$O$J$$(J\ {\bf then}
\begin{description}
\item {\bf if}\ e$@$N(J2$@LL3Q$NJ?LL3Q$,(J\ $\pi$\ $@$h$j>.$5$$(J\ {\bf then}
\begin{description}
\item conp\ $\leftarrow$\ conp\ $+$\
($@@\?($7$F$$$k(Jself$@$NNG>e$NE@(J\ \ b$@$N@\?(LL$N0l$D(J\ \ (($@@\?($7$F$$$k(Jself$@$NNG(J)))
\end{description}
\item {\bf else}
\begin{description}
\item conp\ $\leftarrow$\ conp\ $+$\
($@@\?($7$F$$$k(Jself$@$NNG>e$NE@(J\ \ b$@$N@\?(LL$N0l$D(J
\ \ (($@@\?($7$F$$$k(Jself$@$NNG$N(Jp$@LL(J)\ ($@@\?($7$F$$$k(Jself$@$NNG$N(Jn$@LL(J)))
\end{description}
\end{description}
\end{description}
\end{description}
\item return\ conp
\end{enumerate}

\end{description}
\vfill
\clearpage
{\Large surrounding-box}
\\ [0.5cm]
{\jlarge \bf methods}
\begin{description}
\item[{\bf :contact(box)}]
self$@$H(Jbox$@$,@\?($7$F$$$k$+$I$&$+$r%A%'%C%/$9$k!#@\?($7$F$$$k>l9g$O!"(J
$@N><T$N6&DLH"$r!"$7$F$$$J$$>l9g$O(Jnil$@$rJV$9!#(J
\begin{enumerate}
\item clearance\ $\leftarrow$\ $@Hy>.%Y%/%H%k(J
\item v1\ $\leftarrow$\ (max\ self$@$N:G>.E@(J\ box$@$N:G>.E@(J)\ $-\ clearance$
\item v2\ \ $\leftarrow$\ (min\ self$@$N:GBgE@(J\ box$@$N:G>.E@(J)\ $+\ clearance$
\item {\bf if}\ v1$@$,(Jv2$@$h$j>.$5$$(J\ {\bf then}
\begin{description}
\item return\ v1$@$r:G>.E@!"(Jv2$@$r:GBgE@$H$9$kH"(J
\item {\bf else}\ return\ nil
\end{description}
\end{enumerate}
\end{description}
\vfill
\clearpage
{\Large edge}
\\ [0.5cm]
{\jlarge \bf methods}
\\ [0.5cm]
{\bf :boxcontact(box)}self$@$,(Jbox$@$H@\?($7$F$$$k$+$I$&$+$r%A%'%C%/$9$k!#(J
$@@\?($7$F$$$k$H$-$ON><T$N6&DLH"$r!"$7$F$$$J$$$H$-$O(Jnil$@$rJV$9!#(J
\begin{enumerate}
\item return\ (send\ box\ {\bf :contact}\ self$@$r4^$`:G>.H"(J)
\end{enumerate}
{\bf :neighborpoints(point)}self$@$N6aK5$rI=$9<!$N#3E@$N%j%9%H$rJV$9!#(J
self$@>e$NE@$G(Jpoint$@$H$O0[$J$kE@!"(Jself$@$N(Jpface$@>e$NE@!"(Jself$@$N(Jnface$@>e$NE@!#(J
\begin{enumerate}
\item p1\ $\leftarrow$\ (send\ self\ {\bf :anothervertex}\ point)
\item p2\ \ $\leftarrow$\ $point\ +\ pface$$@$NK!@~%Y%/%H%k(J\ $\times\
(pvert\ -\ nvert)$
\item p3\ \ $\leftarrow$\ $point\ +\ nface$$@$NK!@~%Y%/%H%k(J\ $\times\
(nvert\ -\ pvert)$
\item return\ (p1\ p2\ p3)
\end{enumerate}
{\bf :contact(e)}self$@$NFbE@$HNG(Je$@$H$N@\?(E@$r5a$a$k!#(J
$@@\?($7$F$$$J$$>l9g$O!"(Jnil$@$rJV$9!#(J
\begin{enumerate}
\item {\bf if}\ self$@$H(Je$@$,3F!9:\$k#2D>@~$,J?9T(J\ {\bf then}\ return\ nil
\begin{description}
\item p1\ $\leftarrow$\ self$@$H(Je$@$,3F!9:\$k#2D>@~$N6&DL?b@~$N!"(Jself$@B&$NB-(J
\item p2\ $\leftarrow$\ self$@$H(Je$@$,3F!9:\$k#2D>@~$N6&DL?b@~$N!"(Je$@B&$NB-(J
\item {\bf if}\ p1$@$H(Jp2$@$N5wN%$,Hy>.CM$h$j>.$5$$!"(J
p1$@$,(Jself$@$NN>C<E@$h$jHy>.5wN%0J>eFbB&!"$+$D!"(J\\
p2$@$,(Je$@$NN>C<E@$h$jHy>.5wN%0J>e30B&$G$O$J$$(J
\ {\bf then}\ return\ p1
\end{description}
\end{enumerate}
\begin{itemize}
\item self$@$H(Je$@$,=E$J$k>l9g$O!"(Jself$@$OI,$:B>$NNG$H8r:9$9$k$N$G!"(J
$@@\?(E@$r=P$9I,MW$O$J$$!#(J
\item p1$@$H(Jself$@$NN>C<E@$N5wN%$,Hy>.5wN%0J2<$N>l9g$O!"(J
self$@$ND:E@$HNG(Je$@$N@\?($KAjEv$9$k$N$G!"@\?(E@$r=P$9I,MW$O$J$$!#(J
\item p2$@$,NG(Je$@$NHy>.5wN%L$K~30B&$N>l9g$r4^$a$J$$$H!"(J
$@?tCM7W;;8m:9$G@\?(E@$,5a$^$i$J$$$3$H$,$"$k!#(J
\end{itemize}
{\bf :anothervertex(point)}point$@$HF10lE@$G$O$J$$(Jself$@$rC<E@$rJV$9!#(J
\begin{enumerate}
\item {\bf if}\ pvert$@$H(Jpoint$@$N5wN%$,Hy>.5wN%$h$jBg$-$$(J\ {\bf then}\
\begin{description}
\item return\ pvert
\item {\bf else}\ nvert
\end{description}
\end{enumerate}
\vfill
\clearpage
{\Large plane}\\
\\ [0.5cm]
{\jlarge \bf methods}
\\ [0.5cm]
{\bf :separation(mypoints\ hispoints)}
$@LL(Jself$@$,(Jmypoints$@$H(Jhispoints$@$NJ,N%LL$K$J$k$+$I$&$+$r%A%'%C%/$9$k!#(J
$@J,N%LL$K$J$k>l9g$O!"(Jmypoints$@B&$K8~$/MM$KId9g$r9g$o$;$?!"(Jself$@$N(J
$@K!@~%Y%/%H%k$rJV$9!#J,N%LL$K$J$i$J$$>l9g$O!"(Jnil$@$rJV$9(J
\begin{enumerate}
\item {\bf if}\ mypoints$@$NA4$F$NE@$N(Jself$@$+$i$N5wN%$,F1Id9g(J\ {\bf then}
\begin{description}
\item sign\ $\leftarrow$\ $@5wN%$NId9g(J
\item {\bf if}\ hispoints$@$NA4$F$NE@$N(Jself$@$+$i$N5wN%$,F1Id9g(J\ {\bf then}
\begin{description}
\item return\ sign\ $\times$\ self$@$NK!@~%Y%/%H%k(J
\end{description}
\end{description}
\item return\ nil
\end{enumerate}
\vspace{2.0cm}
{\Large closed-region}\\
\\ [0.5cm]
{\jlarge \bf methods}
\\ [0.5cm]
{\bf :boxcontact(box)}self$@$,(Jbox$@$H@\?($7$F$$$k$+$I$&$+$r%A%'%C%/$9$k!#(J
$@@\?($7$F$$$k$H$-$ON><T$N6&DLH"$r!"$7$F$$$J$$$H$-$O(Jnil$@$rJV$9!#(J
\begin{enumerate}
\item return\ (send\ box\ {\bf :contact}\ self$@$r4^$`:G>.H"(J)
\end{enumerate}
{\bf :contactp(p)}$@E@(Jp$@$,(Jself$@$K@\?($7$F$$$k$+$I$&$+$r%A%'%C%/$9$k!#(J
$@@\?($7$F$$$k$H$-$O(Jinside$@!"6-3&>e$N$H$-$O(Jborder$@!"@\?($7$F$$$J$$$H$-$O(J
outside$@$rJV$9!#(J
\begin{enumerate}
\item d\ $\leftarrow$\ p$@$H(Jself$@$H$N5wN%(J
\item {\bf if}\ d$@$,Hy>.CM$h$jBg$-$$(J\ {\bf then}\ return\ outside
\item {\bf else}
\begin{description}
\item point\ $\leftarrow$\ p$@$+$i(Jself$@$X9_$m$7$??b@~$NB-(J
\item {\bf for each} e $\leftarrow$ self$@$N(Jedges
\begin{description}
\item {\bf if} (send e {\bf :distance} point)$@$,Hy>.CM$h$j>.$5$$(J
{\bf then} return border
\end{description}
\item return\ (send\ self\ {\bf :insidep}\ ip)
\end{description}
\end{enumerate}
\vfill
\clearpage
{\Large face}\\
\\ [0.5cm]
{\jlarge \bf methods}
\\ [0.5cm]
{\bf :contactp(p)}$@E@(Jp$@$,(Jself$@$K@\?($7$F$$$k$+$I$&$+$r%A%'%C%/$9$k!#(J
$@@\?($7$F$$$k$H$-$O(Jinside$@!"6-3&>e$N$H$-$O(Jborder$@!"@\?($7$F$$$J$$$H$-$O(J
outside$@$rJV$9!#(J
\begin{enumerate}
\item result $\leftarrow$ (send-super {\bf :contactp} p)
\item {\bf if} result$@$,(Jinside$@$G$O$J$$(J {\bf then} return result
\item {\bf for each} h $\leftarrow$ self$@$N(Jholes
\begin{description}
\item result $\leftarrow$ (send h {\bf :contactp} p)
\item {\bf if} result$@$,(Jinside {\bf then} return outside
\item {\bf if} result$@$,(Jborder {\bf then} return border
\item return inside
\end{description}
\end{enumerate}
{\bf :contact-edge(e1)}$@NG(Je1$@$H(Jself$@$,J?9T$G$J$$$H$-!"(J
e1$@$H(Jself$@$N$I$l$+$NNG$H$N@\?(E@$rJV$9(J
\begin{enumerate}
\item {\bf if}\ e1$@$H(Jself$@$,J?9T(J\ {\bf then}\ return\ nil
\item {\bf for\ each}\ e2\ $\leftarrow$\ self$@$N(Jedges
\begin{description}
\item foot\ $\leftarrow$\ (send\ e1\ {\bf :contact}\ e2)
\item {\bf if}\ foot$@$,(Jnil$@$G$J$$(J\ {\bf then}\ return\ foot
\end{description}
\end{enumerate}
\vfill
\clearpage
{\jLarge constrained-point}
\\ [0.5cm]
\begin{description}
\item[{\jlarge \bf description}]\hspace{1cm}
\begin{description}
\item[] $@Ho94B+E@$N%/%i%9(J
\end{description}

\item[{\jlarge \bf super class}]\hspace{1cm}
\begin{description}
\item[object] ()
\end{description}

\item[{\jlarge \bf slots}]\hspace{1cm}
\begin{description}
\item[myvertex] $@Ho94B+E@$N:BI8(J
\item[hisface] $@Ho94B+E@$K$*$1$k94B+J*BN$NLL$N0l$D(J
\item[myneighborhood] $@Ho94B+E@$K$*$1$k<+J,$N6aK5(J
\end{description}

\end{description}
{\jlarge \bf methods}\\
\begin{description}
\item[:to-convex\ ()] self$@$N6aK5$rFL6aK5$NOB$KJ,2r$9$k(J
\begin{enumerate}
\item count\ $\leftarrow$\ self$@$N6aK5$N(Jor-edge$@$N?t(J
\item {\bf if}\ count=0\ {\bf then}
\begin{description}
\item self$@$N6aK5(J\ $\leftarrow$\
(vertex\ hisface\ ((myedge11\ and\ myedge12\ $\cdots$)))
\end{description}
{\bf else}
\begin{description}
\item {\bf if}\ count=1\ {\bf then}
\begin{description}
\item (send\ self\ {\bf :divide1}\ or-edge)
\end{description}
\item {\bf else}
\begin{description}
\item (send\ self\ {\bf :dividen}\ or-edge)
\end{description}
\end{description}
\end{enumerate}
\item[:divide1\ (or-edge)] or-edge$@$,0l$D$@$1$"$k(Jself$@$N6aK5$r(Jor-edge$@$N(J
p-face$@$H(Jn-face$@$N3F!9$G@ZCG$7$?FL6aK5$r5a$a!"$=$l$i$N%j%9%H$G(J
{\bf myneighborhood}$@%9%m%C%H$r<!$N7A$KCV49$9$k!#(J\\
((myedge11\ and\ myedge12\ $\cdots$)\ or\ (myedge21\ and\ myedge22\ $\cdots$))
\\
\begin{enumerate}
\item {\bf for\ each}\ or-edge-face\ $\leftarrow$\ or-edge$@$N(Jp-face$@$H(Jn-face
\begin{description}
\item eset\ $\leftarrow$\ or-edge-face$@$N30$K=P$J$$!"6aK5$N(Jand-edge$@$N%j%9%H(J
\item flist\ $\leftarrow$\ or-edge-face$@$N30$K=P$J$$!"6aK5$N(Jface$@$N%j%9%H(J
\item {\bf if}\ flist$@$NMWAG?t$,(J2$@$h$jB?$$(J\ {\bf then}
\begin{description}
\item ip\ $\leftarrow$\ or-edge-face$@$K@ZCG$5$l$?LL$NNG$G!"(Jself$@$N(Jmyvertex$@$r(J
$@C<E@$K$7$J$$NG$H(Jor-edge-face$@$N8rE@(J
\item {\bf if}\ ip$@$HNY$N(Jand-edge$@$H$N5wN%$,>/$7$O$"$k(J\ {\bf then}
\begin{description}
\item self$@$N(Jmyvertex$@$H(Jip$@$rN>C<E@$H$9$kNG$r(Jeset$@$KDI2C$9$k(J
\end{description}
\end{description}
\item esets\ $\leftarrow$\ esets\ $+$\ eset
\end{description}
\item {\bf myneighborhood}\ $\leftarrow$\ esets
\end{enumerate}
\item[:dividen\ (or-edge)] or-edge$@$,(J2$@$D0J>e$"$k6aK5$rFL6aK5$KJ,3d$7!"(J
$@$=$l$i$N%j%9%H$G(J{\bf myneighborhood}$@%9%m%C%H$r<!$N7A$KCV49$9$k!#(J\\
((myedge11\ and myedge12$\cdots$)\ or\ (myedge21\ and\ myedge22$\cdots$)
\ $\cdots$\ (face1)\ or\ (face2)\ $\cdots$))\\

\begin{enumerate}
\item elist\ $\leftarrow$\ $@6aK5$rI=$9(Jedge$@$N%j%9%H$+$i%9%?!<%H(J
$@$N(Jor-edge$@$r=|$$$?%j%9%H(J
\item flist\ $\leftarrow$\ ($@%9%?!<%H$N(Jor-edge$@$N0lJ}$NLL(J)
\item {\bf while}\ elist$@$,6u%j%9%H$G$J$$(J\ {\bf do}
\begin{description}
\item ee\ $\leftarrow$\ flist$@$N@hF,MWAG$NLL$X$N%P%C%/%]%$%s%?$N$D$$$?NG(J
\item anotherface\ $\leftarrow$\ ee$@$NH?BPB&$NLL(J
\item {\bf if}\ ee$@$,(Jand-edge\ {\bf then}
\begin{description}
\item flist\ $\leftarrow$\ flist\ $+$\ anotherface
\item eset\ $\leftarrow$\ eset\ $+$\ ee
\end{description}
\item {\bf else}\ ;\ ee$@$,(Jor-edge$@$N>l9g(J
\begin{description}
\item {\bf if}\ eset$@$KNG$,4^$^$l$k(J\ {\bf then}
\begin{description}
\item {\bf if}\ flist$@$NMWAG?t$,(J2$@$h$jB?$$(J\ {\bf then}
\begin{description}
\item n-point\ $\leftarrow$\ flist$@$N@hF,$H:G8e$NMWAG$NLL$N8r@~>e(J
$@$K$"$j!"6aK5$N6-3&LL>e$K$"$kE@(J
\item eset\ $\leftarrow$\ eset\ $+$\ $@@\?(E@$H(Jn-point$@$rC<E@$H$7!"(Jflist$@$N(J
$@@hF,$H:G8e$NLL$K%P%C%/%]%$%s%?$r;}$C$?NG(J
\end{description}
\item esets\ $\leftarrow$\ esets + eset
\end{description}
\item {\bf else}
\begin{description}
\item esets\ $\leftarrow$\ esets\ $+$\ flist
\end{description}
\item eset\ $\leftarrow$\ $@6u%j%9%H(J
\item flist\ $\leftarrow$\ anotherface
\end{description}
\item elist\ $\leftarrow$\ elist\ $-$\ ee
\end{description}
\item {\bf if}\ eset$@$KNG$,4^$^$l$k(J\ {\bf then}
\begin{description}
\item esets\ $\leftarrow$\ esets\ $+$\ eset
\item {\bf else}
\begin{description}
\item esets\ $\leftarrow$\ esets\ $+$\ flist
\end{description}
\end{description}
\item {\bf myneighborhood}\ $\leftarrow$\ esets
\end{enumerate}
\vfill
\clearpage
\item[:analyse-contact(hispoint)]
$@<+J,$N@\?(E@$H$=$N6aK5$rI=$9(Jself$@$HAj<j$N@\?(E@$H$=$N6aK5$rI=$9(Jhispoint
$@$+$i!"<+J,$KBP$9$k@\?(>r7o$r5a$a$k(J
\begin{enumerate}
\item {\bf for\ each}\ $(mine,his)$\ $\leftarrow$\ self$@$N9=@.MWAG$NFL6aK5$H(J
hispoint$@$N9=@.MWAG$NFL6aK5$NA4$F$NAH9g$;(J
\begin{description}
\item {\bf if}\ mine$@$,LL(J\ {\bf then}\ and-cond\ $\leftarrow$\
and-cond\ $+$\ {\bf face-contact}(mine\ -1.0)
\end{description}
\begin{description}
\item {\bf if}\ his$@$,LL(J\ {\bf then}\ and-cond\ $\leftarrow$\
and-cond\ $+$\ {\bf face-contact}(his\ 1.0)
\end{description}
\begin{description}
\item {\bf if}\ $@NG$HNG$N@\?((J\ {\bf then}\ and-cond\ $\leftarrow$\
and-cond\ $+$\ {\bf edge-edge-contact}($@@\?(E@(J\ mine\ his)
\item {\bf if}\ $@NG$HD:E@$N@\?((J\ {\bf then}\ and-cond\ $\leftarrow$\
and-cond\ $+$\ {\bf edge-vertex-contact}($@@\?(E@(J\ mine\ his)
\item {\bf if}\ $@D:E@$HNG$N@\?((J\ {\bf then}\ and-cond\ $\leftarrow$\
and-cond\ $+$\ {\bf edge-vertex-contact}($@@\?(E@(J\ his\ mine)$@$N$=$l$>$l$N(J
$@MWAG$NId9g$rH?E>$7$?%j%9%H(J
\item {\bf if}\ $@D:E@$HD:E@$N@\?((J\ {\bf then}\ and-cond\ $\leftarrow$\
and-cond\ $+$\ {\bf vertex-vertex-contact}($@@\?(E@(J\ mine\ his)
\end{description}
\item return\ ($@@\?(E@(J\ and-cond)
\end{enumerate}
\begin{itemize}
\item $@%9%F%C%W#3$G(Jand-cond$@$KDI2C$9$k$N$O!"DI2C$5$l$kMWAG$,(Jand-cond$@$K(J
$@4^$^$l$F$$$J$$$H$-$N$_!#(J
\end{itemize}
\end{description}
\vspace{2.0cm}
{\bf :draw-constraint} {\em \&optional (length 30.0)}\\
$@$3$NE@$K$*$1$k94B+$rLp0u$G2hLL$KI=<($9$k!#(J
$@Lp0u$ND9$5$r(Jlength$@$G;XDj$9$k$3$H$b=PMh$k!#(J
\vfill
\clearpage
{\large \bf $@4X?t(J}
\vspace{1.0cm}\\
{\bf contact-to-constraint(mycontact\ hiscontact)}\\
$@Aj<j$K@\?($7$F$$$k<+J,$ND:E@$HNG>e$NE@$N%j%9%H(Jmycontact$@$H(J
$@<+J,$K@\?($7$F$$$kAj<j$ND:E@$HNG>e$NE@$N%j%9%H(Jhiscontact$@$+$i!"(J
$@<+J,$,<u$1$k94B+>r7o$r5a$a$k4X?t(J\\
{\bf return}\ =\ {\bf (($@@\?(E@(J\ \ (($f_{11}\ or\ f_{12}\ \cdots$)\ and\
($f_{21}\ or\ f_{22}\ \cdots$)\ $\cdots$))\ $\cdots$)}
\begin{enumerate}
\item {\bf while}\ mycontact$@$,6u%j%9%H$G$J$$(J\ {\bf do}
\begin{description}
\item point\ $\leftarrow$\ mycontact$@$NMWAG$N0l$D(J
\item {\bf if}\ point$@$HF1$8E@$,(Jhiscontact$@$NMWAG$K$"$k(J\ {\bf then}
\begin{description}
\item anotherpoint\ $\leftarrow$\ $@BP1~$9$kE@$H$=$N6aK5(J
\item constraints\ $\leftarrow$\ constraints\ $+$\ (send\ point\
{\bf :analyse-contact}\ anotherpoint)
\item hiscontact\ $\leftarrow$\ hiscontact\ $-$\ another-point
\end{description}
\item {\bf else}
\begin{description}
\item constraints\ $\leftarrow$\ constraints\ $+$\
(point\ (($@<+J,$ND:E@$,@\?($7$F$$$kAj<j$NLL$NK!@~%Y%/%H%k(J)))
\end{description}
\item mycontact\ $\leftarrow$\ mycontact\ $-$\ point
\end{description}
\item {\bf while}\ hiscontact$@$,6u%j%9%H$G$J$$(J\ {\bf do}
\begin{description}
\item point\ $\leftarrow$\ hiscontact$@$NMWAG$N0l$D(J
\item constraints\ $\leftarrow$\ constraints\ $+$\
(point\ (($@Aj<j$ND:E@$,@\?($7$F$$$k<+J,$NLL$NK!@~%Y%/%H%k$N5U8~$-$N%Y%/%H%k(J)))
\item hiscontact\ $\leftarrow$\ hiscontact\ $-$\ point
\end{description}
\item return\ constraints
\end{enumerate}
{\bf face-contact\ (face\ sign)}
$@LL(Jface$@$K$h$k94B+>r7o$r5a$a$k!#(Jface$@$,<+?H$NLL$N$H$-$O(Jsign$@$O(J\ $-1.0$\ $@!"(J
$@Aj<j$NLL$N$H$-$O(J\ $1.0$$@!#(J
\begin{enumerate}
\item return\ (list\ face$@$NK!@~%Y%/%H%k(J\ $\times$\ sign)
\end{enumerate}
{\bf edge-edge-contact\ (point\ myedge\ hisedge)}
$@@\?(E@(Jpoint$@$K$*$1$k<+J,$N6aK5$rI=$9NG(Jmyedge$@$HAj<j$N6aK5$r(J
$@I=$9NG(Jhisedge$@$+$i!"$3$N@\?(E@$K$h$k94B+>r7o$r5a$a$k(J
\begin{enumerate}
\item mypoints\ $\leftarrow$\ (send\ myedge\ {\bf :neighborpoints}\ point)
\item hispoints\ $\leftarrow$\ (send\ hisedge\ {\bf :neighborpoints}\ point)
\item {\bf if} myedge$@$H(Jhisedge$@$,J?9T(J {\bf then} return nil
\item s-plane\ $\leftarrow$\ myedge$@$H(Jhisedge$@$r4^$`LL(J
\item return\ (\ (send\ s-plane\ {\bf :separation}\ mypoints\ hispoints)\ )
\end{enumerate}
\vfill
\clearpage
{\bf edge-vertex-contact\ (point\ myedge\ hisvertex)}
$@@\?(E@(Jpoint$@$K$*$1$k<+J,$N6aK5$rI=$9NG(Jmyedge$@$HAj<j$N6aK5$r(J
$@I=$9D:E@(Jhisvertex$@$+$i!"$3$N@\?(E@$K$h$k94B+>r7o$r5a$a$k(J
\begin{enumerate}
\item mypoints\ $\leftarrow$\ (send\ myedge\ {\bf :neighborpoints}\ point)
\item hispoints\ $\leftarrow$\ hisvertex$@$N:\$C$F$$$kNG$NH?BPB&$ND:E@$N%j%9%H(J
\item {\bf for\ each}\ f\ $\leftarrow$\ myedge$@$N:\$k#2$D$NLL(J
\begin{description}
\item c-vector\ $\leftarrow$\ (send f\ {\bf :separation}\ mypoints\ hispoints)
\item {\bf if}\ c-vector$@$,(Jnil$@$G$J$$(J\ {\bf then}\
or-cond\ $\leftarrow$\ or-cond\ $+$\ c-vector
\end{description}
\item {\bf for\ each}\ $p1,p2$\ $\leftarrow$\ myedge$@>e$NE@!"(Jhispoints$@$N(J
$@Cf$+$i0[$J$k#2E@$NAH9g$;(J
\begin{description}
\item s-plane\ $\leftarrow$\ $point,p1,p2$\ $@$N#3E@$N:\$kLL(J
\item c-vector\ $\leftarrow$\
(send s-plane\ {\bf :separation}\ mypoints\ hispoints)
\item {\bf if}\ c-vector$@$,(Jnil$@$G$J$$(J\ {\bf then}\
or-cond\ $\leftarrow$\ or-cond\ $+$\ c-vector
\end{description}
\item return\ or-cond
\end{enumerate}
{\bf vertex-vertex-contact\ (point\ myvertex\ hisvertex)}
$@@\?(E@(Jpoint$@$K$*$1$k<+J,$N6aK5$rI=$9D:E@(Jmyvertex$@$HAj<j$N6aK5$r(J
$@I=$9D:E@(Jhisvertex$@$+$i!"$3$N@\?(E@$K$h$k94B+>r7o$r5a$a$k(J
\begin{enumerate}
\item mypoints\ $\leftarrow$\ myvertex$@$N:\$C$F$$$kNG$NH?BPB&$ND:E@$N%j%9%H(J
\item hispoints\ $\leftarrow$\ hisvertex$@$N:\$C$F$$$kNG$NH?BPB&$ND:E@$N%j%9%H(J
\item bothpoints\ $\leftarrow$\ myvertex$@$H(Jhisvertex$@$N=EJ#$r=|$$$?OB=89g(J
\item {\bf for\ each}\ $p1,p2$\ $\leftarrow$\ bothpoint
$@$NCf$+$i0[$J$k#2E@$NAH9g$;(J
\begin{description}
\item s-plane\ $\leftarrow$\ $point,p1,p2$\ $@$N#3E@$N:\$kLL(J
\item c-vector\ $\leftarrow$\
(send s-plane\ {\bf :separation}\ mypoints\ hispoints)
\item {\bf if}\ c-vector$@$,(Jnil$@$G$J$$(J\ {\bf then}\
or-cond\ $\leftarrow$\ or-cond\ $+$\ c-vector
\end{description}
\item return\ or-cond
\end{enumerate}
\vfill
\clearpage
\subsubsection{$@7W;;Nc(J}
$@K\%W%m%0%i%`$K$h$C$F!"Ey2A94B+E@$N0LCV$H!"3F!9$NE@$K$*$1$k94B+>r7o$r(J
$@5a$a$?Nc$r<!$K<($9!#(J
Fig.\ref{fig:bilateral}$@$ON>B&94B+$NNc!"(J
Fig.\ref{fig:unilateral}$@$OJRB&94B+$NNc$G$"$k!#(J
\begin{figure}[h]
\begin{center}
\epsfile{file=fig-bilateral.ps,width=15cm}
\end{center}
\caption{Bilateral constraint}
\label{fig:bilateral}
\end{figure}
\begin{verbatim}
(setq x (make-cube 200 200 100))
(setq y (make-cube 100 100 300))
(setq ana (body- x y))
(send y :constraint ana)
(hidd y ana)
(send y :draw-constraint)
\end{verbatim}
\vfill
\clearpage
\begin{figure}[h]
\begin{center}
\epsfile{file=fig-unilateral.ps,width=15cm}
\end{center}
\caption{Unilateral constraint}
\label{fig:unilateral}
\end{figure}
\begin{verbatim}
(setq x (make-prism '(#f(-80 0 -50) #f(-80 -25 0) #f(-80 -100 0)
		      #f(-80 -100 25) #f(-80 100 25) #f(-80 100 0)
		      #f(-80 25 0))
		    #f(160 0 0)))
(setq mizo (make-prism '(#f(-100 0 -50) #f(-100 25 0) #f(-100 100 0)
			 #f(-100 100 -100) #f(-100 -100 -100) #f(-100 -100 0)
			 #f(-100 -25 0))
		       #f(200 0 0)))
(send x :constraint mizo)
(hidd x mizo)
(send x :draw-constraint mizo 20.0)
\end{verbatim}
\vfill
\clearpage
Fig.\ref{fig:peg-in-hole}$@$O!"7j$K$Z%0$rF~$l$k:n6HCf$N94B+>uBV$NNc$G$"$k!#(J
\begin{figure}[h]
\epsfile{file=fig-peg-in-hole1.ps,width=8cm}
\epsfile{file=fig-peg-in-hole2.ps,width=8cm}
\epsfile{file=fig-peg-in-hole3.ps,width=8cm}
\epsfile{file=fig-peg-in-hole4.ps,width=8cm}
\caption{Peg in a hole}
\label{fig:peg-in-hole}
\end{figure}
\subsubsection{$@J88%(J}
$@K\@a$NFbMF$O!"<!$NO@J8$K$h$C$F$$$k!#(J
$@K\@a$N%W%m%0%i%`$rMQ$$$F3X2qEy$GH/I=$5$l$k:]$O!"(J
$@$4;2>H2<$5$kMM$*4j$$$7$^$9!#(J
\begin{itemize}
\item $@HfN1@nGn5W!">>0f=S9@!"9b@%T"9n!"(J
$@B?LLBN4V$N@\?($K$h$k94B+>r7o$r4v2?%b%G%k$+$iF3=P$9$k0lHLE*$J%"%k%4%j%:%`!"(J
$@F|K\%m%\%C%H3X2q;o!"#94,!"#49f!"#1#9#9#1!#(J
\end{itemize}
\vfill
\clearpage
\subsection{$@J*BN4V$N@\?($K$h$k94B+$N2r@O(J}

\subsubsection{$@%"%k%4%j%:%`$N35MW(J}
$@A0@a$G=R$Y$?MM$K!"Ho94B+J*BN$H94B+J*BN$N7A>u$OB?LLBN!"(J
$@N><T$N4V$KK`;$$OF/$+$J$$$H2>Dj$9$k$H!"Ho94B+J*BN$KBP$9$k94B+>r7o$O0lHL$K!"(J
\begin{equation}
\bigcap_{k=1}^{L} \bigcap_{i=1}^{N(k)}\ \bigcup_{j=1}^{M(k,i)}\
F_{kij}^{T}J_{k}\left(
\begin{array}{c}
\Delta X \\ \Omega
\end{array}
\right)\geq 0
\label{eq:ippannokosoku}
\end{equation}
$@$GM?$($i$l$k!#$3$3$K!"(J$L$$@$OEy2A94B+E@$N?t!"(J
$N(k)$$@$O3FEy2A94B+E@$K$*$1$kO@M}@Q>r7o$N?t!"(J$M(k,i)$$@$OO@M}OB>r7o$N?t$G$"$k!#(J
$@$^$?!"(J$F_{kij}:3\times 1$$@$O94B+K!@~%Y%/%H%k!"(J
$J_{k}:3\times 6$$@$O!"J*BN:BI87O$GI=$5$l$?Hy>.JQ0L(J$\Delta X$$@!&2sE>(J$\Omega$$@$r(J
$@Ey2A94B+E@$r86E@$H$9$k:BI87O$GI=$5$l$?Hy>.JQ0L(J$\Delta X_{k}$
$@$KJQ49$9$k%d%3%S9TNs$G$"$k!#(J
$@J,G[B'$rMQ$$$FO@M}OB$rA0$K=P$9$H!"(J(\ref{eq:ippannokosoku})$@<0$O!"(J
\begin{equation}
\bigcup_{p=1}^{Q}\ C_{p}\ \left(
\begin{array}{c}
\Delta X \\ \Omega
\end{array}
\right)\geq 0
\label{eq:matrix-form}
\end{equation}
$@$H$$$&7A$K$+$1$k!#$3$3$K!"(J$Q=\Pi_{k,i}M(k,i)$$@!"(J
$C_{p}:n\times 6$ $@$O(J$F_{kij}^{T}J_{k}$$@$r9T%Y%/%H%k$H$9$k9TNs$G$"$k!#(J
$n$$@$O(J$p$$@$K0MB8$7$F7h$^$k?t$G$"$k$,!"$3$3$G$O4JC1$N$?$aC1$K(J$n$$@$H5-$7$?!#(J
(\ref{eq:ippannokosoku})$@<0$N2r$O!"3F!9$N!"(J
\begin{equation}
C_{p}\ \left(
\begin{array}{c}
\Delta X \\ \Omega
\end{array}
\right)\geq 0
\label{eq:each-matrix-form}
\end{equation}
$@$H$$$&O"N)@~7AITEy<0$N2r$NOB=89g$K$J$k!#(J
(\ref{eq:each-matrix-form})$@<0$N2r$OFLB?LL?m$K$J$k$,!"(J
$@2r$r5a$a$k$N$KI,MW$J7W;;NL$O(J$r=rank\ C_{p}$$@$K0MB8$9$k!#(J
$@$=$3$G!"$^$:9TNs(J$C_{p}$$@$r!"(J
\begin{equation}
C_{p}=\ \left(
\begin{array}{cc}
U_{1} & U_{2}
\end{array}
\right) \left(
\begin{array}{cc}
D_{rr} & O \\
O & O
\end{array}
\right) \left(
\begin{array}{c}
V_{1}^{T} \\
V_{2}^{T}
\end{array}
\right)
\label{eq:svd}
\end{equation}
$@$HFC0[CMJ,2r$9$k$3$H$K$h$j!"(J$C_{p}$$@$NNm6u4V$rJ,N%$9$k!#(J
$@$3$3$K!"(J$U_{1}:n\times r$$@!"(J$U_{2}:n\times (6-r)$$@!"(J
$V_{1}:6\times r$$@!"(J$V_{2}:6\times (6-r)$$@$OD>8r9TNs!"(J
$D_{rr}:r\times r$$@$OBP3Q9TNs$G$"$k!#(J
(\ref{eq:each-matrix-form})$@<0$N2r$O!"(J$C_{p}$$@$NNm6u4V$H!"(J
$V_{1}$$@$NNs%Y%/%H%k$GD%$i$l$k(J$r$$@<!85@~7AItJ,6u4V$K$*$1$k2r$ND>OB$K$J$k!#(J
$@8e<T$O!"(J
\begin{equation}
U_{1}D_{rr}V_{1}^{T}V_{1}W_{r}
=U_{1}D_{rr}W_{r}\stackrel{\rm def}{=}
\left(
\begin{array}{c}
H_{1}^{T} \\ \vdots \\ H_{n}^{T}
\end{array}
\right) W_{r}
\geq O
\label{eq:pointed-cone}
\end{equation}
$@$J$kO"N)@~7AITEy<0$N2r(J$W_{r}$$@$G$"$k!#(J
$rank\ U_{1}D_{rr}=r$$@$G$"$k$N$G!"$3$N2r$O86E@$r!VD:E@!W$H$9$kFLB?LL?m$K$J$j!"(J
\begin{equation}
W_{r}=\left(
\begin{array}{ccc}
E_{1} & \cdots & E_{m}
\end{array}
\right) \left(
\begin{array}{c}
\epsilon_{1} \\ \vdots \\ \epsilon_{m}
\end{array}
\right)
\label{eq:pointed-cone-solution}
\end{equation}
$@$H$$$&HsIi#1<!7k9g$GI=8=$5$l$k!#(J
$@$3$3$K!"(J$E_{j}:r\times 1$ $@$OFLB?LL?m$NB&JU$NJ}8~$rI=$9%Y%/%H%k!"(J
$\epsilon_{j}$$@$OHsIi$N%9%+%i!<!"(J$m$$@$OB&JU$N?t$G$"$k!#(J
$@:G=*E*$J(J(\ref{eq:each-matrix-form})$@<0$N2r$O!"(J$C_{p}$$@$NNm6u4V$NMWAG$r2C$($F!"(J
\begin{equation}
\left(
\begin{array}{c}
\Delta X \\ \Omega
\end{array}
\right) =V_{1} \left(
\begin{array}{ccc}
E_{1} & \cdots & E_{m}
\end{array}
\right) \left(
\begin{array}{c}
\epsilon_{1} \\ \vdots \\ \epsilon_{m}
\end{array}
\right) + \left(
\begin{array}{cc}
V_{2} & -V_{2}
\end{array}
\right) \left(
\begin{array}{c}
\epsilon_{m+1} \\ \vdots \\ \epsilon_{m+2(6-r)}
\end{array}
\right)
\label{eq:finalsolution}
\end{equation}
$@$HI=$5$l$k!#(J
$V_{1}E_{j}$$@$O94B+>uBV$rJQ2=$5$;$kHy>.JQ0L$KBP1~$7!"(J
$V_{2}$$@$OA4$F$NEy2A94B+E@$H$N@\?(>uBV$r0];}$9$kHy>.JQ0L$KBP1~$9$k!#(J
$@$3$N<0$O!"@\?($K$h$j94B+$r<u$1$?J*BN$K5v$5$l$kG$0U$NHy>.JQ0L$,!"(J
$m+2(6-r)$$@8D$NHy>.JQ0L$NHsIi#1<!7k9g$GI=$5$l$k$3$H$r<($7$F$$$k!#(J
$@$3$l$O:G>.$N?t$N4pDl$G$"$k!#(J
$@$3$N$H$-!"Ho94B+J*BN$,94B+J*BN$KBP$7$F(J
$@H/@82DG=$JNO(J$F$$@!"%H%k%/(J$T$$@$N=89g$O!"(J
(\ref{eq:finalsolution})$@<0$NAPBPFLB?LL?m$G!"(J
\begin{equation}
\left(
\begin{array}{ccc}
V_{1}(E_{1}\ \cdots\ E_{m}) & V_{2} &  -V_{2}
\end{array}
\right)^{T}
\left(
\begin{array}{c}
F \\ T
\end{array}
\right) \leq 0
\label{eq:force}
\end{equation}
$@$J$kO"N)ITEy<0$N2r$K$J$k!#(J

$@K\@a$G$O!"(Jc-body$@$N%a%=%C%I(J$:constraint$$@$G5a$a$?(J(\ref{eq:ippannokosoku})$@<0(J
$@$+$i2r$G$"$k(J(\ref{eq:finalsolution})$@<0$r5a$a$k%W%m%0%i%`!"(J
(\ref{eq:force})$@<0$N2r$r5a$a$k%W%m%0%i%`$r@bL@$9$k!#(J
$@$3$l$i$N%W%m%0%i%`$r;H$&$?$a$K$O!"(J
$eus/llib/solve-inequalities.l$\ $@$r%m!<%I$9$kI,MW$,$"$k!#(J
$@K\%"%k%4%j%:%`$N<gMWItJ,$O(J$C$$@$G%$%s%W%j%a%s%H$5$l$F$*$j!"(J
$Euslisp$$@$NB>8@8l%$%s%?!<%U%'%$%9$rMQ$$$F%j%s%/$7$F$$$k!#(J
$C$$@$NItJ,$O(J$eus/cone$$@$H$$$&(Jdirectory$@$K$"$j!"(J
\begin{verbatim}
 % cd eus/cone
 % make cone
 % make install
\end{verbatim}
$@$r<B9T$9$k$3$H$K$h$C$F!"%i%$%V%i%j!<$,:n$i$l$k!#(J
$@%j%s%/$9$k:]$K$O(J$convexconeref.o$$@$H$$$&%*%V%8%'%/%H%U%!%$%k$,(J
$@2?=h$+$KI,MW$G$"$k!#>\:Y$O!"(Jeus/llib/solve-inequalities.l\ $@$r;2>H$5$l$?$$!#(J

$@%$%s%W%j%a%s%F!<%7%g%s>e$N@)Ls$+$i!"Ey2A94B+>r7o$N?t$O:GBg#3#2$H$J$C$F$$$k!#(J
\vfill
\clearpage
\subsubsection{$@%$%s%W%j%a%s%F!<%7%g%s(J}
\vspace{1.0cm}
{\jLarge c-body}
\\ [0.5cm]
\begin{description}

\item[{\jlarge \bf description}]\hspace{1cm}
\begin{description}
\item[] $@94B+>r7o$r3JG<$9$k%9%m%C%H$rDI2C$7$?(Jbody$@$N%5%V%/%i%9(J
\end{description}

\item[{\jlarge \bf super class}]\hspace{1cm}
\begin{description}
\item[body] ()
\end{description}

\item[{\jlarge \bf slots}]\hspace{1cm}
\begin{description}
\item[motion] $@5v$5$l$kHy>.JQ0L(J
\item[force] $@H/@82DG=$JNO(J
\end{description}

\item {\jlarge \bf methods}
\\ [0.5cm]
\begin{description}
\item[:motion ()] self$@$KBP$9$k94B+>r7o$r2r$$$F!"5v$5$l$kHy>.JQ0L$r5a$a$k!#(J
\item[:force ()] self$@$K5v$5$l$kHy>.JQ0L$+$i!"H/@82DG=$JNO$r5a$a$k!#(J
\item[:draw-motion (b)] self$@$H(Jb$@$,@\?($7$F$$$k$H$-$K!"(Jself$@$K5v$5$l$kHy>.JQ0L(J
$@$rI=<($9$k!#(J
\end{description}
\end{description}
\vfill
\clearpage
\subsubsection{$@7W;;Nc(J}
$@K\%W%m%0%i%`$K$h$C$F!"(J(\ref{eq:finalsolution})$@<0$G(J
$@I=$5$l$k2r$r5a$a$?Nc$r0J2<$K<($9!#(J

Fig.\ref{fig:trigonalprism}$@$K!"#33QCl$,%F!<%V%k$N>e$K:\$C$F$$$kNc$r<($9!#(J
$@$3$N>l9g!"2r$O<!<0$GI=$5$l$k!#(J
\begin{equation}
\left(
\begin{array}{c}
\Delta X \\ \Omega
\end{array}
\right) = \left(
\begin{array}{ccc}
0.0 & 0.0 & 0.0 \\
0.0 & 0.0 & 0.0 \\
2.31 & 6.00 & 2.31 \\
-.0308 & 0.08 & -.0308 \\
.0923 & 0.0 & -0.923 \\
0.0 & 0.0 & 0.0
\end{array}
\right) \left(
\begin{array}{c}
\epsilon_{1} \\ \epsilon_{2} \\ \epsilon_{3}
\end{array}
\right) + \left(
\begin{array}{cccccc}
-10. & 10. & 0.0 & 0.0 & 0.0 & 0.0 \\
0.0 & 0.0 & -10. & 10. & 0.0 & 0.0 \\
0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\
0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\
0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\
0.0 & 0.0 & 0.0 & 0.0 & 0.1 & -0.1
\end{array}
\right) \left(
\begin{array}{c}
\epsilon_{4} \\ \epsilon_{5} \\ \epsilon_{6} \\
\epsilon_{7} \\ \epsilon_{8} \\ \epsilon_{9}
\end{array}
\right)
\end{equation}
$@?^$K<($7$F$"$k$N$O!"94B+>r7o!"N%C&F0:n$N0l$D!"94B+$r0];}$9$kJB?J$H2sE>$G$"$k!#(J
\begin{figure}[h]
\begin{center}
\epsfile{file=fig-onthetable-0.ps,width=7cm}
\epsfile{file=fig-onthetable-m1.ps,width=7cm}\\
\epsfile{file=fig-onthetable-mt.ps,width=7cm}
\epsfile{file=fig-onthetable-mr.ps,width=7cm}
\end{center}
\caption{Possible motions of a trigonal prism}
\label{fig:trigonalprism}
\end{figure}
\vfill
\clearpage
Fig.\ref{fig:peg-in-a-hole}$@$K3QCl$,7j$KF~$C$F$$$kNc$r<($9!#(J
$@$3$N>l9g!"2r$O<!<0$GI=$5$l$k!#(J
\begin{equation}
\left(
\begin{array}{c}
\Delta X \\ \Omega
\end{array}
\right) = \left(
\begin{array}{ccc}
0.0 & 0.0 & 0.0 \\
3.87 & -8.66 & -3.87 \\
2.24 & 5.0 & -2.24 \\
.0894 & 0.0 & -.0894 \\
0.0 & 0.0 & 0.0 \\
0.0 & 0.0 & 0.0
\end{array}
\right) \left(
\begin{array}{c}
\epsilon_{1} \\ \epsilon_{2} \\ \epsilon_{3}
\end{array}
\right)
\end{equation}
$@$3$NNc$G$O!"94B+>uBV$rJQ$($J$$F0:n$OB8:_$;$:!"(J
$@G$0U$NF0:n$O?^$K<($7$?MM$J#3$D$NF0:n$+$i@8@.$5$l$k!#(J
\begin{figure}[h]
\begin{center}
\epsfile{file=fig-peg-naname-0.ps,width=7cm}
\epsfile{file=fig-peg-naname-m1.ps,width=7cm}\\
\epsfile{file=fig-peg-naname-m2.ps,width=7cm}
\epsfile{file=fig-peg-naname-m3.ps,width=7cm}
\end{center}
\caption{Possible motions of a peg in a hole}
\label{fig:peg-in-a-hole}
\end{figure}
\vfill
\clearpage
\subsubsection{$@J88%(J}
$@K\@a$NFbMF$O!"<!$NO@J8$K$h$C$F$$$k!#(J
$@K\@a$N%W%m%0%i%`$rMQ$$$F3X2qEy$GH/I=$5$l$k:]$O!"(J
$@$4;2>H2<$5$kMM$*4j$$$7$^$9!#(J
\begin{itemize}
\item $@HfN1@nGn5W!">>0f=S9@!"9b@%T"9n!"(J
$@B?LLBN4V$N@\?($K$h$k94B+>r7o$N9bB.2rK!$H$=$NN%C&F0:n7W2h$X$N1~MQ!"(J
$@F|K\%m%\%C%H3X2q;o!"7G:\M=Dj!#(J
\end{itemize}


\documentclass[Thesis.tex]{subfiles}
\begin{document}
\chapter{Variational Monte Carlo}
\label{chp:variational-monte-carlo}

\glsresetall

\Gls{vmc} is a method for obtaining the ground state wave function of
a quantum mechanical system, and it constitutes the framework for all the calculations we
perform in this thesis. As this method is of great significance to us, this chapter is
devoted to all relevant definitions, derivations and technical details required for a
successful study of the systems of interest.

\section{The Variational Principle}

The fundamental principle that enables \gls{vmc} is the observation that the wave function that
describes the ground state of a system, is the wave function which produces the lowest
expectation value of the energy. Read this statement a couple of times and it almost seems
like a circular definition, because we define the ground state as the state with the
lowest energy. Still, this simple observation is what allows us a way to go forward.

Let's formalize the above statement.

\begin{theorem}[Variational Principle]\label{thm:variational-principle}
    Suppose a time-independent Hamiltonian, $\hat H$, an associated set of eigenvalues,
    $E_0\leq E_1\leq\dots$ and
    a set of orthonormal eigenvectors, $\{\ket{\phi_n}\}$ spanning the associated
    Hilbert space, such that the \acrlong{tise} is satisfied,

    \begin{align}
        \hat H\ket{\phi_n} = E_n\ket{\phi_n}.
    \end{align}
    For any arbitrary $\ket\psi$ in the Hilbert space, the expectation value of $\hat H$
    for this wave function must satisfy
    \begin{align}
        \expval{\hat H}&\defeq \expval{\hat H}{\psi} \geq E_0,
    \end{align}
    where $E_0$ is the exact ground state energy, with equality if and only if
    $\ket\psi=\ket\phi_0$.
\end{theorem}
\begin{proof}
    Because $\{\ket{\phi_n}\}$ constitutes a complete orthonormal basis of the Hilbert
    space, we can expand $\ket\psi$ as
    \begin{align}
        \ket\psi = \sum_n c_n\ket{\phi_n} \qq{with} \sum_n \abs{c_n}^2 = 1.
    \end{align}
    We then have
    \begin{align}
        \expval{\hat H}{\psi} &= \qty(\sum_m c^*_m\bra{\phi_m})\hat H\qty(\sum_n
        c_n\ket{\phi_n})\\
        &= \sum_n\sum_m c_m^*c_n\bra{\phi_m}\hat H\ket{\phi_n}\\
        &= \sum_n\sum_m c_m^*c_nE_n\bra{\phi_m}\ket{\phi_n}\\
        &= \sum_n\sum_m c_m^*c_nE_n\delta_{mn}\\
        &= \sum_n \abs{c_n}^2 E_n\\
        &\geq\sum_n \abs{c_n}^2 E_0 = E_0.
    \end{align}
    It is clear that the equality only occurs when $c_n = \delta_{0n}$, which implies
    $\ket\psi=\ket{\phi_0}$.
\end{proof}

If we require the test wave function $\ket\psi$ to be orthogonal to $\ket{\phi_0}$, then
the above derivation results in a similar condition for determining the first excited
state. By applying the same reasoning iteratively, the same can be said about any higher
energy state. So in principle, we can use the variational principle to first find the
ground state, then find an orthogonal state that gives the first excited energy, then find
a state orthogonal to both that gives the second excited energy etc. We will not pursue
any excited states in this thesis, but it is useful to know that we could in principle
extend our results if need be.

\section{The Variational Monte Carlo Algorithm}

Rooted in the variational principle, the general approach to finding a good estimate of
the ground state goes as follows:

\begin{enumerate}
    \item Define the Hamiltonian of interest, $\hat H$
    \item Propose a trial wave function $\ket{\vb \alpha}$ dependent on some free parameters
        $\vb \alpha=\qty(\alpha_1, \alpha_2,\dots, \alpha_m)$
    \item Return the best possible wave function $\ket{\vb\alpha}$ such that $\expval{\hat
        H}{\vb\alpha}$ is minimized w.r.t the parameters $\vb \alpha$.
\end{enumerate}
The first step is trivial, as we shall assume that the Hamiltonians we want to examine are
given in advance.\footnote{Clearly, deriving/defining Hamiltonians that accurately describe a given
system is not a trivial task in general, and might require great levels of theoretical
work and/or experimental data analysis. But from our perspective, this work has already
been done.}

The second and third points are where we will spend our efforts, and so we devote extra
attention to these two points in particular.

\section{The Trial Wave Function}

Critical to the outcome of a \gls{vmc} calculation is the quality of the proposed trail wave
function. In order to have stable and sensible results we should also take care that the
wave function obeys the requirements stated in
\cref{sec:requirements-of-wave-functions}. Beyond these basic assertions, it is
imperative that the functional form of the proposed wave function is capable of expressing
the true underlying ground state, or at least a good approximation of it. As an example,
take the simple case of the idealized one-dimensional harmonic oscillator presented in
\cref{sec:simple-non-inter-HO}, with the ground state expressed as
\begin{align}
    \phi_0(x) \propto \exp(- \frac{1}{2} x^2).
\end{align}
If we proposed a trial wave function on a form
\begin{align}
    \psi(x; \alpha)\propto \exp(- \alpha x^2),
\end{align}
we could expect \gls{vmc} to produce the exact ground state after optimizing $\alpha$. The above
is a good trial wave function because its functional form contains the exact state.

Suppose now we proposed something different, maybe because of a lack of theoretical
understanding. For the sake of example, say we chose this visually similar
function:\footnote{Visually similar in the sense that plotting them both yield similar bell
shaped curves, not in terms of their algebra.}
\begin{align}
    \psi(x; \alpha)\propto \frac{1}{1 + \alpha x^2}.
\end{align}
No matter how we tune the $\alpha$ parameter here, we will never achieve the lowest
ground state energy, simply because the ground state is not possible to express within this
functional form. We can now only hope to get approximations, acting as upper bounds on the
ground state energy.

\subsection{Slater-Jastrow: Standard Approach}
\label{sec:slater-jastrow}

In order to come up with good trail wave functions we have a standard approach which often
serves us well. Typically we are considering a system of many interacting particles in
some external potential (e.g. the quantum dots system). In such cases the typical approach
is to build a trial wave function as a product of a single-particle part, $S$, and a correlation
part, $J$. The two are referred to as the \emph{Slater} factor and the
\emph{Jastrow} factor, respectively:

\begin{align}
    \psi = S\cdot J.
\end{align}

\subsubsection*{Slater Factor}

The idea behind the decomposition above is that we put all the physical insight we have into these
two components individually. For the single particle part we include what we can deduce
about the system if we idealize it in some way. Typically that involves looking at the
states when there is only one particle, or considering some simplified interaction between
all of them (e.g. Hartree-Fock approximation). The basis functions we obtain from such an
analysis are then placed in a determinant/permanent structure so as to fix the symmetry
requirements of fermions/bosons, respectively. This factor is then the Slater
factor~\cite{Slater-1929,Dirac-1926}.

For clarity, we present a couple of different Slater forms. We consider the two-dimensional
quantum dots system from \cref{sec:quantum-dots-theory} for $N$ particles. We
denote the position of particle $i$ by $\vb x_i=(x_i, y_i)$. Let $\vb\Phi$ be a matrix defined by $\Phi_{i,j}
\defeq \phi_{i}(\vb x_j)$, where the $\phi_i$ is part of the set of orbitals
$\{\phi_{0,0}, \phi_{1,0},\phi_{0,1}, \phi_{1,1},\dots\}$, as defined in
\cref{eq:ho-single-particle-orbitals}. Lastly, let $\vb \Phi^{(M)}$ denote the
resulting matrix with $M$ rows, one for each of the $M$ lowest energy orbitals. Finally,
if the particles are fermions we define the Slater factor as:\footnote{Spin considerations not mentioned here, as they will not be important for the particular systems we will investigate. In general though, the structure of the Slater factor needs to account for spin in a well defined way.}

\begin{align}
    S(\vb X)_\text{fermions} \defeq \text{determinant}\qty(\vb\Phi^{(M)}).
\end{align}
Due to the properties of the determinant, this has the anti-symmetry required for
fermions.

In the case of bosons, we could just change the above to
\begin{align}
    S(\vb X)_\text{bosons} \defeq \text{permanent}\qty(\vb\Phi^{(M)}).
\end{align}
However, there are far less computationally expensive ways to get a \emph{symmetric}
result, as required for bosons. A simple product of single particle ground states is
sufficient in this case.
\begin{align}
    S(\vb X)_\text{bosons} \defeq \prod_{i}^N \phi_{0,0}(\vb x_i).
\end{align}

The general structure is constant across different systems, changing only the basis
functions we use to express the matrix elements.

In some cases, however, we will struggle to find basis functions that describe a meaningful
portion of the system's behaviour in this way. In such challenging cases, the Slater factor
could be reduced to only being responsible for supplying the correct symmetry. In the case
of bosons, that would mean the complete removal of the Slater factor from the trial wave
function. We will see this when looking further into the liquid helium system.

\subsubsection*{Jastrow Factor}

Anything not covered by this analysis is meant to be accounted for in the correlation
term, $J$. This is typically a function on the following generalized form, commonly called a Jastrow
factor~\cite{Jastrow-1955}:
\begin{align}
    J(\vb X) &= \exp(\sum_{i < j} U(r_{ij})),
\end{align}
where $U(r_{ij})$ is some function dependent on the inter-particle distance only. Note that by
convention the Slater factor has the correct symmetry, so the correlation factor should
always be symmetrical in order to maintain the same total symmetry.

Any variational parameters $\vb \alpha$ are typically introduced as part of the Jastrow
factor. The Slater factor represents everything we are sure should be included
from a theoretical approach, while the Jastrow term should ideally account for all our ignorance.
It is therefore typically expressed with a few free parameters.

Again, for the sake of clarity, we state an example of a Jastrow factor. One of the most
commonly used is the Pade-Jastrow factor~\cite{Drummond-Towler-Needs-2008}:
\begin{align}
    J(\vb X) = \prod_{i < j} \exp(\frac{\alpha r_{ij}}{1 + \beta r_{ij} } ).
\end{align}
Here $\beta$ is the only variational parameter, and $\alpha$ is fixed depending on the
dimensionality and spin of the particles. More complicated versions exist, containing
higher order polynomials of $r_{ij}$ in the exponential. This particular form
will prove to be a very good choice for the quantum dots system.

\section{Optimization}

At this point, we have a Hamiltonian $\hat H$ defining our system of interest,
and we have proposed a trial wave function $\ket{\vb\alpha}$ based on the
theoretical intuition we have. The wave function has by design some free
parameters $\vb\alpha$ which we now want to pin down to their optimal values.

From the variational principle (\cref{thm:variational-principle}), we know
that the best set of parameters are those that minimize the expected energy,
$\expval{\hat H}{\vb\alpha}$. As such, a natural place to start would be to
determine an efficient way to evaluate the energy.

\subsection{Local Energy}

Denote the trial wave function as $\psi_{\vb\alpha}(\vb X)$, where $\vb\alpha$
are the variational parameters and $\vX=(\vx_1\  \vx_2\ \dots\ \vx_n)^T$ is the
matrix of all the degrees of freedom for each particle (e.g. position
coordinates). The expectation value for the energy of the system is:

\begin{align}
    \expval{\hat H} &= \frac{\expval{\hat H}{\vb\alpha}}{\braket{\vb\alpha}}\\
    &= \frac{\int \dd{\vb X} \psialpha^*\hat H\psialpha}{\int\dd{\vX}\abs{\psialpha}^2}.
    % &= \int\dd{\vX} P(\vX,\valpha)E_L(\vX,\valpha),
\end{align}
%
We now restructure this integral a bit. Remembering the interpretation of
the wave function as a \gls{pdf}, we can write the \emph{probability
density} for a given system configuration $\vX$ as:

\begin{align}
    P_{\psi_{\vb{\alpha}}}(\vX) \defeq \frac{\abs{\psialpha}^2}{\int\dd{\vX}\abs{\psialpha}^2},\label{eq:wavefunc-probability-density-def}
\end{align}
where we account for the possibility of $\psialpha$ not being normalized to unity. Further, we define a quantity we will call the \emph{local energy},
\begin{align}
    E_L &\defeq \frac{1}{\psialpha} \hat H\psialpha.\label{eq:local-energy-def}
\end{align}
The reason for these definitions is that now we can write the energy expectation as follows:

\begin{align}
    \expval{\hat H} &= \int\dd{\vX} P_{\psi_{\valpha}} (\vX) E_L(\vX).
\end{align}
Why is this better? Because this is simply the weighted average of the local
energy, something which has a straightforward discrete formulation:
\begin{align}\label{eq:vmc-local-energy-formulation}
    \expval{\hat H} &= \lim_{N\rightarrow \infty} \frac{1}{N} \sum_{i = 1}^N E_L(\vX_i)
    \qq{where} \vb X_i\disteq P_{\psi_{\valpha}}.
\end{align}
So, if we can sample $\vX$ from the distribution described by our trial wave
function, we simply need to evaluate the local energy for a sufficiently large
number of configurations  to obtain a good estimate of the expectation value of
the Hamiltonian. How exactly to do the sampling is a rather involved topic, and
will be handled in \cref{chp:monte-carlo}.

\subsection{Updating Parameters}

Now that we can evaluate the energy, the function to minimize, we could in
principle start optimizing our parameters. If the parameters are few and
discrete we could simply evaluate the energy for all of them and pick the one
which gives the best result. However, this approach will quickly become
intractable for even a modest number of parameters, and more intelligent
methods should be pursued.

Perhaps the most common optimization strategy relies on computing the gradient
of the energy w.r.t. $\valpha$, and then change $\valpha$ in the opposite
direction of this. After all, a gradient by definition points in the direction
of steepest (local) ascent, so going the other way will be the direction of steepest
descent. How exactly to make these changes is a topic of its own, and discussed in depth in \cref{chp:machine-learning}, but the simplest implementation is as follows:

\begin{align}
    \valpha^{(i+1)} = \valpha^{(i)} - \eta \grad_{\valpha}{\expval{\hat H}},
\end{align}
for a suitably chosen hyperparameter $\eta\in\mathbb{R}$, typically $\eta\ll 1$.
This says that the updated parameters $\valpha^{(i+1)}$ are equal to the
previous ones, $\valpha^{(i)}$, minus a small step in the direction of the
gradient of $\expval{\hat H}$ w.r.t. each parameter. After a sufficient number
of iterations, we hope that the parameters converge to their optimal values.

This raises another question, namely how to compute
$\grad_{\valpha}{\expval{\hat H}}$. Using the basic properties of derivatives we get (temporarily omitting the subscript on $\psialpha$):
\begin{align}
    \grad_{\valpha}\expval{\hat H} &= \grad_{\valpha}\qty( \frac{\int\dd{\vX}\psi^*\hat H\psi}{\int\dd{\vX}\abs{\psi}^2})\\
    &= \frac{\int\dd{\vX} \abs{\psi}^2 \qty[ \int\dd{\vX}
    \grad_{\valpha}(\psi^*)\hat H\psi +
    \psi^*\hat H\grad_{\valpha}(\psi)
    ]}{\qty(\int\dd{\vX}\abs{\psi}^2)^2}\\
    &\quad{ }\ -
    \frac{\qty(\int\dd{\vX}\psi^*\hat
    H\psi)\qty(\int\dd{\vX}\grad_{\valpha}(\abs{\psi}^2))}{\qty(\int\dd{\vX}\abs{\psi}^2)^2} \\
    &= \expval{\frac{\grad_{\valpha}(\psi^*)\hat H\psi + \psi^*\hat H\grad_{\valpha}(\psi)}{\abs{\psi}^2}}
    - \expval{\hat H}\expval{\frac{\grad_{\valpha}\abs{\psi}^2}{\abs{\psi}^2}},
\end{align}
where we have used the fact that $\hat H$ does not depend on $\valpha$ in any way.

To further simplify this, we use the trick $\flatfrac{\grad(f)}{f}=\grad(\ln
f)$, as well as the hermiticity of $\hat H$:
\begin{align}
    \grad_{\valpha}\expval{\hat H}
    &= \expval{\frac{\grad_{\valpha}(\psi^*)\hat H\psi + \grad_{\valpha}(\psi)(\hat H\psi)^*}{\abs{\psi}^2}}
    - \expval{\hat H}\expval{\frac{\grad_{\valpha}\abs{\psi}^2}{\abs{\psi}^2}}\\
    &= \expval{\grad_{\valpha}(\ln \psi^*) E_L + \grad_{\valpha}(\ln\psi)E_L^*}
    - 2\expval{\hat H}\expval{\grad_{\valpha}{\ln\abs{\psi}}}.
\end{align}
At this point, we are going to explicitly assume that the wave function is
real. We are not going to propose any complex trial wave functions in this
thesis, so this assumption will be valid for our purposes. The final expression then becomes (using $\expval{\hat H}=\expval{E_L}$):

\begin{align}
    \grad_{\valpha}\expval{\hat H}
    &= 2\qty[\expval{\grad_{\valpha}(\ln \psi) E_L}
    - \expval{E_L}\expval{\grad_{\valpha}{\ln\abs{\psi}}}].
    \label{eq:local-energy-gradient-alpha}
\end{align}
Computationally we already know how to evaluate $\expval{E_L}$, and we employ a completely analogous approach for the two other expectation values.
With this final piece of the puzzle we have everything we need in order to perform a \gls{vmc} calculation for the ground state of a system.

\end{document}