8 #ifndef ISOEX_IMPLICITGRID_HH
9 #define ISOEX_IMPLICITGRID_HH
14 #include <IsoEx/Grids/RegularGridT.hh>
15 #include <IsoEx/Implicits/Implicit.hh>
16 #include <OpenMesh/Core/Geometry/VectorT.hh>
38 template <
class Vec3 >
43 typedef typename Vec3::value_type real;
63 :
RegularGrid< Vec3 >(_origin, _x_axis, _y_axis, _z_axis, _x_res, _y_res, _z_res),
77 return (is_inside_cache_.empty() ? implicit_.is_inside(this->
point(_pidx)) : is_inside_cache_[_pidx]);
82 return (scalar_distance_cache_.empty() ? implicit_.scalar_distance(this->
point(_pidx)) : scalar_distance_cache_[_pidx]);
90 real& _distance)
const {
91 return implicit_.directed_distance(_p0, _p1, _point, _normal, _distance);
106 is_inside_cache_.clear();
107 is_inside_cache_.resize( this->
n_points());
110 is_inside_cache_[i] = implicit_.is_inside(this->point(i));
118 scalar_distance_cache_.clear();
119 scalar_distance_cache_.resize(np);
122 scalar_distance_cache_[i] = implicit_.scalar_distance(this->point(i));
133 mutable std::vector<bool> is_inside_cache_;
134 mutable std::vector<real> scalar_distance_cache_;
141 #endif // ISOEX_IMPLICITGRID_HH defined
virtual real scalar_distance(PointIdx _pidx) const
See IsoEx::Implicit::scalar_distance()
Definition: ImplicitGridT.hh:81
void build_is_inside_cache() const
Cache results of is_inside()
Definition: ImplicitGridT.hh:102
ImplicitGrid(const Implicit< Vec3 > &_implicit, const Vec3 &_origin, const Vec3 &_x_axis, const Vec3 &_y_axis, const Vec3 &_z_axis, unsigned int _x_res, unsigned int _y_res, unsigned int _z_res)
Default constructor.
Definition: ImplicitGridT.hh:55
Definition: ImplicitGridT.hh:39
virtual ~ImplicitGrid()
Destructor.
Definition: ImplicitGridT.hh:68
void build_scalar_distance_cache() const
Cache results of scalar_distance()
Definition: ImplicitGridT.hh:114
virtual bool directed_distance(const Vec3 &_p0, const Vec3 &_p1, Vec3 &_point, Vec3 &_normal, real &_distance) const
See IsoEx::Implicit::directed_distance()
Definition: ImplicitGridT.hh:86
unsigned int n_points() const
Return number of points.
Definition: RegularGridT.hh:115
Grid< Vec3 >::CubeIdx CubeIdx
CubeIdx can be used to refer to cubes.
Definition: ImplicitGridT.hh:46
virtual bool is_inside(PointIdx _pidx) const
See IsoEx::Implicit::is_inside()
Definition: ImplicitGridT.hh:76
Definition: Implicit.hh:57
A type for volume images, or 3D textures.
Vec3 point(PointIdx _idx) const
Return the 3D point refered to by _idx.
Definition: RegularGridT.cc:156
Grid< Vec3 >::PointIdx PointIdx
The grid points can be referred to by PointIdx.
Definition: ImplicitGridT.hh:49
Definition: RegularGridT.hh:56