53 #ifndef BSPLINECURVET_HH 54 #define BSPLINECURVET_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;
100 std::vector< Scalar >&
get_knots() {
return knotvector_.getKnotvector();};
103 void set_knots(std::vector< Scalar > _knots);
167 unsigned int n_knots()
const {
return knotvector_.size(); };
170 unsigned int degree()
const {
return degree_;};
187 void autocompute_knotvector(
bool _auto) {autocompute_knotvector_ = _auto;};
189 void fixNumberOfControlPoints(
bool _fix) {fix_number_control_points_ = _fix;};
225 Scalar
lower()
const;
228 Scalar
upper()
const;
232 void request_controlpoint_selections() { request_prop( ref_count_cpselections_, cpselections_);}
233 void request_edge_selections() { request_prop( ref_count_eselections_, eselections_);}
236 void release_controlpoint_selections() { release_prop( ref_count_cpselections_, cpselections_);}
237 void release_edge_selections() { release_prop( ref_count_eselections_, eselections_);}
240 bool controlpoint_selections_available()
const {
return bool(ref_count_cpselections_);}
241 bool edge_selections_available()
const {
return bool(ref_count_eselections_);}
245 unsigned char& controlpoint_selection(
unsigned int _i){
247 assert(controlpoint_selections_available());
248 return cpselections_[_i];
250 const unsigned char& controlpoint_selection(
unsigned int _i)
const {
252 assert(controlpoint_selections_available());
253 return cpselections_[_i];
256 unsigned char& edge_selection(
unsigned int _i) {
257 assert(edge_selections_available());
258 return eselections_[_i];
260 const unsigned char& edge_selection(
unsigned int _i)
const {
261 assert(edge_selections_available());
262 return eselections_[_i];
266 void select_controlpoint(
unsigned int _pIdx) { controlpoint_selection(_pIdx) = 1; };
267 void deselect_controlpoint(
unsigned int _pIdx) { controlpoint_selection(_pIdx) = 0; };
269 bool controlpoint_selected(
unsigned int _pIdx)
const {
return (controlpoint_selection(_pIdx) == 1); };
271 void select_edge(
unsigned int _pIdx) { edge_selection(_pIdx) = 1; };
272 void deselect_edge(
unsigned int _pIdx) { edge_selection(_pIdx) = 0; };
274 bool edge_selected(
unsigned int _pIdx)
const {
return (edge_selection(_pIdx) == 1); };
278 template <
class PropT>
279 void request_prop(
unsigned int& _ref_count, PropT& _prop);
281 template <
class PropT>
282 void release_prop(
unsigned int& _ref_count, PropT& _prop);
287 std::vector<Point> control_polygon_;
291 unsigned int degree_;
293 bool autocompute_knotvector_;
295 bool fix_number_control_points_;
302 std::vector<unsigned char> cpselections_;
305 std::vector<unsigned char> eselections_;
308 unsigned int ref_count_cpselections_;
309 unsigned int ref_count_eselections_;
317 #if defined(INCLUDE_TEMPLATES) && !defined(BSPLINECURVE_BSPLINECURVET_C) 318 #define BSPLINECURVE_BSPLINECURVET_TEMPLATES 319 #include "BSplineCurveT_impl.hh" 322 #endif // ACG_BSPLINECURVET_HH defined Namespace providing different geometric functions concerning angles.
unsigned int n_control_points() const
Returns the number of control points.
Scalar derivativeBasisFunction(int _i, int _n, Scalar _t, int _der)
void set_knotvector_type(Knotvector::KnotvectorType _type)
set type of knotvector
Scalar basisFunction(int _i, int _n, Scalar _t)
bool projected()
projected
~BSplineCurveT()
Destructor.
void set_knots(std::vector< Scalar > _knots)
set the knotvector of the bspline curve
Point curvePoint(Scalar _u)
unsigned int degree() const
Returns the spline degree.
void reset_control_polygon()
Clears the control polygon.
void insertKnot(double _u)
Inserts a new knot at parameter u.
Knotvector * get_knotvector_ref()
get a reference to the knotvector
ACG::Vec2i span(double _t)
void add_control_point(const Point &_cp)
add a control point
unsigned int n_knots() const
Returns the number of knots.
void insert_control_point(int _idx, const Point &_cp)
insert a control point at given index
Point derivativeCurvePoint(Scalar _u, unsigned int _der)
void reverse()
Reverses the curve.
Point & get_control_point(int _i)
get control point i
void print() const
print information string
void set_control_polygon(std::vector< Point > &_control_polygon)
set whole control polygon
std::vector< Point > deBoorAlgorithm(double _u)
void set_degree(unsigned int _degree)
Sets the spline degree.
void set_control_point(int _idx, const Point &_cp)
reset a control point
Scalar lower() const
Returns the lower parameter.
ACG::Vec2i interval(double _t)
std::vector< Scalar > & get_knots()
get the knotvector of the bspline curve
Scalar upper() const
Returns the upper parameter.
BSplineCurveT(unsigned int _degree=3)
Constructor.
void delete_control_point(int _idx)
delete control point at given index
Scalar get_knot(int _i)
get knot i