.. _manipulation:

####################
Surface Manipulation
####################

Spicoli manipulates surfaces through the following two primary
mechanisms:

* :ref:`Cliques <manipulation_cliques>`
* :ref:`Grids <manipulation_grids>`

.. _manipulation_cliques:

********
Cliques
********

A clique is an integral value associated with portions of the surface.
They can be arbitrarily assigned in order to create groupings of
vertices. Cliques in Spicoli are unsigned ints that can be associated
with every vertex of the surface. Spicoli treats the zero clique as a
special ``NULL`` clique. Therefore, the user should not use zero for
performing any clique operations on the surface.

Cliques in Spicoli are collections of vertices. However, an ambiguity
occurs when performing triangle-based operations on these cliques.
Spicoli will automatically resolve vertex cliques into triangle
cliques using the following rule: if two or more vertices in the
triangle have the same clique value, the triangle is assigned that
clique value; otherwise, if every vertex of the triangle has a
different clique value then the triangle is arbitrarily assigned the
lowest clique value of the three vertices.


.. seealso:: 

   * :oe:func:`OESpicoli::OESurfaceCropToClique`
   * :oe:func:`OESpicoli::OEMakeCliqueSurface`
   * :oe:func:`OESpicoli::OEMakeConnectedSurfaceCliques`
   * :oe:func:`OESpicoli::OESurfaceCliqueArea`
   * :oe:func:`OESpicoli::OESurfaceCliqueVolume`

.. _manipulation_grids:

*********
Grids
*********

Spicoli can construct grids from surfaces. Grid values are assigned
using the distance to the nearest surface vertex to the grid point.
This makes grid construction very expensive because every grid point
must be compared to every surface vertex.
The :oe:constns:`OESpicoli::OEVoxelizeMethod` namespace describes the
available methods.

.. seealso::

   * :oe:func:`OESpicoli::OEMakeGridFromSurface`
   * :oe:func:`OESpicoli::OEMakeSurfaceFromGrid`
