|
|
Hi,
I'm using bezier.inc and this commands:
#declare Spline1 = array[4] { A1,B1,C1,D1 }
#declare BezRad = 0.01;
#declare FullCurve = true;
DrawSpline(Spline1)
is it possible to get the equation of the resulting curve?
This is the macro:
#macro DrawSpline(id)
#declare BezThing = sphere { <0,0,0> BezRad texture { BezTex } }
#local c = 0;
#while ( c < 1 )
#local temp = ReturnPosition(id,c);
// Find the Next Point on the spline
#local next = ReturnPosition(id,(c+1/NumberofPoints));
#if (FullCurve)
#if ( c < 1 ) cylinder { temp, next BezRad texture { BezTex }
#if(NoShadow) no_shadow #end } #end
#end
// Find the proper transformation for the thing
#local nx = vnormalize(next - temp);
#local nz = vnormalize(vcross(nx,y));
#local ny = vcross(nz,nx);
#local nz = vnormalize(vcross(nx,ny));
object{ BezThing
#if(NoShadow) no_shadow #end
matrix
<nx.x,nx.y,nx.z,ny.x,ny.y,ny.z,nz.x,nz.y,nz.z,temp.x,temp.y,temp.z>
texture { BezTex }}
#declare c = c + (1/NumberofPoints);
#end
#if (ShowTangents)
cylinder { id[0],id[1] BezRad*0.75 pigment { rgb 1 } no_shadow}
cylinder { id[2],id[3] BezRad*0.75 pigment { rgb 1 } no_shadow}
#end
#if (CapSpline)
object { BezThing texture { BezTex } translate id[3] }
#end
#end
Thanks!!
Post a reply to this message
|
|
|
|
Le 19/02/2013 11:46, paola nous fit lire :
> Hi,
> I'm using bezier.inc and this commands:
>
> #declare Spline1 = array[4] { A1,B1,C1,D1 }
> #declare BezRad = 0.01;
> #declare FullCurve = true;
> DrawSpline(Spline1)
>
> is it possible to get the equation of the resulting curve?
If the implementation is correct, the curve should be
P(t)= A1.(1-t)^3 +3.B1.t.(1-t)^2+3.C1.t^2.(1-t)+D1.t^3
For t from 0 to 1;
Post a reply to this message
|
|