13 #ifndef ACG_VECTORFIELDT_HH
14 #define ACG_VECTORFIELDT_HH
19 #include <OpenMesh/Core/Geometry/VectorT.hh>
21 #include "RegularGrid.hh"
42 template <
typename Scalar,
int Dim>
47 typedef OpenMesh::VectorT<Scalar, Dim> Vector;
51 const Vec3& _x_axis = Vec3( 1, 0, 0 ),
52 const Vec3& _y_axis = Vec3( 0, 1, 0 ),
53 const Vec3& _z_axis = Vec3( 0, 0, 1 ),
54 unsigned int _x_res = 10,
55 unsigned int _y_res = 10,
56 unsigned int _z_res = 10 )
58 initialize( _origin, _x_axis, _y_axis, _z_axis, _x_res, _y_res, _z_res );
75 _x_res, _y_res, _z_res );
77 for (
int i = 0; i < vec.dim(); ++i ) vec[i] = 0.0;
78 values_.resize( _x_res*_y_res*_z_res, vec );
82 virtual real scalar_distance(
PointIdx )
const
87 virtual bool is_inside(
PointIdx )
const
103 Vector&
operator()(
unsigned int x,
unsigned int y,
unsigned int z )
105 return values_[x + y*x_resolution() + z*x_resolution()*y_resolution()];
108 Vector
operator()(
unsigned int x,
unsigned int y,
unsigned int z )
const
110 return values_[x + y*x_resolution() + z*x_resolution()*y_resolution()];
113 Vector& value(
unsigned int x,
unsigned int y,
unsigned int z )
115 return ( *
this )( x, y, z );
118 Vector value(
unsigned int x,
unsigned int y,
unsigned int z )
const
120 return ( *
this )( x, y, z );
128 Vector
lerp_local( Scalar _x, Scalar _y, Scalar _z );
131 Vector
lerp_world( Scalar _x, Scalar _y, Scalar _z );
136 std::vector< Vector > values_;
143 #if defined(INCLUDE_TEMPLATES) && !defined(ACG_VECTORFIELDT_C)
144 #define ACG_VECTORFIELDT_TEMPLATES
145 #include "VectorFieldT.cc"
148 #endif // ACG_VECTORFIELDT_HH defined
virtual bool directed_distance(const Vec3 &, const Vec3 &, Vec3 &, Vec3 &, real &) const
See IsoEx::Implicit::directed_distance()
Definition: VectorFieldT.hh:92
Vector lerp_world(Scalar _x, Scalar _y, Scalar _z)
funciton to lineary interploate a vector at a world point
Definition: VectorFieldT.cc:91
Vector lerp_local(Scalar _x, Scalar _y, Scalar _z)
function to lineary interpolate a vector at a local point
Definition: VectorFieldT.cc:46
void initialize(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)
function to initialize the grid
Definition: VectorFieldT.hh:66
~VectorFieldT()
Destructor.
Definition: VectorFieldT.hh:62
void initialize(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)
function to initialize the grid
Definition: RegularGridT.cc:49
Vector value_range(int x, int y, int z) const
get scalar value, returns zero vector if position is not in range
Definition: VectorFieldT.cc:25
A type for volume images, or 3D textures.
Grid< Vec3 >::PointIdx PointIdx
The grid points can be referred to by PointIdx.
Definition: RegularGridT.hh:68
Vector & operator()(unsigned int x, unsigned int y, unsigned int z)
data access
Definition: VectorFieldT.hh:103
VectorFieldT(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=10, unsigned int _y_res=10, unsigned int _z_res=10)
Default constructor.
Definition: VectorFieldT.hh:50
Definition: RegularGridT.hh:56
Definition: VectorFieldT.hh:43