Hold the state for a closest point transform. More...
#include <StateBase.h>


Public Member Functions | |
Constructors, etc. | |
| StateBase () | |
| Default constructor. | |
| ~StateBase () | |
| Destructor. | |
Accessors. | |
| std::size_t | getNumberOfGrids () const |
| Return the number of grids. | |
| const Grid & | getGrid (const std::size_t n) const |
| Get the specified grid. | |
| bool | hasBRepBeenSet () const |
| Return true if the b-rep has been set. | |
| const BBox & | getDomain () const |
| Return the domain that contains all grids. | |
| Number | getMaximumDistance () const |
| Return how far the distance is being computed. | |
Manipulators. | |
| void | setParameters (const BBox &domain, Number maximumDistance) |
| Set the parameters for the Closest Point Transform. | |
| void | setParameters (const Number *domainLowerData, const Number *domainUpperData, const Number maximumDistance) |
| Set parameters for the closest point transform. | |
| void | setParameters (const Number maximumDistance) |
| Set the parameters for the Closest Point Transform. | |
| void | setLattice (const SizeList &extents, const BBox &domain) |
| Set the grid geometry. | |
| void | setLattice (const int *extentsData, const Number *lowerData, const Number *upperData) |
| Set the lattice geometry. | |
| void | insertGrid (const SizeList &extents, const IndexList &bases, bool useGradientOfDistance, bool useClosestPoint, bool useClosestFace) |
| Add a grid for the Closest Point Transform. | |
| void | insertGrid (const SizeList &extents, const IndexList &bases, Number *distance, Number *gradientOfDistance, Number *closestPoint, int *closestFace) |
| Add a grid for the Closest Point Transform. | |
| void | insertGrid (const int *lowerBounds, const int *upperBounds, Number *distance, Number *gradientOfDistance, Number *closestPoint, int *closestFace) |
| Add a grid for the Closest Point Transform. | |
| void | clearGrids () |
| Clear the grids. | |
| std::pair< std::size_t, std::size_t > | computeClosestPointTransformUsingBBox () |
| Compute the closest point transform for signed distance. | |
| std::pair< std::size_t, std::size_t > | computeClosestPointTransformUsingBruteForce () |
| Compute the closest point transform for signed distance. | |
| std::pair< std::size_t, std::size_t > | computeClosestPointTransformUsingTree () |
| Compute the closest point transform for signed distance. | |
| std::pair< std::size_t, std::size_t > | computeClosestPointTransformUnsignedUsingBBox () |
| Compute the closest point transform for unsigned distance. | |
| std::pair< std::size_t, std::size_t > | computeClosestPointTransformUnsignedUsingBruteForce () |
| Compute the closest point transform for unsigned distance. | |
| void | floodFillAtBoundary (Number farAway) |
| Flood fill the distance. | |
| void | floodFillDetermineSign (Number farAway) |
| Flood fill the distance. | |
| void | floodFillUnsigned (Number farAway) |
| Flood fill the unsigned distance. | |
| bool | areGridsValid () |
| Check the grids. | |
| bool | areGridsValidUnsigned () |
| Check the grids. | |
| void | setBRepWithNoClipping (const std::vector< std::tr1::array< Number, N > > &vertices, const std::vector< std::tr1::array< std::size_t, N > > &faces) |
| Set the b-rep. | |
| void | setBRepWithNoClipping (std::size_t numVertices, const Number *vertices, std::size_t numFaces, const int *faces) |
| Wrapper for the above function. | |
| void | setBRep (const std::vector< std::tr1::array< Number, N > > &vertices, const std::vector< std::tr1::array< std::size_t, N > > &faces) |
| Set the b-rep. | |
| void | setBRep (std::size_t numVertices, const Number *vertices, std::size_t numFaces, const int *faces) |
| Wrapper for the above function. | |
I/O. | |
| void | displayInformation (std::ostream &out) const |
| Display information about the state of the closest point transform. | |
Protected Types | |
| typedef T | Number |
| The number type. | |
| typedef geom::BBox< N, Number > | BBox |
| A bounding box. | |
| typedef geom::RegularGrid< N, T > | Lattice |
| The lattice defines a domain and index extents. | |
| typedef cpt::Grid< N, T > | Grid |
| The grid. | |
| typedef cpt::BRep< N, T > | BRep |
| The b-rep. | |
| typedef Grid::Point | Point |
| A point in N-D. | |
| typedef Grid::SizeList | SizeList |
| An extent in N-D. | |
| typedef Grid::IndexList | IndexList |
| A multi-index in N-D. | |
| typedef Grid::IndexList | IndexedFace |
| The indices of a face. | |
| typedef Grid::Index | Index |
| A single index. | |
| typedef Grid::Range | Range |
| A multi-index range in N-D. | |
Protected Member Functions | |
Grid operations. | |
| void | initializeGrids () |
| Initialize the grids. | |
Protected Attributes | |
| bool | _hasBRepBeenSet |
| Has the b-rep been set. | |
| bool | _hasCptBeenComputed |
| Has the CPT been computed. | |
| BBox | _domain |
| The domain containing all grids for which the CPT will be computed. | |
| Number | _maximumDistance |
| How far (in Cartesian space) to compute the distance. | |
| Lattice | _lattice |
| The lattice. | |
| std::vector< Grid > | _grids |
| The grids. | |
| BRep | _brep |
| The b-rep. | |
Hold the state for a closest point transform.
Implements the dimension-independent functionality.
| bool cpt::StateBase< N, T >::areGridsValid | ( | ) |
Check the grids.
Verify that the distance grids are valid. The known distances should be between +-maximumDistance. The difference between adjacent grid points should not be more than the grid spacing. Verify that the closest point and closest face grids are valid. Return true if the grids are valid. Return false and print a message to stderr otherwise.
| bool cpt::StateBase< N, T >::areGridsValidUnsigned | ( | ) |
Check the grids.
Verify that the distance grids are valid. The known distances should be between 0 and maximumDistance. The difference between adjacent grid points should not be more than the grid spacing. Verify that the closest point and closest face grids are valid. Return true if the grids are valid. Return false and print a message to stderr otherwise.
| void cpt::StateBase< N, T >::clearGrids | ( | ) | [inline] |
Clear the grids.
If the grids change, call this function and then add all the new grids with insertGrid().
| std::pair<std::size_t, std::size_t> cpt::StateBase< N, T >::computeClosestPointTransformUnsignedUsingBBox | ( | ) |
Compute the closest point transform for unsigned distance.
Compute the unsigned distance. Compute the gradient of the distance, the closest face and closest point if their arrays specified in insertGrid() are nonzero.
This algorithm does not use polyhedron scan conversion. Instead, it builds bounding boxes around the characteristic polyhedra.
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().
| std::pair<std::size_t, std::size_t> cpt::StateBase< N, T >::computeClosestPointTransformUnsignedUsingBruteForce | ( | ) |
Compute the closest point transform for unsigned distance.
Compute the unsigned distance. Compute the gradient of the distance, the closest face and closest point if their arrays specified in insertGrid() are nonzero.
This algorithm does not use polyhedron scan conversion or the characteristic polyhedra. Instead, it builds bounding boxes around the faces, edges and vertices.
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().
| std::pair<std::size_t, std::size_t> cpt::StateBase< N, T >::computeClosestPointTransformUsingBBox | ( | ) |
Compute the closest point transform for signed distance.
Compute the signed distance. Compute the gradient of the distance, the closest face and closest point if their arrays specified in insertGrid() are nonzero.
This algorithm does not use polyhedron scan conversion. Instead, it builds bounding boxes around the characteristic polyhedra.
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().
| std::pair<std::size_t, std::size_t> cpt::StateBase< N, T >::computeClosestPointTransformUsingBruteForce | ( | ) |
Compute the closest point transform for signed distance.
Compute the signed distance. Compute the gradient of the distance, the closest face and closest point if their arrays specified in insertGrid() are nonzero.
This algorithm does not use polyhedron scan conversion or the characteristic polyhedra. Instead, it builds bounding boxes around the faces, edges and vertices.
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().
| std::pair<std::size_t, std::size_t> cpt::StateBase< N, T >::computeClosestPointTransformUsingTree | ( | ) |
Compute the closest point transform for signed distance.
Compute the signed distance. Compute the gradient of the distance, the closest face and closest point if their arrays specified in insertGrid() are nonzero.
This algorithm uses a bounding box tree to store the mesh and a lower-upper-bound queries to determine the distance.
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().
| void cpt::StateBase< N, T >::floodFillAtBoundary | ( | Number | farAway | ) |
Flood fill the distance.
This function is used to prepare the distance for visualization. The signed distance is flood filled. If any of the distances are known in a particular grid, set the unknown distances to +-farAway. If no distances are known, set all distances to +farAway. Thus note that if no points in a particular grid have known distance, then the sign of the distance is not determined.
| void cpt::StateBase< N, T >::floodFillDetermineSign | ( | Number | farAway | ) |
Flood fill the distance.
This function is used to prepare the distance for visualization. The signed distance is flood filled. If any of the distances are known in a particular grid, set the unknown distances to +-farAway. If no distances are known, determine the correct sign by computing the signed distance to the boundary for a single point in the grid.
| void cpt::StateBase< N, T >::floodFillUnsigned | ( | Number | farAway | ) |
Flood fill the unsigned distance.
The unsigned distance is flood filled. Unknown distances are set to farAway.
| void cpt::StateBase< N, T >::insertGrid | ( | const int * | lowerBounds, | |
| const int * | upperBounds, | |||
| Number * | distance, | |||
| Number * | gradientOfDistance, | |||
| Number * | closestPoint, | |||
| int * | closestFace | |||
| ) | [inline] |
Add a grid for the Closest Point Transform.
This is a wrapper for the above insertGrid function().
| void cpt::StateBase< N, T >::insertGrid | ( | const SizeList & | extents, | |
| const IndexList & | bases, | |||
| Number * | distance, | |||
| Number * | gradientOfDistance, | |||
| Number * | closestPoint, | |||
| int * | closestFace | |||
| ) |
Add a grid for the Closest Point Transform.
| extents | The array extents. | |
| bases | The index bases for the arrays. For each of the gradientOfDistance, closestPoint and closestFace arrays: if the pointer is non-zero, that quantity will be computed. | |
| distance | Pointer to the distance array. | |
| gradientOfDistance | Pointer to the gradient of distance array. | |
| closestPoint | Pointer to the closest point array. | |
| closestFace | Pointer to the closest face array. |
| void cpt::StateBase< N, T >::insertGrid | ( | const SizeList & | extents, | |
| const IndexList & | bases, | |||
| bool | useGradientOfDistance, | |||
| bool | useClosestPoint, | |||
| bool | useClosestFace | |||
| ) |
Add a grid for the Closest Point Transform.
This function must be called at least once before calls to computeClosestPointTransform().
| extents | The array extents. | |
| bases | The index bases for the arrays. | |
| useGradientOfDistance | Whether to compute the gradient of the distance. The gradient of the distance is computed from the geometric primitives and not by differencing the distance array. Thus it is accurate to within machine precision. | |
| useClosestPoint | Whether to compute the closest points. | |
| useClosestFace | Whether to compute the closet face on the mesh. |
Referenced by cpt::StateBase< 2, T >::insertGrid().
| void cpt::StateBase< N, T >::setBRep | ( | const std::vector< std::tr1::array< Number, N > > & | vertices, | |
| const std::vector< std::tr1::array< std::size_t, N > > & | faces | |||
| ) |
Set the b-rep.
Clip the mesh to use only points that affect the cartesian domain.
Either this function or setBRepWithNoClipping() must be called at least once before calls to computeClosestPointTransform(). This version is more efficient if the b-rep extends beyond the domain spanned by the grid.
| vertices | are the locations of the vertices. | |
| faces | is a vector of tuples of vertex indices that describe the faces. |
| void cpt::StateBase< N, T >::setBRepWithNoClipping | ( | const std::vector< std::tr1::array< Number, N > > & | vertices, | |
| const std::vector< std::tr1::array< std::size_t, N > > & | faces | |||
| ) |
Set the b-rep.
Do not use the Cartesian domain to clip the mesh.
Either this function or setBRep() must be called at least once before calls to computeClosestPointTransform().
| vertices | are the locations of the vertices. | |
| faces | is a vector of tuples of vertex indices that describe the faces. |
| void cpt::StateBase< N, T >::setLattice | ( | const int * | extentsData, | |
| const Number * | lowerData, | |||
| const Number * | upperData | |||
| ) | [inline] |
Set the lattice geometry.
This is a wrapper for the above setLattice function().
| void cpt::StateBase< N, T >::setLattice | ( | const SizeList & | extents, | |
| const BBox & | domain | |||
| ) |
Set the grid geometry.
| extents | are the grid geometry extents. | |
| domain | is the grid geometry domain. |
Referenced by cpt::StateBase< 2, T >::setLattice().
| void cpt::StateBase< N, T >::setParameters | ( | const Number | maximumDistance | ) | [inline] |
Set the parameters for the Closest Point Transform.
This calls the first setParameters() function. The domain containing all grids is set to all space. This means that clipping the mesh will have no effect.
| void cpt::StateBase< N, T >::setParameters | ( | const Number * | domainLowerData, | |
| const Number * | domainUpperData, | |||
| const Number | maximumDistance | |||
| ) | [inline] |
Set parameters for the closest point transform.
This is a wrapper for the above setParameters function.
| void cpt::StateBase< N, T >::setParameters | ( | const BBox & | domain, | |
| Number | maximumDistance | |||
| ) |
Set the parameters for the Closest Point Transform.
This function must be called at least once before calls to computeClosestPointTransform().
| domain | is the Cartesian domain that contains all grids. | |
| maximumDistance | The distance will be computed up to maximumDistance away from the surface. |
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().
Referenced by cpt::StateBase< 2, T >::setParameters().
BBox cpt::StateBase< N, T >::_domain [protected] |
The domain containing all grids for which the CPT will be computed.
This may be used in clipping the mesh.
Referenced by cpt::StateBase< 2, T >::getDomain().