IPO Curve Problem...

View previous topic View next topic Go down

IPO Curve Problem...

Post  sio2interactive on Tue Nov 11, 2008 5:00 am

Ok... maybe Im just getting rusty or just too tired (that's what happen when you are "supposedly" working on 3 project at the same time fulltime, anyway)...

Im integrating the IPO of blender... so I export the points of the curve that represent frame & value. I already integrate constant and linear interpolation (no comments here)... but I can't figure out what method blender is using for the bezier...

So I go in example this:

x = frame
y = value

vec2 v1: x = 1 y = -10
vec2 v2: x = 60 y = 10


Im using the following code for the bezier curve, the calculation look right to me but the result is just strange...

Code:



...
...
float sio2CubicBezier(float t, float a, float b, float c, float d)
{
   float tflip = 1.0f - t;
   return tflip * tflip * tflip * a + 3.0f * tflip * t * (tflip * b + t * c) + t * t * t * d;
}
...
...

      _SIO2ipocurve->d_time += _SIO2window->d_time;

      float t = _SIO2ipocurve->d_time / _SIO2ipocurve->t_ratio;
      
      _SIO2ipocurve->value = sio2CubicBezier( t,
                            _SIO2ipocurve->point[ _SIO2ipocurve->curr_point ].x,
                            _SIO2ipocurve->point[ _SIO2ipocurve->curr_point ].y,
                            _SIO2ipocurve->point[ _SIO2ipocurve->curr_point + 1 ].x,
                           _SIO2ipocurve->point[ _SIO2ipocurve->curr_point + 1 ].y );      
         
      if( _SIO2ipocurve->d_time >= _SIO2ipocurve->t_ratio )
      {
         ++_SIO2ipocurve->curr_point;
         
         _SIO2ipocurve->d_time = 0.0f;
         
         sio2IpoCurveGetRatio( _SIO2ipocurve );
      }      

Can someone help me out on that one...

Tks in advance,

Cheers,
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: IPO Curve Problem...

Post  zzajin on Tue Nov 11, 2008 7:11 am

I think your parens might be misplaced.

Code:


tflip * tflip * tflip * a    + 3.0f * tflip * t * (tflip * b + t * c)                      + t * t * t * d;


(1-t)^3a                    +  3t(1-t)^2b                    +  3t^2(1-t)c                +  t^3d
tflip * tflip * tflip * a  +  3.0f * t * tflip * tflip * b  +  3.0f * t * t * tflip * c  +  t * t * t * d;



zzajin

Posts : 81
Join date : 2008-10-14

View user profile

Back to top Go down

Re: IPO Curve Problem...

Post  sio2interactive on Tue Nov 11, 2008 3:53 pm

Cheers for tip... however still not working... something else is wrong...

Tks!
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: IPO Curve Problem...

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum