added a method for getting the center of a grid cell

This commit is contained in:
Paolo Cignoni 2009-07-14 08:55:20 +00:00
parent 67ce5b52ce
commit a5cb113561
1 changed files with 16 additions and 6 deletions

View File

@ -168,7 +168,17 @@ public:
b.max = (p + voxel); b.max = (p + voxel);
} }
// Same of above but for the case that you just want to transform /* Given a cell index return the center of the cell itself
* @param integer coordinates pi of the cell
* @return b is the corresponding box in <ScalarType> coordinates
*/inline void IPiToBoxCenter(const Point3i & pi, CoordType & c ) const
{
CoordType p;
IPiToPf(pi,p);
c = p + voxel/ScalarType(2.0);
}
// Same of IPiToPf but for the case that you just want to transform
// from a space to the other. // from a space to the other.
inline void IPfToPf(const CoordType & pi, CoordType &p ) const inline void IPfToPf(const CoordType & pi, CoordType &p ) const
{ {