[OpenSCAD] Twisted Torus

Ronaldo Persiano rcmpersiano at gmail.com
Wed Oct 17 13:26:44 EDT 2018

> Secondly I get what you're saying, and believe you me I've ha a lot of
> trouble getting the for loops in openscad to behave. The first for loop
> defining p pretty much explain the issue.

A simple form of a list comprehension for loop without floating point
increments would be:

[ let(N=round(s)  for( i=[0:N], ang = 360*i/N) ...]

which is equivalent to:

[ let(N=round(s)  for( i=[0:N] let( ang = 360*i/N) ...]

A third form is available with snapshot OpenSCAD versions - the C-like for

[ let(N=round(s)  for(i=0, ang=0; i <= round(s) ; i=i+1,  ang = 360*i/N)

Lastly, what about the center point? I know it isn't strictly needed when
> splitting the torus in 2, but I do believe it increases the quality, and it
> certainly is need if you wish to split it into 3 or more, or simply use
> some
> arbitrary angle.

You are right. My simplification of your code for the vertex computation
applies only for your original model.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20181017/d68fbcd6/attachment.html>

More information about the Discuss mailing list