Difference between revisions of "Interpolation"

From Second Life Wiki
Jump to navigation Jump to search
(New page: <lsl> //===================================================// // Interpolation Library 1.0 // // "May 4 2008", "2:23:12" // // Copyright ...)
 
Line 1: Line 1:
{{LSL Header}}
<lsl>
<lsl>
//===================================================//
//===================================================//

Revision as of 17:42, 3 May 2008

<lsl> //===================================================// // Interpolation Library 1.0 // // "May 4 2008", "2:23:12" // // Copyright (C) 2008, Nexii Malthus (cc-by) // // http://creativecommons.org/licenses/by/3.0/ // //===================================================//

float fLin(float v0, float v1,float t){

   return v0*(1-t) + v1*t;}

float fCos(float v0,float v1,float t){

   float F = (1 - llCos(t*PI))/2;
   return v0*(1-F)+v1*F;}

float fCub(float v0,float v1,float v2,float v3,float t){

   float P = (v3-v2)-(v0-v1);float Q = (v0-v1)-P;float R = v2-v0;float S = v1;
   return P*llPow(t,3) + Q*llPow(t,2) + R*t + S;}

vector vLin(vector v0, vector v1,float t){

   return v0*(1-t) + v1*t;}

vector vCos(vector v0,vector v1,float t){

   float F = (1 - llCos(t*PI))/2;
   return v0*(1-F)+v1*F;}

vector vCub(vector v0,vector v1,vector v2,vector v3,float t){

   vector P = (v3-v2)-(v0-v1);vector Q = (v0-v1)-P;vector R = v2-v0;vector S = v1;
   return P*llPow(t,3) + Q*llPow(t,2) + R*t + S;}

default{state_entry(){}}

</lsl>