POV-Ray : Newsgroups : povray.advanced-users : Bug in Knee macro? : Bug in Knee macro? Server Time
19 Oct 2024 09:06:00 EDT (-0400)
  Bug in Knee macro?  
From: Rune
Date: 4 Feb 2001 17:03:09
Message: <3a7dd19d$1@news.povray.org>
When rendering the short cyclic animation below it seems to me that there's
a bug in the famous Knee macro. I really need a version that works
perfectly. Can anybody help?

Thanks in advance,

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

---

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);

#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

#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>}}
torus {0.6, 0.05 rotate 90*z translate -0.4*y}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.