Catmull-Rom / Cardinal Spline interpolation problem

Catmull-Rom / Cardinal Spline interpolation problem
0

#1

At first please check the issue-1441 of cocos2d
[[http://code.google.com/p/cocos2d-iphone/issues/detail?id=1441]]
I think this problem exists in cocos2d-x too. If I am right, then I think we should solve it ASAP.


#2

Agreed. Their fix works as well.
https://github.com/cocos2d/cocos2d-iphone/commit/399459a44d1aaa9f49c05e77810d40cffde7a533

change:

void CCCardinalSplineTo::startWithTarget(cocos2d::CCNode *pTarget)
{
     CCActionInterval::startWithTarget(pTarget);
     m_fDeltaT = (float) 1 / m_pPoints->count();
}

to:

void CCCardinalSplineTo::startWithTarget(cocos2d::CCNode *pTarget)
{
     CCActionInterval::startWithTarget(pTarget);
     m_fDeltaT = (float) 1 / (m_pPoints->count() - 1);
}

#3

I noticed that sprite sometimes disappear near the curve. Without this everything is working well.


#4

I think this is probably still broken at DrawNode::drawCardinalSpline…
at least when I working on my own geometry above drawCardinalSpline code the curve ending is approximated wrong if we don’t apply fix recommended above:

image

so at the end of the curve we have many don’t needed points. after fix:

image


Final topic about Anti-Aliasing disease