53 #include "PolyLineBezierSplineData.hh" 56 : meshIndex_(_meshIndex)
63 p.position = _position;
71 if(points_.size() < 2)
76 for(
unsigned int i = 0; i + 1 < points_.size(); i++) {
78 const ACG::Vec3d firstPoint = points_[i].position, sndPoint = points_[i + 1].position;
79 double r = (firstPoint - sndPoint).norm() / 4.0;
81 const ACG::Vec3d ort0 = dir % points_[i].normal, ort1 = dir % points_[i + 1].normal;
82 ACG::Vec3d f0 = ort0 % points_[i].normal, f1 = ort1 % points_[i + 1].normal;
85 far = sndPoint + f1.normalize() * r;
87 handles_.push_back(near);
88 handles_.push_back(far);
93 for(
unsigned int i = 1; i + 1 < handles_.size(); i += 2) {
95 const ACG::Vec3d dir = (handles_[i + 1] - handles_[i]) / 2.0;
98 handles_[i + 1] = p.position + dir;
99 handles_[i] = p.position - dir;
109 else if(_handleIndex == handles_.size())
110 return points_.back();
111 else return points_[(_handleIndex - 1) / 2 + 1];
auto normalize() -> decltype(*this/=std::declval< VectorT< S, DIM >>().norm())
PolyLineBezierSplineData(unsigned int _meshIndex)
Creates a new PolyLineBezierSplineData object with no points.
void addInterpolatePoint(ACG::Vec3d _position, ACG::Vec3d _normal)
Adds a point to the end of the list and inserts control points.
bool finishSpline()
If possible calculates handles.
InterpolatePoint & getInterpolatePoint(unsigned int _handleIndex)
Retrieves the interpolate point based on the handle.