Le vendredi 9 janvier 2015, 17:10:54 Milan Vancura a écrit :
> Hello again,
> 
> I finally tracked where the problem appears so I may report
> it:
> 
> after I rotate a part in LeoCAD, the result angle of rotation
> is computed with some rounding errors, even in case of
> (default) rotation angles snapping. For example the part is
> rotated by 179.9985075 degrees instead of 180. The following
> problem is, then, that such part is not even placed at "nice"
> coordinates - strange numbers like 19.9958294 appear in .mpd
> file.

In LeoCAD (and LDRAW), rotations are represented as matrices, so 
cosines and sines, not angles. Furthermore, (co)sines are 
computed with radians not degrees, so say hello to 
transcendental PI. And computations are, necessarily, done with 
approximations. So errors cumulate.

An impractical solution is to delay the evaluation: store 
mathematic expressions, not numbers/results, and simplify and 
evaluate them only when needed.

So, you have two options:
1. round the numbers yourself (edit properties one by one or, as
  any OCD-programmer, use a script).
2. do not care anymore ;o)

(To mitigate the errors, you can move your pieces before 
rotating them.)

-- 
 Sylvain Sauvage

_______________________________________________
Leocad mailing list
[email protected]
https://list.gerf.org/listinfo/leocad

Reply via email to