33 #ifndef ISOEX_REGULARGRID_HH
34 #define ISOEX_REGULARGRID_HH
40 #include <IsoEx/Math/Matrix4x4T.hh>
41 #include <IsoEx/Config/IsoExDefines.hh>
55 template <
class Vec3 >
62 typedef typename Vec3::value_type real;
90 const Vec3& _x_axis = Vec3( 1, 0, 0 ),
91 const Vec3& _y_axis = Vec3( 0, 1, 0 ),
92 const Vec3& _z_axis = Vec3( 0, 0, 1 ),
93 unsigned int _x_res = 1,
94 unsigned int _y_res = 1,
95 unsigned int _z_res = 1 )
96 { initialize( _origin, _x_axis, _y_axis, _z_axis, _x_res, _y_res, _z_res ); }
99 void initialize(
const Vec3& _origin,
105 unsigned int _z_res );
112 unsigned int n_cubes()
const {
return n_cubes_; }
115 unsigned int n_points()
const {
return n_points_; }
118 PointIdx point_idx( CubeIdx _idx,
unsigned char _corner )
const;
121 Vec3 point( PointIdx _idx )
const;
124 Vec3 point(
int x,
int y,
int z )
const;
127 PointIdx nearest_point(
const Vec3 &_p );
129 const Vec3& origin()
const {
return origin_; }
130 const Vec3& x_axis()
const {
return x_axis_; }
131 const Vec3& y_axis()
const {
return y_axis_; }
132 const Vec3& z_axis()
const {
return z_axis_; }
133 const Vec3& dx()
const {
return dx_; }
134 const Vec3& dy()
const {
return dy_; }
135 const Vec3& dz()
const {
return dz_; }
137 unsigned int x_resolution()
const {
return x_res_; }
138 unsigned int y_resolution()
const {
return y_res_; }
139 unsigned int z_resolution()
const {
return z_res_; }
142 Vec3 to_local(
const Vec3 &_pw );
145 Vec3 to_world(
const Vec3 &_pl );
148 bool ray_intersect_local(
const Vec3 &_o,
const Vec3 &_d,
149 Vec3 &_entry, Vec3 &_exit );
152 real
volume() {
return this->x_axis().norm()*this->y_axis().norm()*this->z_axis().norm(); }
157 return ( this->x_axis().norm()*this->y_axis().norm()*2.0 +
158 this->y_axis().norm()*this->z_axis().norm()*2.0 +
159 this->x_axis().norm()*this->z_axis().norm()*2.0 );
168 Vec3 origin_, x_axis_, y_axis_, z_axis_, dx_, dy_, dz_;
169 unsigned int x_res_, y_res_, z_res_, n_cubes_, n_points_;
178 #if !defined(ISOEX_REGULAR_GRID_C)
179 #define ISOEX_REGULAR_GRID_TEMPLATES
180 #include "RegularGridT.cc"
183 #endif // ISOEX_REGULARGRID_HH defined
Grid< Vec3 >::CubeIdx CubeIdx
CubeIdx can be used to refer to cubes.
Definition: RegularGridT.hh:65
real volume()
returns the volume of the grid
Definition: RegularGridT.hh:152
virtual real outer_surface()
returns the outer surface of the grid
Definition: RegularGridT.hh:155
RegularGrid(const Vec3 &_origin=Vec3(0, 0, 0), const Vec3 &_x_axis=Vec3(1, 0, 0), const Vec3 &_y_axis=Vec3(0, 1, 0), const Vec3 &_z_axis=Vec3(0, 0, 1), unsigned int _x_res=1, unsigned int _y_res=1, unsigned int _z_res=1)
Definition: RegularGridT.hh:89
unsigned int n_points() const
Return number of points.
Definition: RegularGridT.hh:115
Definition: RegularGridT.hh:73
A type for volume images, or 3D textures.
unsigned int n_cubes() const
Return number of cubes.
Definition: RegularGridT.hh:112
Grid< Vec3 >::PointIdx PointIdx
The grid points can be referred to by PointIdx.
Definition: RegularGridT.hh:68
Definition: RegularGridT.hh:56