[OpenSCAD] General approach

nop head nop.head at gmail.com
Tue Jul 9 09:42:01 EDT 2019


>
> I have now represented a rotation with numbers (numerically) on a digital
> computer (mine, yours currently in your Email program or maybe browser).


I would say that is a symbolic representation like cos(30) or sqrt(3) /2.
The numerical representation is 0.86602540378443864676372317075294........

On Tue, 9 Jul 2019 at 13:07, Rogier Wolff <R.E.Wolff at bitwizard.nl> wrote:

> On Mon, Jul 08, 2019 at 05:13:15PM +0100, nop head wrote:
> > You get rounding errors because it is impossible to represent exact
> > rotations numerically on a digital computer. Of course it is accurate
> > enough for real life but you can't rely vertex positions exactly meeting
> > for example.
>
> rotate (2) cube (10);
>
> I have now represented a rotation with numbers (numerically) on a
> digital computer (mine, yours currently in your Email program or maybe
> browser).
>
> But yes, that "2" represents 2 degrees, which for technical reasons
> needs to be in radians ASAP. Then it becomes irrational. And most of
> the vertices of the cube move to irrational coordinates.
>
> For an example of "not exactly meeting":
>
> Suppose I do something like:
>   rotate (30) {
>      for (i=[0:10:60])
>         rotate (i) cube (10);
>   }
>
> now onthe last object you'd think it's rotated by 90 degrees but in fact
> its 30+60. Each of which was at one point converted to radians, rounded to
> the nearest double and then used to do trigonometry functions...
>
> In fact in this case I know that 30 and 60 in radians will be rounded
> precisely in the same direction: in floating point only the exponent
> differs. Thus the tolerance on the 90 degrees is even larger. And now
> that rotation is no longer precisely 90 degrees....
>
>         Roger.
>
>
> --
> ** R.E.Wolff at BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110
> **
> **    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
> The plan was simple, like my brother-in-law Phil. But unlike
> Phil, this plan just might work.
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20190709/c2ab1744/attachment.html>


More information about the Discuss mailing list