cpt::State< 2, T > Class Template Reference

Hold the state for a 2-D closest point transform. More...

Inheritance diagram for cpt::State< 2, T >:
Inheritance graph
[legend]
Collaboration diagram for cpt::State< 2, T >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef Base::Number Number
 The number type.
typedef Base::Point Point
 A point in 2-D.
typedef Base::IndexedFace IndexedFace
 An indexed face in 2-D.
typedef Base::SizeList SizeList
 An extent in 2-D.
typedef Base::IndexList IndexList
 An index in 2-D.
typedef Base::Range Range
 An index range in 2-D.
typedef Base::BBox BBox
 A bounding box.
typedef Base::Lattice Lattice
 The grid geometry.
typedef Base::Grid Grid
 The grid.
typedef Base::BRep BRep
 The b-rep.

Public Member Functions

Constructors, etc.



 State ()
 Default constructor.
 ~State ()
 Destructor.
Manipulators.



void setParameters (const BBox &domain, const Number maximumDistance, const bool areUsingLocalClipping=false, const std::size_t globalClippingMethod=0, const std::size_t decimationFactor=1)
 Set parameters for the closest point transform.
void setParameters (const Number *domainLowerData, const Number *domainUpperData, const Number maximumDistance, const bool areUsingLocalClipping=false, const std::size_t globalClippingMethod=0, const std::size_t decimationFactor=1)
 Set parameters for the closest point transform.
std::pair< std::size_t,
std::size_t > 
computeClosestPointTransform ()
 Compute the closest point transform.
std::pair< std::size_t,
std::size_t > 
computeClosestPointTransformUnsigned ()
 Compute the closest point transform.
Inside/outside.



std::pair< std::size_t,
std::size_t > 
determinePointsInside (const BBox &domain, array::MultiArrayRef< bool, 2 > *areInside, array::MultiArrayRef< Number, 2 > *distance)
 Determine which grid points are inside the solid (non-positive distance).
std::pair< std::size_t,
std::size_t > 
determinePointsInside (const Point &lower, const Point &upper, const SizeList &extents, bool *areInside, Number *distance)
 Wrapper for the above function.
std::pair< std::size_t,
std::size_t > 
determinePointsInside (const BBox &domain, array::MultiArrayRef< bool, 2 > *areInside)
 Determine which grid points are inside the solid (non-positive distance).
std::pair< std::size_t,
std::size_t > 
determinePointsInside (const Point &lower, const Point &upper, const SizeList &extents, bool *areInside)
 Wrapper for the above function.
std::pair< std::size_t,
std::size_t > 
determinePointsOutside (const BBox &domain, array::MultiArrayRef< bool, 2 > *areOutside, array::MultiArrayRef< Number, 2 > *distance)
 Determine which grid points are outside the solid (positive distance).
std::pair< std::size_t,
std::size_t > 
determinePointsOutside (const Point &lower, const Point &upper, const SizeList &extents, bool *areOutside, Number *distance)
 Wrapper for the above function.
std::pair< std::size_t,
std::size_t > 
determinePointsOutside (const BBox &domain, array::MultiArrayRef< bool, 2 > *areOutside)
 Determine which grid points are outside the solid (positive distance).
std::pair< std::size_t,
std::size_t > 
determinePointsOutside (const Point &lower, const Point &upper, const SizeList &extents, bool *areOutside)
 Wrapper for the above function.
I/O.



void displayInformation (std::ostream &out)
 Display information about the state of the closest point transform.

Detailed Description

template<typename T>
class cpt::State< 2, T >

Hold the state for a 2-D closest point transform.

Most of the functionality is dimension independent and is thus implemented in the base class cpt::StateBase.

To perform the closest point transform, you must call:

  1. setParameters() to specify the Cartesian domain of interest and how far to compute the distance. Note that the computational complexity of the alorithm is proportional to this maximum distance. (The number of grid points for which the distance is computed is proportional to the maximum distance.) If performance is an issue, make sure that the maximumDistance parameter is no larger than needed.
  2. cpt::StateBase<N,T>::setLattice() to specify the lattice on which the grids lie.
  3. cpt::StateBase<N,T>::insertGrid() for each grid on the lattice. Here you specify arrays that hold the distance, and optionally the gradient of distance, closest point and closest face fields. cpt::StateBase<N,T>::setLattice() must be called before any calls to cpt::StateBase<N,T>::insertGrid().
  4. cpt::StateBase<N,T>::setBRep() or cpt::StateBase<N,T>::setBRepWithNoClipping() to specify the surface. The triangle surface is a boundary representation, b-rep, of the volume that is inside the surface. setParameters() must be called before calling cpt::StateBase<N,T>::setBRep().
  5. computeClosestPointTransform() to compute the the CPT on the specified grids.

