59 #ifndef BSPLINECURVET_HH 60 #define BSPLINECURVET_HH 67 #include <ACG/Math/VectorT.hh> 69 #include <ObjectTypes/Knotvector/KnotvectorT.hh> 87 template <
class Po
intT>
94 typedef typename Point::value_type Scalar;
106 std::vector< Scalar >&
get_knots() {
return knotvector_.getKnotvector();};
109 void set_knots(std::vector< Scalar > _knots);
173 unsigned int n_knots()
const {
return knotvector_.size(); };
176 unsigned int degree()
const {
return degree_;};
193 void autocompute_knotvector(
bool _auto) {autocompute_knotvector_ = _auto;};
195 void fixNumberOfControlPoints(
bool _fix) {fix_number_control_points_ = _fix;};
231 Scalar
lower()
const;
234 Scalar
upper()
const;
238 void request_controlpoint_selections() { request_prop( ref_count_cpselections_, cpselections_);}
239 void request_edge_selections() { request_prop( ref_count_eselections_, eselections_);}
242 void release_controlpoint_selections() { release_prop( ref_count_cpselections_, cpselections_);}
243 void release_edge_selections() { release_prop( ref_count_eselections_, eselections_);}
246 bool controlpoint_selections_available()
const {
return bool(ref_count_cpselections_);}
247 bool edge_selections_available()
const {
return bool(ref_count_eselections_);}
251 unsigned char& controlpoint_selection(
unsigned int _i){
253 assert(controlpoint_selections_available());
254 return cpselections_[_i];
256 const unsigned char& controlpoint_selection(
unsigned int _i)
const {
258 assert(controlpoint_selections_available());
259 return cpselections_[_i];
262 unsigned char& edge_selection(
unsigned int _i) {
263 assert(edge_selections_available());
264 return eselections_[_i];
266 const unsigned char& edge_selection(
unsigned int _i)
const {
267 assert(edge_selections_available());
268 return eselections_[_i];
272 void select_controlpoint(
unsigned int _pIdx) { controlpoint_selection(_pIdx) = 1; };
273 void deselect_controlpoint(
unsigned int _pIdx) { controlpoint_selection(_pIdx) = 0; };
275 bool controlpoint_selected(
unsigned int _pIdx)
const {
return (controlpoint_selection(_pIdx) == 1); };
277 void select_edge(
unsigned int _pIdx) { edge_selection(_pIdx) = 1; };
278 void deselect_edge(
unsigned int _pIdx) { edge_selection(_pIdx) = 0; };
280 bool edge_selected(
unsigned int _pIdx)
const {
return (edge_selection(_pIdx) == 1); };
284 template <
class PropT>
285 void request_prop(
unsigned int& _ref_count, PropT& _prop);
287 template <
class PropT>
288 void release_prop(
unsigned int& _ref_count, PropT& _prop);
293 std::vector<Point> control_polygon_;
297 unsigned int degree_;
299 bool autocompute_knotvector_;
301 bool fix_number_control_points_;
308 std::vector<unsigned char> cpselections_;
311 std::vector<unsigned char> eselections_;
314 unsigned int ref_count_cpselections_;
315 unsigned int ref_count_eselections_;
323 #if defined(INCLUDE_TEMPLATES) && !defined(BSPLINECURVE_BSPLINECURVET_C) 324 #define BSPLINECURVE_BSPLINECURVET_TEMPLATES 325 #include "BSplineCurveT.cc" 328 #endif // ACG_BSPLINECURVET_HH defined void set_control_polygon(std::vector< Point > &_control_polygon)
set whole control polygon
void set_degree(unsigned int _degree)
Sets the spline degree.
BSplineCurveT(unsigned int _degree=3)
Constructor.
ACG::Vec2i interval(double _t)
void delete_control_point(int _idx)
delete control point at given index
Scalar derivativeBasisFunction(int _i, int _n, Scalar _t, int _der)
Scalar get_knot(int _i)
get knot i
void set_knotvector_type(Knotvector::KnotvectorType _type)
set type of knotvector
Scalar upper() const
Returns the upper parameter.
void reset_control_polygon()
Clears the control polygon.
Point & get_control_point(int _i)
get control point i
unsigned int n_control_points() const
Returns the number of control points.
std::vector< Scalar > & get_knots()
get the knotvector of the bspline curve
~BSplineCurveT()
Destructor.
void reverse()
Reverses the curve.
unsigned int n_knots() const
Returns the number of knots.
void set_control_point(int _idx, const Point &_cp)
reset a control point
void insertKnot(double _u)
Inserts a new knot at parameter u.
void print() const
print information string
unsigned int degree() const
Returns the spline degree.
Scalar basisFunction(int _i, int _n, Scalar _t)
Point curvePoint(Scalar _u)
std::vector< Point > deBoorAlgorithm(double _u)
void add_control_point(const Point &_cp)
add a control point
bool projected()
projected
void insert_control_point(int _idx, const Point &_cp)
insert a control point at given index
Namespace providing different geometric functions concerning angles.
ACG::Vec2i span(double _t)
Knotvector * get_knotvector_ref()
get a reference to the knotvector
void set_knots(std::vector< Scalar > _knots)
set the knotvector of the bspline curve
Scalar lower() const
Returns the lower parameter.
Point derivativeCurvePoint(Scalar _u, unsigned int _der)