POV-Ray : Newsgroups : povray.unofficial.patches : memory macro:364: warning: divide by zero Server Time
1 Nov 2024 15:27:31 EDT (-0400)
  memory macro:364: warning: divide by zero (Message 1 to 1 of 1)  
From: David Fontaine
Subject: memory macro:364: warning: divide by zero
Date: 14 Sep 2000 00:36:16
Message: <39C05491.2B9B5272@faricy.net>
Sometimes I get this message in MegaPOV, resaving with an ineffectual
change seems to fix it...
It comes along with my macro's own warning: "reposition final vector
length is zero."



This is the funny code (uncommenting/recommenting the #render statements
fixes it, and BTW the rocket transport should be rotated 125 derees,
that is a mistake on my part):

#declare Orient1 = <0,0,0>;
#declare Position1 =
(vrotate(<140,0,5>,<0,60,0>)+<36.5,0,28.5>-<40,0,40>)*.035+<5.2,0,-14.2>;

#declare Height1 = (trace(Mnts,Position1+<0,3,0>,-y,Orient1)).y;
#declare Orient2 = <0,0,0>;
#declare Position2 =
(vrotate(<175,0,0>,<0,55,0>)+<36.5,0,28.5>-<40,0,40>)*.035+<5.2,0,-14.2>;

#declare Height2 = (trace(Mnts,Position2+<0,3,0>,-y,Orient2)).y;
#declare Orient3 = <0,0,0>;
#declare Position3 =
(vrotate(<110,0,4>,<0,60,0>)+<36.5,0,28.5>-<40,0,40>)*.035+<5.2,0,-14.2>;

#declare Height3 = (trace(Mnts,Position3+<0,3,0>,-y,Orient3)).y;
/*#render
concat(str(Position1.x,8,5),",",str(Position1.y,8,5),",",str(Position1.z,8,5),"\n")

#render
concat(str(Position2.x,8,5),",",str(Position2.y,8,5),",",str(Position2.z,8,5),"\n")

#render
concat(str(Position3.x,8,5),",",str(Position3.y,8,5),",",str(Position3.z,8,5),"\n")*/



union { object { RocketDude }
   object { IceRocket }
   translate <-11,-.8,0> rotate -120*y
reposition2(Orient1*.01+y*.99,Orient1)
   scale .035 translate Position1+Height1*y
}
union { object { L6814Dude }
   object { IceVehicle }
   translate <-2,-.8,0> rotate -120*y
reposition2(Orient2*.01+y*.99,Orient2)
   scale .035 translate Position2+Height2*y
}
union { object { L6814Dude }
   object { IceVehicle }
   translate <-2,-.8,0> rotate -120*y
reposition2(Orient3*.01+y*.99,Orient3)
   scale .035 translate Position3+Height3*y
}



And the macro in question:

#macro reposition2(vec1,vec2)
   #if (vlength(vec1)=0)
      #render "Warning: reposition2 initial vector length is zero.\n"
   #end
   #if (vec1.x=0 & vec1.z=0)
      #local RotY=0;
   #else
      #local RotY=atan2(vec1.x,vec1.z)*180/pi;
   #end
   #local RotX=asin((vec1.y)/vlength(vec1))*180/pi;
   rotate -RotY*y
   rotate RotX*x
   #if (vlength(vec2)=0)
      #render "Warning: reposition2 final vector length is zero.\n"
   #end
   #if (vec2.x=0 & vec2.z=0)
      #local RotY=0;
   #else
      #local RotY=atan2(vec2.x,vec2.z)*180/pi;
   #end
   #local RotX=asin((vec2.y)/vlength(vec2))*180/pi;
   rotate <-RotX,RotY,0>
#end



--
David Fontaine   <dav### [at] faricynet>   ICQ 55354965
Please visit my website:  http://davidf.faricy.net/


Post a reply to this message

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