|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object common:Generic ck:InterpolateBase ck:SphericalLinear
class
Spherical Linear Interpolation between two Complex numbers
class SphericalLinear(ck.ulb:InterpolateBase) { ; Spherical Linear Interpolation between two Complex numbers public: import "Common.ulb" func SphericalLinear (Generic pparent) InterpolateBase.InterpolateBase(pparent) endfunc protected: complex func doInterpolate(float t,complex a,complex b) complex _a=(0,0) complex _b=(0,0); float absa=cabs(a); float absb=cabs(b); if(absa>0) _a=a/absa endif if(absb>0) _b=b/absb endif float omega=(real(_a)*real(_b)+imag(_a)*imag(_b)); float sinomega=sin(omega) if(sinomega==0) sinomega=0.00000000001 endif complex res=lerp(t,absa,absb)* ((sin((1-t)*omega)*_a+sin(t*omega)*_b)/sinomega) return res; endfunc private: float func lerp(float t,float a,float b) return a + t * (b - a) endfunc default: title = "SphericalLinear" rating = recommended }
Constructor Summary | |
---|---|
SphericalLinear()
|
|
SphericalLinear(Generic pparent)
|
Method Summary | |
---|---|
protected complex |
doInterpolate(float t,
complex a,
complex b)
|
Methods inherited from class ck:InterpolateBase |
---|
Interpolate |
Methods inherited from class common:Generic |
---|
GetParent |
Methods inherited from class Object |
---|
|
Constructor Detail |
---|
public SphericalLinear(Generic pparent)
public SphericalLinear()
Method Detail |
---|
protected complex doInterpolate(float t, complex a, complex b)
doInterpolate
in class InterpolateBase
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |