59 #include "PolyLineBezierSplineData.hh"
62 : meshIndex_(_meshIndex)
69 p.position = _position;
77 if(points_.size() < 2)
82 for(
unsigned int i = 0; i + 1 < points_.size(); i++) {
84 const ACG::Vec3d firstPoint = points_[i].position, sndPoint = points_[i + 1].position;
85 double r = (firstPoint - sndPoint).norm() / 4.0;
87 const ACG::Vec3d ort0 = dir % points_[i].normal, ort1 = dir % points_[i + 1].normal;
88 ACG::Vec3d f0 = ort0 % points_[i].normal, f1 = ort1 % points_[i + 1].normal;
90 ACG::Vec3d near = firstPoint - f0.normalize() * r,
91 far = sndPoint + f1.normalize() * r;
93 handles_.push_back(near);
94 handles_.push_back(far);
99 for(
unsigned int i = 1; i + 1 < handles_.size(); i += 2) {
101 const ACG::Vec3d dir = (handles_[i + 1] - handles_[i]) / 2.0;
104 handles_[i + 1] = p.position + dir;
105 handles_[i] = p.position - dir;
115 else if(_handleIndex == handles_.size())
116 return points_.back();
117 else return points_[(_handleIndex - 1) / 2 + 1];
void addInterpolatePoint(ACG::Vec3d _position, ACG::Vec3d _normal)
Adds a point to the end of the list and inserts control points.
InterpolatePoint & getInterpolatePoint(unsigned int _handleIndex)
Retrieves the interpolate point based on the handle.
PolyLineBezierSplineData(unsigned int _meshIndex)
Creates a new PolyLineBezierSplineData object with no points.
bool finishSpline()
If possible calculates handles.