53 #ifndef BSPLINESURFACET_HH 54 #define BSPLINESURFACET_HH 61 #include <ACG/Math/VectorT.hh> 63 #include <ObjectTypes/Knotvector/KnotvectorT.hh> 81 template <
class Po
intT>
88 typedef typename Point::value_type Scalar;
89 typedef typename std::vector< std::vector< Point > > ControlNet;
90 typedef typename std::vector< std::vector< unsigned char > > PropertyNet;
97 explicit BSplineSurfaceT(
unsigned int _degm = 3,
unsigned int _degn = 3);
105 void resize(
unsigned int _m,
unsigned int _n);
168 void set_degree(
unsigned int _degm,
unsigned int _degn);
196 return control_net_[_m][_n];
206 return control_net_[_m][_n];
213 inline const Point&
operator()(
unsigned int _m,
unsigned int _n)
const 216 return control_net_[_m][_n];
225 assert ( (0 <= _param[0]) && (_param[0] <
dimm_) && (0 <= _param[1]) &&( _param[1] <
dimn_ ) );
226 return control_net_[_param[0]][_param[1]];
235 assert ( (0 <= _param[0]) && (_param[0] <
dimm_) && (0 <= _param[1]) &&( _param[1] <
dimn_ ) );
236 return control_net_[_param[0]][_param[1]];
245 void get_vector_m(std::vector< Point> & _control_polygon,
unsigned int _m);
252 void get_vector_n(std::vector< Point> & _control_polygon,
unsigned int _n);
259 void add_vector_m(
const std::vector< Point> & _control_polygon);
265 void add_vector_n(
const std::vector< Point> & _control_polygon);
273 void insert_vector_m(
const std::vector< Point> & _control_polygon,
unsigned int _m);
279 void insert_vector_n(
const std::vector< Point> & _control_polygon,
unsigned int _n);
420 unsigned char& controlpoint_selection(
unsigned int _i,
unsigned int _j) {
return cpselections_[_i][_j];}
421 const unsigned char& controlpoint_selection(
unsigned int _i,
unsigned int _j)
const {
return cpselections_[_i][_j];}
426 unsigned char& edge_selection(
unsigned int _i,
unsigned int _j) {
return eselections_[_i][_j];}
427 const unsigned char& edge_selection(
unsigned int _i,
unsigned int _j)
const {
return eselections_[_i][_j];}
441 void select_controlpoint(
unsigned int _iIdx,
unsigned int _jIdx) { controlpoint_selection(_iIdx, _jIdx) = 1; };
442 void deselect_controlpoint(
unsigned int _iIdx,
unsigned int _jIdx) { controlpoint_selection(_iIdx, _jIdx) = 0; };
444 bool controlpoint_selected(
unsigned int _iIdx,
unsigned int _jIdx)
const {
return (controlpoint_selection(_iIdx, _jIdx) == 1); };
449 template <
class PropT>
450 void request_prop(
unsigned int& _ref_count, PropT& _prop);
452 template <
class PropT>
453 void release_prop(
unsigned int& _ref_count, PropT& _prop);
465 ControlNet control_net_;
485 unsigned int ref_count_cpselections_;
486 unsigned int ref_count_eselections_;
494 #if defined(INCLUDE_TEMPLATES) && !defined(BSPLINESURFACE_BSPLINESURFACET_C) 495 #define BSPLINESURFACE_BSPLINESURFACET_TEMPLATES 496 #include "BSplineSurfaceT_impl.hh" 499 #endif // ACG_BSPLINESURFACET_HH defined void insert_knot_n(double _t)
Insert a knot i in n direction without changing the surface.
bool controlpoint_selections_available() const
Check if control point selection property is available.
Point & operator()(Vec2i _param)
Returns a reference to the control point (m, n)
void request_edge_selections()
request edge selection property
void add_vector_m(const std::vector< Point > &_control_polygon)
Adds a control point n-vector.
unsigned int degree_m_
Spline degree in m direction.
unsigned int dimm_
number of control points in m direction
Namespace providing different geometric functions concerning angles.
Knotvector * get_knotvector_n_ref()
Get a reference to the knotvector in n direction.
Scalar upperu()
Returns the upper u parameter.
void release_controlpoint_selections()
release control point selection property
ACG::Vec2i interval_n(double _t)
Returns the index of the knots v and v+1 such that t in [v, v+1)
Point & get_control_point(unsigned int _m, unsigned int _n)
Returns a reference to the control point (m, n)
int degree_n() const
Returns the spline degree in n direction.
PropertyNet cpselections_
list of control point properties
void set_knots_m(std::vector< Scalar > _knots)
Set the knotvector of the bspline surface in m direction.
PropertyNet eselections_
list of edge properties
void createKnots()
Creates interpolating knotvectors 0...0, 1, 2, ..., n...n.
void delete_vector_m(unsigned int _m)
Deletes an n control point vector.
void insert_vector_n(const std::vector< Point > &_control_polygon, unsigned int _n)
Inserts an m control point vector.
unsigned int n_knots_n()
Returns the number of knots in n direction.
const Point & operator()(unsigned int _m, unsigned int _n) const
Returns a const reference to the control point (m, n)
Knotvector knotvector_n_
Knotvector in n direction.
void get_vector_m(std::vector< Point > &_control_polygon, unsigned int _m)
Returns an n control point vector.
ACG::Vec2i spann(double _t)
Returns the basis functions which are unequal to zero at parameter v.
std::vector< Scalar > & get_knots_m()
get the knotvector in m direction of the bspline surface
std::vector< Scalar > & get_knots_n()
get the knotvector in m direction of the bspline surface
Scalar get_knot_n(int _i)
Get knot i in n direction.
void insert_vector_m(const std::vector< Point > &_control_polygon, unsigned int _m)
Inserts an n control point vector.
Knotvector * get_knotvector_m_ref()
Get a reference to the knotvector in m direction.
Scalar upperv()
Returns the upper v parameter.
ACG::Vec2i interval_m(double _t)
Returns the index of the knots u and u+1 such that t in [u, u+1)
Point surfacePoint(double _u, double _v)
Evaluates a spline surface at parameters _u and _v.
void insert_knot_m(double _t)
Insert a knot i in m direction without changing the surface.
Scalar lowerv()
Returns the lower v parameter.
BSplineSurfaceT(unsigned int _degm=3, unsigned int _degn=3)
Constructor.
void reset_control_net()
Clears the control net.
ACG::Vec2i spanm(double _t)
Returns the basis functions which are unequal to zero at parameter u.
Point surfacePoint_rec(double _u, double _v)
Evaluates a spline surface at parameters _u and _v.
void resize(unsigned int _m, unsigned int _n)
Resizes the spline struct.
Scalar get_knot_m(int _i)
Get knot i in m direction.
Point normalSurfacePoint(double _u, double _v)
Returns the normal of a spline surface.
unsigned int n_control_points_n() const
Returns the number of controlpoints in n direction.
void get_vector_n(std::vector< Point > &_control_polygon, unsigned int _n)
Returns an m ctrPointVector.
unsigned int n_control_points_m() const
Returns the number of controlpoints in m direction.
void set_degree(unsigned int _degm, unsigned int _degn)
Sets the degree of the spline surface.
Scalar loweru()
Returns the lower u parameter.
const Point & operator()(Vec2i _param) const
Returns a const reference to the control point (m, n)
unsigned int n_knots_m()
Returns the number of knots in m direction.
void set_knots_n(std::vector< Scalar > _knots)
Set the knotvector of the bspline surface in n direction.
void add_vector_n(const std::vector< Point > &_control_polygon)
Adds a control point m-vector.
void delete_vector_n(unsigned int _n)
Deletes an m control point vector.
void release_edge_selections()
release edge selection property
Scalar derivativeBasisFunction(Knotvector &_knotvector, int _i, int _n, double _t, int _der)
Derivative of a Spline Basis Function.
void surfacePointNormal(Point &_pt, Point &_normal, double _u, double _v)
Evaluates a spline surface at parameters _u and _v.
unsigned int degree_n_
Spline degree in n direction.
Point & operator()(unsigned int _m, unsigned int _n)
Returns a reference to the control point (m, n)
unsigned int dimn_
number of control points in n direction
Point derivativeSurfacePoint(double _u, double _v, int _derm, int _dern)
Returns the _derm'th derivative of a spline surface.
Knotvector get_knotvector_n()
Get the knotvector in n direction.
Knotvector get_knotvector_m()
Get the knotvector in m direction.
Scalar basisFunction(Knotvector &_knotvector, int _i, int _n, double _t)
A Spline Basis Function.
int degree_m() const
Returns the spline degree in m direction.
void request_controlpoint_selections()
request control point selection property
Knotvector knotvector_m_
Knotvector in m direction.
bool edge_selections_available() const
Check if edge selection property is available.