To compute the CPT for a new b-rep, call:

  1. cpt::StateBase<N,T>::setBRep().
  2. computeClosestPointTransform().

To compute the CPT for a different set of grids, call the following:

  1. cpt::StateBase<N,T>::clear_grids() to clear the old grids.
  2. cpt::StateBase<N,T>::setLattice() if the lattice has changed.
  3. cpt::StateBase<N,T>::insertGrid() for each new grid on the lattice.
  4. computeClosestPointTransform().

For AMR grids, one must follow these steps for each each level of the AMR grid. (Each level of the AMR grid is a separate lattice.)


Member Function Documentation

template<typename T >
std::pair< std::size_t, std::size_t > cpt::State< 2, T >::computeClosestPointTransform (  )  [inline]

Compute the closest point transform.

Compute the signed distance. Compute the gradient of the distance, the closest face and closest point if their arrays specified in insertGrid() are nonzero.

The algorithm uses polygon scan conversion to determine which grid points are close to the shapes comprising the surface.

The unknown distances, gradients, and closest points are set to std::numeric_limits<Number>::max(). The unknown closest faces are set to std::numeric_limits<std::size_t>::max().

template<typename T >
std::pair< std::size_t, std::size_t > cpt::State< 2, T >::computeClosestPointTransformUnsigned (  )  [inline]

Compute the closest point transform.

Compute the unsigned distance. Compute the gradient of the distance, the closest face and closest point if their arrays specified in insertGrid() are nonzero.

The algorithm uses polygon scan conversion to determine which grid points are close to the shapes comprising the surface.

The unknown distances, gradients, and closest points are set to std::numeric_limits<Number>::max(). The unknown closest faces are set to std::numeric_limits<std::size_t>::max().

template<typename T >
std::pair< std::size_t, std::size_t > cpt::State< 2, T >::determinePointsInside ( const Point lower,
const Point upper,
const SizeList extents,
bool *  areInside 
) [inline]

Wrapper for the above function.

Parameters:
lower The lower corner of the Cartesian domain.
upper The upper corner of the Cartesian domain.
extents The array extents.
areInside Boolean array is set to whether each grid point is inside the solid.
template<typename T >
std::pair<std::size_t, std::size_t> cpt::State< 2, T >::determinePointsInside ( const BBox domain,
array::MultiArrayRef< bool, 2 > *  areInside 
) [inline]

Determine which grid points are inside the solid (non-positive distance).

Use this interface if you only determine which points are inside one time. This function allocates a distance array and calls the function above.

template<typename T >
std::pair< std::size_t, std::size_t > cpt::State< 2, T >::determinePointsInside ( const Point lower,
const Point upper,
const SizeList extents,
bool *  areInside,
Number distance 
) [inline]

Wrapper for the above function.

Parameters:
lower The lower corner of the Cartesian domain.
upper The upper corner of the Cartesian domain.
extents The array extents.
areInside Boolean array is set to whether each grid point is inside the solid.
distance Number array that is used in the computation.
template<typename T >
std::pair< std::size_t, std::size_t > cpt::State< 2, T >::determinePointsInside ( const BBox domain,
array::MultiArrayRef< bool, 2 > *  areInside,
array::MultiArrayRef< Number, 2 > *  distance 
) [inline]

Determine which grid points are inside the solid (non-positive distance).

Use this interface if you repeatedly determine which points are inside. The distance array is needed for determining the sign of the distance. With this interface, the distance array is not allocated anew for each function call.

References geom::Interval< N, T >::getLowerCorner(), and max().

template<typename T >
std::pair< std::size_t, std::size_t > cpt::State< 2, T >::determinePointsOutside ( const Point lower,
const Point upper,
const SizeList extents,
bool *  areOutside 
) [inline]

Wrapper for the above function.

