Archived

This topic is now archived and is closed to further replies.

lifeless

CatmullRom vs. B-Splines

Recommended Posts

Ok, I have a code running for Catmull Rom, using the following matrix : 0 2 0 0 -1 0 1 0 2 -5 4 -1 -1 3 -3 1 of course multiplying by 0.5 (catmullrom tension) at the end. now I use the same procedure with the matrix corresponding to B-Splines 1 4 1 0 -3 0 3 0 3 -6 3 0 -1 3 -3 1 of course multiplying by 1/6 at the end. but it doesnt work!!! in a nutshell this is my code : (p0*m00 + p1*m01 + p2*m02 + p3*m03)*1 + (p0*m10 + p1*m11 + p2*m12 + p3*m13)*(t^1)+ (p0*m20 + p1*m21 + p2*m22 + p3*m23)*(t^2)+ (p0*m30 + p1*m31 + p2*m32 + p3*m33)*(t^3); can anyone tell me please, if there is smtg I''m forgetting? OH!!!! one last thing, what I do to test is this : Spline (-2.0f, 0.0f, 1.0f, 3.0f, t); CatmullRom (-2.0f, 0.0f, 1.0f, 3.0f, 0.5f, t); where the first 4 numbers are the control points, (the fifth for CRom is the tension), and the t goes from 0 to 1. and this is what i get, look how the spline goes from Before 0.0 to After 1.0, but CatmullRom works perfectly! 00 : 0.000 CRom : 0.000 Spline : -0.167 01 : 0.050 CRom : 0.071 Spline : -0.093 02 : 0.100 CRom : 0.136 Spline : -0.021 03 : 0.150 CRom : 0.195 Spline : 0.048 04 : 0.200 CRom : 0.248 Spline : 0.116 05 : 0.250 CRom : 0.297 Spline : 0.182 06 : 0.300 CRom : 0.342 Spline : 0.247 07 : 0.350 CRom : 0.384 Spline : 0.311 08 : 0.400 CRom : 0.424 Spline : 0.375 09 : 0.450 CRom : 0.462 Spline : 0.437 10 : 0.500 CRom : 0.500 Spline : 0.500 11 : 0.550 CRom : 0.538 Spline : 0.563 12 : 0.600 CRom : 0.576 Spline : 0.625 13 : 0.650 CRom : 0.616 Spline : 0.689 14 : 0.700 CRom : 0.658 Spline : 0.753 15 : 0.750 CRom : 0.703 Spline : 0.818 16 : 0.800 CRom : 0.752 Spline : 0.884 17 : 0.850 CRom : 0.805 Spline : 0.952 18 : 0.900 CRom : 0.864 Spline : 1.021 19 : 0.950 CRom : 0.929 Spline : 1.093 20 : 1.000 CRom : 1.000 Spline : 1.167 Could anyone give me an idea of what could possibly wrong?

Share this post


Link to post
Share on other sites