added a method for getting the center of a grid cell
This commit is contained in:
parent
67ce5b52ce
commit
a5cb113561
|
@ -158,17 +158,27 @@ public:
|
||||||
* @return b is the corresponding box in <ScalarType> coordinates
|
* @return b is the corresponding box in <ScalarType> coordinates
|
||||||
*/
|
*/
|
||||||
inline void IPiToBox(const Point3i & pi, Box3x & b ) const
|
inline void IPiToBox(const Point3i & pi, Box3x & b ) const
|
||||||
{
|
{
|
||||||
CoordType p;
|
CoordType p;
|
||||||
p[0] = ((ScalarType)pi[0])*voxel[0];
|
p[0] = ((ScalarType)pi[0])*voxel[0];
|
||||||
p[1] = ((ScalarType)pi[1])*voxel[1];
|
p[1] = ((ScalarType)pi[1])*voxel[1];
|
||||||
p[2] = ((ScalarType)pi[2])*voxel[2];
|
p[2] = ((ScalarType)pi[2])*voxel[2];
|
||||||
p += bbox.min;
|
p += bbox.min;
|
||||||
b.min = p;
|
b.min = p;
|
||||||
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
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue