JohnnyOpcode / degrafa

Automatically exported from code.google.com/p/degrafa
1 stars 0 forks source link

Bug in BezierSplineControl #100

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Curve passes through 4 points at one line
2. See creating cage for middle segment
3. Knots are ok. But two additional points calculated wrong

What is the expected output? What do you see instead?

We must see curve as a straight line passes through 4 points, 
but because of wrong calculated vectors loop is appeared. 

Here is problem:
_bXNR = _points[_i].x + _t * (_points[_i].x - _points[_i + 1].x);
_bYNR = _points[_i].y + _t * (_points[_i].y - _points[_i + 1].y);
_bXNL = _points[_i].x + _t * (_points[_i + 2].x - _points[_i + 1].x);
_bYNL = _points[_i].y + _t * (_points[_i + 2].y - _points[_i + 1].y);

I noticed that if we calculate these vectors relative to next point, everything 
is ok!
_bXNR = _points[_i + 1].x + _t * (_points[_i].x - _points[_i + 1].x);
_bYNR = _points[_i + 1].y + _t * (_points[_i].y - _points[_i + 1].y);
_bXNL = _points[_i + 1].x + _t * (_points[_i + 2].x - _points[_i + 1].x);
_bYNL = _points[_i + 1].y + _t * (_points[_i + 2].y - _points[_i + 1].y);

Original issue reported on code.google.com by mr.jack.n@gmail.com on 5 Dec 2013 at 9:09