From: Bruce S. <Bru...@nc...> - 2009-04-18 17:55:13
|
Your code fragment must be miscopied, because if alfa is in radians you shouldn't convert radians again in "angle = -alf*pi/180", you should just say "angle = -alf". I'm assuming that you actually had the latter form in your program. Floating point numbers in computers are expressed in an approximate manner, so when you add up 90 terms, each of which is pi/180, the result may actually be less than 90*pi/180, even though the discrepancy is extremely small. A secure way to handle such things is to use integers in the counting: N = 0 while N <= 90: rate(30) scene.forward = scene.forward.rotate(angle=-N*pi/180, axis=(0,1,0)) N+= 1 Bruce Sherwood alessandro wrote: > OK. now it works. But I must write like this: > > > while alfa < 102*pi/180: > rate(30) > scene.forward = scene.forward.rotate(angle=-alfa*pi/180, axis=(0,1,0)) > alfa += pi/180 > > > > why 102 instead of 90? With 90 the rotation in not pi/2 but lesser. > > > > Bruce Sherwood ha scritto: >> The angle used by rotations must be in radians, not degrees. >> >> You want ....rotate(angle=alfa*pi/180, .... >> |