59 #define ACG_KNOTVECTORT_C
61 #include "KnotvectorT.hh"
65 template <
typename Scalar >
68 : ref_count_selections_(0)
70 knotvectorType_ = UNIFORM_INTERPOL;
75 template <
typename Scalar >
79 knots_ = _knotvec.knots_;
82 selections_ = _knotvec.selections_;
85 ref_count_selections_ = _knotvec.ref_count_selections_;
87 knotvectorType_ = _knotvec.knotvectorType_;
89 num_control_points_ = _knotvec.num_control_points_;
90 spline_degree_ = _knotvec.spline_degree_;
95 template<
typename Scalar >
103 template <
typename Scalar >
108 knotvectorType_ = _type;
110 if ( (spline_degree_ != 0) && (num_control_points_ != 0))
111 createKnots(spline_degree_, num_control_points_);
116 template <
typename Scalar >
118 KnotvectorT<Scalar>::
119 createKnots(
unsigned int _splineDeg,
unsigned int _dim)
121 num_control_points_ = _dim;
122 spline_degree_ = _splineDeg;
124 if (knotvectorType_ == UNIFORM)
125 createUniformKnots(_splineDeg, _dim);
126 else if (knotvectorType_ == UNIFORM_INTERPOL)
127 createUniformInterpolatingKnots(_splineDeg, _dim);
132 template <
typename Scalar >
134 KnotvectorT<Scalar>::
135 addKnot(Scalar _knot)
137 knots_.push_back(_knot);
140 if( selections_available())
141 selections_.push_back(
false);
146 template <
typename Scalar >
148 KnotvectorT<Scalar>::
149 insertKnot(
unsigned int _index,
const Scalar _knot)
151 assert(_index < knots_.size());
152 knots_.insert(knots_.begin()+_index, _knot);
155 if( selections_available())
156 selections_.insert(selections_.begin()+_index,
false);
161 template<
typename Scalar >
163 KnotvectorT<Scalar>::
164 deleteKnot(
unsigned int _index)
166 assert(_index < knots_.size());
167 knots_.erase(knots_.begin()+_index);
169 if( selections_available())
170 selections_.erase(selections_.begin()+_index);
175 template<
typename Scalar >
177 KnotvectorT<Scalar>::
178 setKnotvector(
const std::vector< Scalar >& _knots)
183 if( selections_available())
184 selections_.resize(knots_.size(),
false);
191 template<
typename Scalar >
193 KnotvectorT<Scalar>::
194 createUniformInterpolatingKnots(
unsigned int _splineDeg,
unsigned int _dim)
200 for (
unsigned int i = 0; i < _splineDeg; i++)
203 for (
int i = 0; i < (int)_dim - (
int)_splineDeg + 1; i++) {
208 for (
unsigned int i = 0; i < _splineDeg; i++)
209 knots_.push_back(last);
212 if( selections_available())
213 selections_.resize(knots_.size(),
false);
223 template<
typename Scalar >
225 KnotvectorT<Scalar>::
226 createUniformKnots(
unsigned int _splineDeg,
unsigned int _dim)
231 int k = _dim + _splineDeg + 1;
233 for (
int i = 0; i < k; ++i )
237 if( selections_available())
238 selections_.resize(knots_.size(),
false);
250 template<
typename Scalar >
251 template <
class PropT>
253 KnotvectorT<Scalar>::
254 request_prop(
unsigned int& _ref_count, PropT& _prop)
259 _prop.resize(size());
267 template<
typename Scalar >
268 template <
class PropT>
270 KnotvectorT<Scalar>::
271 release_prop(
unsigned int& _ref_count, PropT& _prop)
Namespace providing different geometric functions concerning angles.
~KnotvectorT()
Destructor.
KnotvectorT()
Constructor.