|
|
"Tor Olav Kristensen" wrote:
> Can you please describe the problem ?
Sorry. The knee point is not always correctly calculated. In the posted
animation code the length of the thigh is shortened in one part of the
cycle.
> Not that I suspect this to be the reason for your problem,
> but you should compare the capital letters in your macro
> call with those in the start of the macro declaration.
>
> Knee( HipPoint, AnklePoint, ShinLength, ThighLength, KneeDirection );
> Knee(pA, pH, lT, lS, vD)
Ah yes, I see that I've switched hip point and ankle point and also thigh
length and shin length, but it should make no difference.
> I have put another variant of this macro below
> with more descriptive variable names if you want
> to look for errors yourself.
Your variant doesn't produce the error it seems. Thank you!
To compare the results of yours and John's macro, have a look at the code
below.
Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated January 28)
/ Also visit http://www.povrayusers.org
---
#declare Macro = 1; // 1 = John's macro, 2 = Tor's macro
camera {location <3,0,0> look_at 0 orthographic}
light_source {<3,2,1>*1000, color 1}
background {color rgb 1}
#declare HipPoint = +0.9*y;
#declare AnklePoint = -0.4*y + vrotate(0.6*y,360*x*clock);
#declare ThighLength = 1.2;
#declare ShinLength = 0.8;
#macro Perpendiculize (V1,V2)
vnormalize(vcross(vcross(V2,V1),V2))
#end
#declare KneeDirection = Perpendiculize(z,AnklePoint-HipPoint);
#if (Macro=1)
#macro Knee (pA,pH,lT,lS,vD)
#local lB=vlength(pA-(pH));
#if( (lB>lT+lS) | (lT>lB+lS) | (lS>lT+lB) )
#error "Invalid span lengths.\n"
#end
#local tS=(lT+lS+lB)/2;
#local tA=sqrt(tS*(tS-(lT))*(tS-(lS))*(tS-lB));
#local tH=tA*2/lB;
#local vO=vnormalize(pA-(pH));
#local vF=vnormalize(vcross(vD,vO));
#local vU=vnormalize(vcross(vO,vF));
(pH+vO*sqrt((lT)*(lT)-tH*tH)+vU*tH)
#end
#else
#macro Knee(pA,pH,LT,LS,vD)
#local vB=pA-pH;
#local LB=vlength(vB);
#if(LB>LT+LS|LB<abs(LT-LS))
#error "\nInvalid span lengths.\n"
#end
#local aa=(LB*LB+LT*LT-LS*LS)/2/LB;
#local bb=sqrt(LT*LT-aa*aa);
#local vF=vcross(vB,vcross(vD,vB));
(pH+aa*vnormalize(vB)+bb*vnormalize(vF))
#end
#end
#declare KneePoint =
Knee(HipPoint,AnklePoint,ShinLength,ThighLength,KneeDirection);
cylinder {AnklePoint, KneePoint, 0.05 pigment {color <1,0,0>}}
cylinder {HipPoint, KneePoint, 0.05 pigment {color <0,1,0>}}
sphere {AnklePoint, 0.1 pigment {color <0,0,2>}}
sphere {HipPoint, 0.1 pigment {color <0,0,2>}}
sphere {KneePoint, 0.1 pigment {color <0,0,2>}}
torus {0.6, 0.05 rotate 90*z translate -0.4*y}
Post a reply to this message
|
|