Make games that sell.
KSpline
includes :

#include "KSpline.h"



struct KPoint
{
double x , y ;
double coefx , coefy ;
};

the coordinnates of the points are in pixels. (0,0 being the top left of the screen )

Quick Reference

getPoint
getPointFromCtrlPoint



void getPointFromCtrlPoint( KPoint *kPoint , KPoint *controlP1, KPoint *controlP2 , KPoint *controlP3 , double position) ;
uses the "middle" (2nd) point of the spline as control point.
position ranges from 0 to 1

void getPoint( KPoint *kPoint , double x1,double y1 ,double x2,double y2 , double coefX1 , double coefY1 , double coefX2 , double coefY2 , double position)
uses 2 control points.

position ranges from 0 to 1


Example:
KPoint destPoint ;
KSpline ks ;
for ( progress = 0 ; progress <= 1 ; progress +=0.01f )
{
ks.getPoint( &destPoint , 50,50,600,400,300,100,400,250,position )
surface->plotPlixel( destPoint.x ,destPoint.y , 1,1,1,1 ) ;
}




© 2003-2005, Phelios, inc. - All rights reserved.
Trademarks mentioned are the property of their respective owners.