#include <GridBase.h>
Public Member Functions | |
template<bool A1, bool A2, bool A3, bool A4> | |
BEGIN_NAMESPACE_CPT | GridBase (ads::Array< N, Number, A1 > *distance, ads::Array< N, Point, A2 > *gradientOfDistance, ads::Array< N, Point, A3 > *closestPoint, ads::Array< N, int, A4 > *closestFace) |
template<class Component> | |
std::pair< int, int > | computeClosestPointTransform (const std::vector< Index > &indices, const std::vector< Point > &positions, const Component &component, const Number maximumDistance) |
template<class Component> | |
std::pair< int, int > | computeClosestPointTransformUnsigned (const std::vector< Index > &indices, const std::vector< Point > &positions, const Component &component, const Number maximumDistance) |
template<class Component> | |
std::pair< int, int > | computeClosestPointTransform (const Lattice &lattice, const Range &indexRangeInLattice, const Component &component, const Number maximumDistance) |
template<class Component> | |
std::pair< int, int > | computeClosestPointTransformUnsigned (const Lattice &lattice, const Range &indexRangeInLattice, const Component &component, const Number maximumDistance) |
Accessors. | |
const Index & | getExtents () const |
Return the grid extents. | |
const Range & | getRanges () const |
Return the grid ranges. | |
bool | isEmpty () const |
Return true if the grids are empty. | |
const ads::Array< N, Number, false > & | getDistance () const |
Return a const reference to the distance grid. | |
const ads::Array< N, Point, false > & | getGradientOfDistance () const |
Return a const reference to the gradient of the distance grid. | |
const ads::Array< N, Point, false > & | getClosestPoint () const |
Return a const reference to the closest point grid. | |
const ads::Array< N, int, false > & | getClosestFace () const |
Return a const reference to the closest face grid. | |
bool | isGradientOfDistanceBeingComputed () const |
Is the gradient of the distance being computed? | |
bool | isClosestPointBeingComputed () const |
Is the closest point being computed? | |
bool | isClosestFaceBeingComputed () const |
Is the closest face being computed? | |
Manipulators. | |
ads::Array< N, Number, false > & | getDistance () |
Return a reference to the distance grid. | |
ads::Array< N, Point, false > & | getGradientOfDistance () |
Return a reference to the gradient of the distance grid. | |
ads::Array< N, Point, false > & | getClosestPoint () |
Return a reference to the closest point grid. | |
ads::Array< N, int, false > & | getClosestFace () |
Return a reference to the closest face grid. | |
Mathematical operations. | |
template<class Component> | |
std::pair< int, int > | computeClosestPointTransform (const std::vector< Index > &indices, const std::vector< Point > &positions, const Component &component, Number maximumDistance) |
Calculate the signed distance, closest point, etc. for the specified grid points. | |
template<class Component> | |
std::pair< int, int > | computeClosestPointTransformUnsigned (const std::vector< Index > &indices, const std::vector< Point > &positions, const Component &component, Number maximumDistance) |
Calculate the unsigned distance, closest point, etc. for the specified grid points. | |
template<class Component> | |
std::pair< int, int > | computeClosestPointTransform (const Lattice &lattice, const Range &indexRangeInLattice, const Component &component, Number maximumDistance) |
Calculate the signed distance, closest point, etc. for the specified grid points. | |
template<class Component> | |
std::pair< int, int > | computeClosestPointTransformUnsigned (const Lattice &lattice, const Range &indexRangeInLattice, const Component &component, Number maximumDistance) |
Calculate the unsigned distance, closest point, etc. for the specified grid points. | |
void | initialize () |
Initialize the grids. | |
bool | floodFillUnsigned (const Number farAway) |
Flood fill the unsigned distance. | |
File I/O. | |
void | put (std::ostream &out) const |
void | displayInformation (std::ostream &out) const |
int | countKnownDistances (const Number maximumDistance) const |
void | computeMinimumAndMaximumDistances (const Number maximumDistance, Number *minimum, Number *maximum) const |
Protected Types | |
typedef T | Number |
The number type. | |
typedef ads::FixedArray< N, Number > | Point |
A point in N-D. | |
typedef ArrayInt::index_type | Index |
A multi-index in N-D. | |
typedef ArrayInt::range_type | Range |
A multi-index range in N-D. | |
typedef geom::RegularGrid< N, Number > | Lattice |
A lattice. | |
Protected Member Functions | |
Constructors, etc. | |
GridBase () | |
Default constructor. Empty arrays. | |
GridBase (const GridBase &other) | |
Copy constructor. Reference the arrays. | |
template<bool A1, bool A2, bool A3, bool A4> | |
GridBase (ads::Array< N, Number, A1 > *distance, ads::Array< N, Point, A2 > *gradientOfDistance, ads::Array< N, Point, A3 > *closestPoint, ads::Array< N, int, A4 > *closestFace) | |
Construct from the grids. | |
~GridBase () | |
Destructor. Does not free grid memory. | |
GridBase & | operator= (const GridBase &other) |
Assignment operator. | |
Related Functions | |
(Note that these are not member functions.) | |
bool | operator== (const cpt::GridBase< N, T > &a, const cpt::GridBase< N, T > &b) |
Return true if the grids are equal. | |
bool | operator!= (const cpt::GridBase< N, T > &a, const cpt::GridBase< N, T > &b) |
Return true if the grids are not equal. |
Implements common functionality for grids of different dimensions. Stores the distance, gradient of distance, closest point, and closest face arrays.
std::pair<int,int> cpt::GridBase< N, T >::computeClosestPointTransform | ( | const Lattice & | lattice, | |
const Range & | indexRangeInLattice, | |||
const Component & | component, | |||
Number | maximumDistance | |||
) |
Calculate the signed distance, closest point, etc. for the specified grid points.
In computing distances, use the versions that check with the characteristics of the component.
std::pair<int,int> cpt::GridBase< N, T >::computeClosestPointTransform | ( | const std::vector< Index > & | indices, | |
const std::vector< Point > & | positions, | |||
const Component & | component, | |||
Number | maximumDistance | |||
) |
Calculate the signed distance, closest point, etc. for the specified grid points.
std::pair<int,int> cpt::GridBase< N, T >::computeClosestPointTransformUnsigned | ( | const Lattice & | lattice, | |
const Range & | indexRangeInLattice, | |||
const Component & | component, | |||
Number | maximumDistance | |||
) |
Calculate the unsigned distance, closest point, etc. for the specified grid points.
In computing distances, use the versions that check with the characteristics of the component.
bool cpt::GridBase< N, T >::floodFillUnsigned | ( | const Number | farAway | ) |
Flood fill the unsigned distance.
If there are any points with known distance then return true and set the unknown distances to farAway. Otherwise set all the distances to farAway and return false.
void cpt::GridBase< N, T >::initialize | ( | ) |
Initialize the grids.
Set all the distances to std::numeric_limits<Number>::max()
in preparation for the distance to be computed. Set the gradient of the distance and the closest points to std::numeric_limits<Number>::max(). Set the closest faces to -1.