Parameters:
lower The lower corner of the Cartesian domain.
upper The upper corner of the Cartesian domain.
extents The array extents.
areOutside Boolean array is set to whether each grid point is outside the solid.
template<typename T >
std::pair<std::size_t, std::size_t> cpt::State< 2, T >::determinePointsOutside ( const BBox domain,
array::MultiArrayRef< bool, 2 > *  areOutside 
) [inline]

Determine which grid points are outside the solid (positive distance).

Use this interface if you only determine which points are outside one time. This function allocates a distance array and calls the function above.

template<typename T >
std::pair< std::size_t, std::size_t > cpt::State< 2, T >::determinePointsOutside ( const Point lower,
const Point upper,
const SizeList extents,
bool *  areOutside,
Number distance 
) [inline]

Wrapper for the above function.

Parameters:
lower The lower corner of the Cartesian domain.
upper The upper corner of the Cartesian domain.
extents The array extents.
areOutside Boolean array is set to whether each grid point is outside the solid.
distance Number array that is used in the computation.
template<typename T >
std::pair<std::size_t, std::size_t> cpt::State< 2, T >::determinePointsOutside ( const BBox domain,
array::MultiArrayRef< bool, 2 > *  areOutside,
array::MultiArrayRef< Number, 2 > *  distance 
) [inline]

Determine which grid points are outside the solid (positive distance).

Use this interface if you repeatedly determine which points are outside. The distance array is needed for determining the sign of the distance. With this interface, the distance array is not allocated anew for each function call.

template<typename T >
void cpt::State< 2, T >::setParameters ( const Number domainLowerData,
const Number domainUpperData,
const Number  maximumDistance,
const bool  areUsingLocalClipping = false,
const std::size_t  globalClippingMethod = 0,
const std::size_t  decimationFactor = 1 
) [inline]

Set parameters for the closest point transform.

This function must be called at least once before calls to setBRep() or computeClosestPointTransform().

Parameters:
domainLower The lower corner of the Cartesian domain that contains all grids. (All grids on all lattices.) This domain (expanded by the max distance) will be used to clip the b-rep in any subsequent calls to setBRep().
domainUpper The upper corner of the Cartesian domain that contains all grids.
maximumDistance The distance will be computed up to maximumDistance away from the curve.
areUsingLocalClipping indicates if adjacent faces should be used to clip the characteristic face polygons.
globalClippingMethod indicates if/how a decimated mesh should be used to clip the characteristic polyhedra. 0 corresponds to no global clipping; 1 corresponds to limited global clipping; 2 corresponds to full global clipping.
decimationFactor is the factor used to decimate the mesh for use in global clipping.

The distance for grid points whose distance is larger than maximumDistance will be set to std::numeric_limits<Number>::max(). Each component of the closest point of these far away points will be set to std::numeric_limits<Number>::max(). The closest face of far away points will be set to std::numeric_limits<std::size_t>::max().

template<typename T >
void cpt::State< 2, T >::setParameters ( const BBox domain,
const Number  maximumDistance,
const bool  areUsingLocalClipping = false,
const std::size_t  globalClippingMethod = 0,
const std::size_t  decimationFactor = 1 
) [inline]

Set parameters for the closest point transform.

This function must be called at least once before calls to setBRep() or computeClosestPointTransform().

Parameters:
domain is the Cartesian domain that contains all grids. (All grids on all lattices.) This domain (expanded by the max distance) will be used to clip the b-rep in any subsequent calls to setBRep().
maximumDistance The distance will be computed up to maximumDistance away from the curve.
areUsingLocalClipping indicates if adjacent faces should be used to clip the characteristic face polygons.
globalClippingMethod indicates if/how a decimated mesh should be used to clip the characteristic polyhedra. 0 corresponds to no global clipping; 1 corresponds to limited global clipping; 2 corresponds to full global clipping.
decimationFactor is the factor used to decimate the mesh for use in global clipping.

The distance for grid points whose distance is larger than maximumDistance will be set to std::numeric_limits<Number>::max(). Each component of the closest point of these far away points will be set to std::numeric_limits<Number>::max(). The closest face of far away points will be set to std::numeric_limits<std::size_t>::max().


The documentation for this class was generated from the following file:

STLib Home / http://www.its.caltech.edu/~sean/ / at(sean, dot(caltech, edu))