discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Improving the doc

MK
Marius Kintel
Fri, Nov 20, 2015 6:35 AM

Hey,

Thanks to all for contributing to the docs.

One question: I see that someone accidentally deleted most of this page: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations

Not sure who, and somehow Wikibooks doesn’t let me undo it, as it thinks it’s “suspicious”.
Could someone with better wikibooks permissions take a look?

Cheers,

-Marius

Hey, Thanks to all for contributing to the docs. One question: I see that someone accidentally deleted most of this page: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations Not sure who, and somehow Wikibooks doesn’t let me undo it, as it thinks it’s “suspicious”. Could someone with better wikibooks permissions take a look? Cheers, -Marius
TP
Torsten Paul
Fri, Nov 20, 2015 7:28 AM

On 11/20/2015 07:35 AM, Marius Kintel wrote:

One question: I see that someone accidentally deleted most of this
page: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations

Ok, I could not "undo" the change - got the same error. But rejecting
it via review worked :-).

I did accept the change in the "Rotation rule help" section as this
looked fine to me...

ciao,
Torsten.

On 11/20/2015 07:35 AM, Marius Kintel wrote: > One question: I see that someone accidentally deleted most of this > page: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations > Ok, I could not "undo" the change - got the same error. But rejecting it via review worked :-). I did accept the change in the "Rotation rule help" section as this looked fine to me... ciao, Torsten.
C
ctchin
Fri, Nov 20, 2015 8:53 AM

Yikes!  It might have been me.  VERY SORRY!

It doesn't help that I can't even tell if it's me.  I found out that
sometimes I was logged out while editing the doc, leaving only some IP
address as the author.

Could the owner of the book limit  editing rights to only those who are
logged in as a registered person on Wikibooks?  At least that way it's
easier to trace mistakes.

I do get distracted a lot during the day, so sometimes I leave a wiki page
in the edit/open state could be some unfortunate combination of events
caused the wiping of Transformations.  Luckily wiki is undo-able.

Thanks and SORRY!

--
View this message in context: http://forum.openscad.org/Improving-the-doc-tp14333p14664.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Yikes! It might have been me. VERY SORRY! It doesn't help that I can't even tell if it's me. I found out that sometimes I was logged out while editing the doc, leaving only some IP address as the author. Could the owner of the book limit editing rights to only those who are logged in as a registered person on Wikibooks? At least that way it's easier to trace mistakes. I do get distracted a lot during the day, so sometimes I leave a wiki page in the edit/open state could be some unfortunate combination of events caused the wiping of Transformations. Luckily wiki is undo-able. Thanks and SORRY! -- View this message in context: http://forum.openscad.org/Improving-the-doc-tp14333p14664.html Sent from the OpenSCAD mailing list archive at Nabble.com.
TP
Torsten Paul
Fri, Nov 20, 2015 10:29 AM

I do get distracted a lot during the day, so sometimes I leave a wiki page
in the edit/open state could be some unfortunate combination of events
caused the wiping of Transformations. Luckily wiki is undo-able.

Don't worry, things happen :-).
There's the review process anyway and even if something slipped through
there, it would be still possible to fix later using the history.

The help with the documentation is very much appreciated.

ciao,
Torsten.

> I do get distracted a lot during the day, so sometimes I leave a wiki page > in the edit/open state could be some unfortunate combination of events > caused the wiping of Transformations. Luckily wiki is undo-able. > Don't worry, things happen :-). There's the review process anyway and even if something slipped through there, it would be still possible to fix later using the history. The help with the documentation is very much appreciated. ciao, Torsten.
C
ctchin
Fri, Nov 20, 2015 10:54 AM

Many thanks to wolf for some thorough checking of my draft versions.  Not
just for spotting my mistakes and deficiencies, but receiving attention and
comments from kintel, tp3 and wolf, especially, is very encouraging.

I've pretty much implemented every one of his suggestions, plus a little
more.  But on recursion:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language/Fast_Guide%28c.t.chin%29#Recursive_function_calls

wolf wrote

I am missing here an example for tail recursion: see johnmdanskin in
http://forum.openscad.org/function-defined-by-recursion-How-not-to-td4299.html#a14086
for an example

A short discussion when to use the one or other form of recursion would
not be amiss here (built-in cut-off limits!).

Here I have only copied verbatim the part from the old doc ,
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#Recursive_functions
adding or subtracting nothing.  My intention was only to illustrate that
relevant sub-topics would be included in the complete ref (currently
misnamed Fast Guide).

I agree the write-up needs improvement and wolf's comment is spot-on.  But
until I read thread mentioned by wolf, I wasn't even aware of tail recursion
(well not quite true... if I think really hard, I might recall from CS101 a
quarter century ago).

So... I'd like to wiggle out of this job: would some kind soul go and fix up
the writing on recursive function calls?  If you be bold, just go ahead and
re-write the original version.  If you be shy, do feel free to experiment
with my Fast Guide, which is unofficial and work-in-progress.  (both links
are found above)

--
View this message in context: http://forum.openscad.org/Improving-the-doc-tp14333p14666.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Many thanks to wolf for some thorough checking of my draft versions. Not just for spotting my mistakes and deficiencies, but receiving attention and comments from kintel, tp3 and wolf, especially, is very encouraging. I've pretty much implemented every one of his suggestions, plus a little more. But on recursion: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language/Fast_Guide%28c.t.chin%29#Recursive_function_calls wolf wrote > I am missing here an example for tail recursion: see johnmdanskin in > http://forum.openscad.org/function-defined-by-recursion-How-not-to-td4299.html#a14086 > for an example > > A short discussion when to use the one or other form of recursion would > not be amiss here (built-in cut-off limits!). Here I have only copied verbatim the part from the old doc , https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#Recursive_functions adding or subtracting nothing. My intention was only to illustrate that relevant sub-topics would be included in the complete ref (currently misnamed Fast Guide). I agree the write-up needs improvement and wolf's comment is spot-on. But until I read thread mentioned by wolf, I wasn't even aware of tail recursion (well not quite true... if I think really hard, I might recall from CS101 a quarter century ago). So... I'd like to wiggle out of this job: would some kind soul go and fix up the writing on recursive function calls? If you be bold, just go ahead and re-write the original version. If you be shy, do feel free to experiment with my Fast Guide, which is unofficial and work-in-progress. (both links are found above) -- View this message in context: http://forum.openscad.org/Improving-the-doc-tp14333p14666.html Sent from the OpenSCAD mailing list archive at Nabble.com.
C
ChrisLT
Mon, Nov 30, 2015 4:11 PM

I think the section on 2D, and especially rotate_extrude, needs some
clarification.
I've only been using OpenSCAD for a few days, but it seems to me that the
best way to think of 2D objects is as follows.

A 2D object has no thickness, so must be extruded to create a 3D object. 2D
objects are created in the XY plane at Z=0. They can be translated and/or
rotated into any other plane. This is particularly useful for text used to
annotate a model.
In order to make it visible, a 2D object is drawn in Preview mode with a
thickness of 1 unit, but there is no actual 3D object at this time.
In Render mode, if the first object to be drawn is 2D, any 3D objects will
be ignored and vice versa. The projection of the 2D objects onto the XY
plane is drawn with zero thickness. To render the 3D objects, make sure the
first object is a solid.

There are two ways to extrude a 2D object into a solid. In both, if the 2D
shape has been translated or rotated out of the Z=0 plane, the extrusion is
of its projection onto that plane:

  • linear_extrude: The 2D object, or its projection, is extruded in the +Z
    direction. Any twist is applied about the Z axis. Positive twist angles
    create a left-hand twist, negative, right-hand. Center=true centres the
    solid above and below the Z=0 plane. It does not centre in X or Y.
    Centre=false extrudes from Z=0 into positive Z. You cannot set negative
    height, but can use translate to move the object into negative Z if needed.
  • rotate_extrude: The 2D shape, or its projection in the XY plane, is first
    rotated 90 degrees about the X axis to put it into the XZ plane, then
    extruded by rotation about the Z axis. You may prefer to think that the 2D
    object was first extruded about the Y axis, then the extrusion rotated to
    put its axis along the Z axis.

The current documentation says you can't use rotate_extrude to create a
model of a screw thread. True - you should use linear_extrude with twist.

Also, it says that if linear_extrude scale is a vector the resulting side
walls may be non-planar. This is relevant for polygons but not circles. It
reveals a bug in the rendering in 2015.03 which can be overcome by setting
the slices and twist parameters.

Also, it incorrectly says center=true centers a rotate_extrusion on the Z
axis. No, it doesn't. It puts the vertical centre at Z=0.

I'd be happy to edit the documentation, but don't know how to go about it.

Chris

--
View this message in context: http://forum.openscad.org/Improving-the-doc-tp14333p14833.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I think the section on 2D, and especially rotate_extrude, needs some clarification. I've only been using OpenSCAD for a few days, but it seems to me that the best way to think of 2D objects is as follows. A 2D object has no thickness, so must be extruded to create a 3D object. 2D objects are created in the XY plane at Z=0. They can be translated and/or rotated into any other plane. This is particularly useful for text used to annotate a model. In order to make it visible, a 2D object is drawn in Preview mode with a thickness of 1 unit, but there is no actual 3D object at this time. In Render mode, if the first object to be drawn is 2D, any 3D objects will be ignored and vice versa. The projection of the 2D objects onto the XY plane is drawn with zero thickness. To render the 3D objects, make sure the first object is a solid. There are two ways to extrude a 2D object into a solid. In both, if the 2D shape has been translated or rotated out of the Z=0 plane, the extrusion is of its projection onto that plane: - linear_extrude: The 2D object, or its projection, is extruded in the +Z direction. Any twist is applied about the Z axis. Positive twist angles create a left-hand twist, negative, right-hand. Center=true centres the solid above and below the Z=0 plane. It does not centre in X or Y. Centre=false extrudes from Z=0 into positive Z. You cannot set negative height, but can use translate to move the object into negative Z if needed. - rotate_extrude: The 2D shape, or its projection in the XY plane, is first rotated 90 degrees about the X axis to put it into the XZ plane, then extruded by rotation about the Z axis. You may prefer to think that the 2D object was first extruded about the Y axis, then the extrusion rotated to put its axis along the Z axis. The current documentation says you can't use rotate_extrude to create a model of a screw thread. True - you should use linear_extrude with twist. Also, it says that if linear_extrude scale is a vector the resulting side walls may be non-planar. This is relevant for polygons but not circles. It reveals a bug in the rendering in 2015.03 which can be overcome by setting the slices and twist parameters. Also, it incorrectly says center=true centers a rotate_extrusion on the Z axis. No, it doesn't. It puts the vertical centre at Z=0. I'd be happy to edit the documentation, but don't know how to go about it. Chris -- View this message in context: http://forum.openscad.org/Improving-the-doc-tp14333p14833.html Sent from the OpenSCAD mailing list archive at Nabble.com.
CA
Carsten Arnholm
Mon, Nov 30, 2015 8:42 PM

On 30. nov. 2015 17:11, ChrisLT wrote:

  • rotate_extrude: The 2D shape, or its projection in the XY plane, is first
    rotated 90 degrees about the X axis to put it into the XZ plane, then
    extruded by rotation about the Z axis. You may prefer to think that the 2D
    object was first extruded about the Y axis, then the extrusion rotated to
    put its axis along the Z axis.

At
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#Rotate_Extrude

...it is stated "Rotational extrusion spins a 2D shape around the Y-axis
to form a solid which has rotational symmetry. The resultant solid is
placed along the Z-axis."

This is very unfortunate and confusing to say the least. What is not
stated is that the Y- and Z-axes mentioned do not refer to the same
coordinate system.

To make some sense of it, the first quoted sentence refers to the Y-axis
on a 2D [X,Y] coordinate system and the second sentence refers to the
Z-axis in a 3D [X,Y,Z] coordinate system. The 2D [X,Y] coordinates do
not correspond to the 3D [X,Y] coordinates.

As ChrisLT says, there is an unstated transformation of the 2D shape
into the 3D XZ plane before the extrusion takes place.

If I could choose, I would have preferred things to be more explicit.
Given that rotations are referring to the 3d Z axis, it really does not
make sense that this does not work:

rotate_extrude()
rotate([0,90,0])
polygon(points=[ [0,0], [100,0], [100,100] ]);

There is no output and no warning is given. The 2d polygon is placed in
the YZ plane, and you would think a rotate_extrude around Z would be
perfectly fine. But the user is simply left wondering what is going on.

On second attempt, one might try to place the polygon in the XZ plane:

rotate_extrude()
rotate([90,0,0])
polygon(points=[ [0,0], [100,0], [100,100] ]);

The result is an infinitely thin circular face in the 3D XY plane. It
really does not make a lot of sense.

Getting a bit desperate at this stage, one might end up trying

rotate_extrude()
rotate([0,0,90])
polygon(points=[ [0,0], [100,0], [100,100] ]);

Which really just rotates the polygon around the Z axis. The result
again is nothing, no warning.

"Ah, ok" you say, "I am mixing 2d coordinates with 3d transformations"
(should be perfectly valid, though). You might perhaps then try
something like:

rotate_extrude()
rotate([90,0])
polygon(points=[ [0,0], [100,0], [100,100] ]);

Perhaps syntactically invalid, but no warning is given. The result is
the same as 2)

  1. so the only thing that "works", but appears broken is

rotate_extrude()
rotate([0,0,0])
polygon(points=[ [0,0], [100,0], [100,100] ]);

or

rotate_extrude()
polygon(points=[ [0,0], [100,0], [100,100] ]);

It is very confusing to someone who actually understands
transformations. The result is not logical.


Can it be fixed? Perhaps like this

rotate_extrude(axis="X")
polygon(points=[ [0,0], [100,0], [100,100] ]);

which (when the "axis" parameter is given) would apply no implicit
rotation, it would simply rotate the 2D polygon around the 3D X-axis,
i.e. the same result as the current

translate([100,0,0])
rotate([0,-90,0])
rotate_extrude()
polygon(points=[ [0,0], [100,0], [100,100] ]);

similarly

rotate_extrude(axis="Y")
polygon(points=[ [0,0], [100,0], [100,100] ]);

would be equivalent to the current

rotate([-90,0,0])
rotate_extrude()
polygon(points=[ [0,0], [100,0], [100,100] ]);

Then, if you don't specify the axis of rotation, you get the old
"nonsensical" default, for reasons of compatibility:

rotate_extrude()
polygon(points=[ [0,0], [100,0], [100,100] ]);

meaning the same as

rotate_extrude(axis="old_style")
polygon(points=[ [0,0], [100,0], [100,100] ]);

Just my thoughts....

Carsten Arnholm

On 30. nov. 2015 17:11, ChrisLT wrote: > - rotate_extrude: The 2D shape, or its projection in the XY plane, is first > rotated 90 degrees about the X axis to put it into the XZ plane, then > extruded by rotation about the Z axis. You may prefer to think that the 2D > object was first extruded about the Y axis, then the extrusion rotated to > put its axis along the Z axis. At https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#Rotate_Extrude ...it is stated "Rotational extrusion spins a 2D shape around the Y-axis to form a solid which has rotational symmetry. The resultant solid is placed along the Z-axis." This is very unfortunate and confusing to say the least. What is not stated is that the Y- and Z-axes mentioned do not refer to the same coordinate system. To make some sense of it, the first quoted sentence refers to the Y-axis on a 2D [X,Y] coordinate system and the second sentence refers to the Z-axis in a 3D [X,Y,Z] coordinate system. The 2D [X,Y] coordinates do *not* correspond to the 3D [X,Y] coordinates. As ChrisLT says, there is an unstated transformation of the 2D shape into the 3D XZ plane before the extrusion takes place. If I could choose, I would have preferred things to be more explicit. Given that rotations are referring to the 3d Z axis, it really does not make sense that this does not work: 1) rotate_extrude() rotate([0,90,0]) polygon(points=[ [0,0], [100,0], [100,100] ]); There is no output and no warning is given. The 2d polygon is placed in the YZ plane, and you would think a rotate_extrude around Z would be perfectly fine. But the user is simply left wondering what is going on. On second attempt, one might try to place the polygon in the XZ plane: 2) rotate_extrude() rotate([90,0,0]) polygon(points=[ [0,0], [100,0], [100,100] ]); The result is an infinitely thin circular face in the 3D XY plane. It really does not make a lot of sense. Getting a bit desperate at this stage, one might end up trying 3) rotate_extrude() rotate([0,0,90]) polygon(points=[ [0,0], [100,0], [100,100] ]); Which really just rotates the polygon around the Z axis. The result again is nothing, no warning. "Ah, ok" you say, "I am mixing 2d coordinates with 3d transformations" (should be perfectly valid, though). You might perhaps then try something like: 4) rotate_extrude() rotate([90,0]) polygon(points=[ [0,0], [100,0], [100,100] ]); Perhaps syntactically invalid, but no warning is given. The result is the same as 2) 5) so the only thing that "works", but appears broken is rotate_extrude() rotate([0,0,0]) polygon(points=[ [0,0], [100,0], [100,100] ]); or rotate_extrude() polygon(points=[ [0,0], [100,0], [100,100] ]); It is very confusing to someone who actually understands transformations. The result is not logical. ---- Can it be fixed? Perhaps like this rotate_extrude(axis="X") polygon(points=[ [0,0], [100,0], [100,100] ]); which (when the "axis" parameter is given) would apply no implicit rotation, it would simply rotate the 2D polygon around the 3D X-axis, i.e. the same result as the current translate([100,0,0]) rotate([0,-90,0]) rotate_extrude() polygon(points=[ [0,0], [100,0], [100,100] ]); similarly rotate_extrude(axis="Y") polygon(points=[ [0,0], [100,0], [100,100] ]); would be equivalent to the current rotate([-90,0,0]) rotate_extrude() polygon(points=[ [0,0], [100,0], [100,100] ]); Then, if you don't specify the axis of rotation, you get the old "nonsensical" default, for reasons of compatibility: rotate_extrude() polygon(points=[ [0,0], [100,0], [100,100] ]); meaning the same as rotate_extrude(axis="old_style") polygon(points=[ [0,0], [100,0], [100,100] ]); Just my thoughts.... Carsten Arnholm
NH
nop head
Mon, Nov 30, 2015 8:57 PM

...it is stated "Rotational extrusion spins a 2D shape around the Y-axis

to form a solid which has rotational symmetry. The resultant solid is
placed along the Z-axis."

This is very unfortunate and confusing to say the least. What is not

stated is that the Y- and Z-axes mentioned do not refer to the same
coordinate system.

The X Y axes of the 2D object are the same as the X Y axes of the 3D
system. If you linear_extrude you see this is true. The Z axis is simply
orthogonal to both. Perhaps it should say "the resulting solid is rotated
90 degrees to have its axis of symmetry aligned with the Z axis".

On 30 November 2015 at 20:42, Carsten Arnholm arnholm@arnholm.org wrote:

On 30. nov. 2015 17:11, ChrisLT wrote:

  • rotate_extrude: The 2D shape, or its projection in the XY plane, is
    first
    rotated 90 degrees about the X axis to put it into the XZ plane, then
    extruded by rotation about the Z axis. You may prefer to think that the 2D
    object was first extruded about the Y axis, then the extrusion rotated to
    put its axis along the Z axis.

At

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#Rotate_Extrude
...it is stated "Rotational extrusion spins a 2D shape around the Y-axis
to form a solid which has rotational symmetry. The resultant solid is
placed along the Z-axis."

This is very unfortunate and confusing to say the least. What is not
stated is that the Y- and Z-axes mentioned do not refer to the same
coordinate system.

To make some sense of it, the first quoted sentence refers to the Y-axis
on a 2D [X,Y] coordinate system and the second sentence refers to the
Z-axis in a 3D [X,Y,Z] coordinate system. The 2D [X,Y] coordinates do not
correspond to the 3D [X,Y] coordinates.

As ChrisLT says, there is an unstated transformation of the 2D shape into
the 3D XZ plane before the extrusion takes place.

If I could choose, I would have preferred things to be more explicit.
Given that rotations are referring to the 3d Z axis, it really does not
make sense that this does not work:

rotate_extrude()
rotate([0,90,0])
polygon(points=[ [0,0], [100,0], [100,100] ]);

There is no output and no warning is given. The 2d polygon is placed in
the YZ plane, and you would think a rotate_extrude around Z would be
perfectly fine. But the user is simply left wondering what is going on.

On second attempt, one might try to place the polygon in the XZ plane:

rotate_extrude()
rotate([90,0,0])
polygon(points=[ [0,0], [100,0], [100,100] ]);

The result is an infinitely thin circular face in the 3D XY plane. It
really does not make a lot of sense.

Getting a bit desperate at this stage, one might end up trying

rotate_extrude()
rotate([0,0,90])
polygon(points=[ [0,0], [100,0], [100,100] ]);

Which really just rotates the polygon around the Z axis. The result again
is nothing, no warning.

"Ah, ok" you say, "I am mixing 2d coordinates with 3d transformations"
(should be perfectly valid, though). You might perhaps then try something
like:

rotate_extrude()
rotate([90,0])
polygon(points=[ [0,0], [100,0], [100,100] ]);

Perhaps syntactically invalid, but no warning is given. The result is the
same as 2)

  1. so the only thing that "works", but appears broken is

rotate_extrude()
rotate([0,0,0])
polygon(points=[ [0,0], [100,0], [100,100] ]);

or

rotate_extrude()
polygon(points=[ [0,0], [100,0], [100,100] ]);

It is very confusing to someone who actually understands transformations.
The result is not logical.


Can it be fixed? Perhaps like this

rotate_extrude(axis="X")
polygon(points=[ [0,0], [100,0], [100,100] ]);

which (when the "axis" parameter is given) would apply no implicit
rotation, it would simply rotate the 2D polygon around the 3D X-axis, i.e.
the same result as the current

translate([100,0,0])
rotate([0,-90,0])
rotate_extrude()
polygon(points=[ [0,0], [100,0], [100,100] ]);

similarly

rotate_extrude(axis="Y")
polygon(points=[ [0,0], [100,0], [100,100] ]);

would be equivalent to the current

rotate([-90,0,0])
rotate_extrude()
polygon(points=[ [0,0], [100,0], [100,100] ]);

Then, if you don't specify the axis of rotation, you get the old
"nonsensical" default, for reasons of compatibility:

rotate_extrude()
polygon(points=[ [0,0], [100,0], [100,100] ]);

meaning the same as

rotate_extrude(axis="old_style")
polygon(points=[ [0,0], [100,0], [100,100] ]);

Just my thoughts....

Carsten Arnholm


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

>...it is stated "Rotational extrusion spins a 2D shape around the Y-axis to form a solid which has rotational symmetry. The resultant solid is placed along the Z-axis." >This is very unfortunate and confusing to say the least. What is not stated is that the Y- and Z-axes mentioned do not refer to the same coordinate system. The X Y axes of the 2D object are the same as the X Y axes of the 3D system. If you linear_extrude you see this is true. The Z axis is simply orthogonal to both. Perhaps it should say "the resulting solid is rotated 90 degrees to have its axis of symmetry aligned with the Z axis". On 30 November 2015 at 20:42, Carsten Arnholm <arnholm@arnholm.org> wrote: > On 30. nov. 2015 17:11, ChrisLT wrote: > >> - rotate_extrude: The 2D shape, or its projection in the XY plane, is >> first >> rotated 90 degrees about the X axis to put it into the XZ plane, then >> extruded by rotation about the Z axis. You may prefer to think that the 2D >> object was first extruded about the Y axis, then the extrusion rotated to >> put its axis along the Z axis. >> > > > At > > https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#Rotate_Extrude > ...it is stated "Rotational extrusion spins a 2D shape around the Y-axis > to form a solid which has rotational symmetry. The resultant solid is > placed along the Z-axis." > > This is very unfortunate and confusing to say the least. What is not > stated is that the Y- and Z-axes mentioned do not refer to the same > coordinate system. > > To make some sense of it, the first quoted sentence refers to the Y-axis > on a 2D [X,Y] coordinate system and the second sentence refers to the > Z-axis in a 3D [X,Y,Z] coordinate system. The 2D [X,Y] coordinates do *not* > correspond to the 3D [X,Y] coordinates. > > As ChrisLT says, there is an unstated transformation of the 2D shape into > the 3D XZ plane before the extrusion takes place. > > If I could choose, I would have preferred things to be more explicit. > Given that rotations are referring to the 3d Z axis, it really does not > make sense that this does not work: > > 1) > rotate_extrude() > rotate([0,90,0]) > polygon(points=[ [0,0], [100,0], [100,100] ]); > > There is no output and no warning is given. The 2d polygon is placed in > the YZ plane, and you would think a rotate_extrude around Z would be > perfectly fine. But the user is simply left wondering what is going on. > > On second attempt, one might try to place the polygon in the XZ plane: > > 2) > rotate_extrude() > rotate([90,0,0]) > polygon(points=[ [0,0], [100,0], [100,100] ]); > > The result is an infinitely thin circular face in the 3D XY plane. It > really does not make a lot of sense. > > Getting a bit desperate at this stage, one might end up trying > > 3) > rotate_extrude() > rotate([0,0,90]) > polygon(points=[ [0,0], [100,0], [100,100] ]); > > Which really just rotates the polygon around the Z axis. The result again > is nothing, no warning. > > "Ah, ok" you say, "I am mixing 2d coordinates with 3d transformations" > (should be perfectly valid, though). You might perhaps then try something > like: > > 4) > rotate_extrude() > rotate([90,0]) > polygon(points=[ [0,0], [100,0], [100,100] ]); > > Perhaps syntactically invalid, but no warning is given. The result is the > same as 2) > > 5) so the only thing that "works", but appears broken is > > rotate_extrude() > rotate([0,0,0]) > polygon(points=[ [0,0], [100,0], [100,100] ]); > > or > > rotate_extrude() > polygon(points=[ [0,0], [100,0], [100,100] ]); > > It is very confusing to someone who actually understands transformations. > The result is not logical. > > ---- > > Can it be fixed? Perhaps like this > > rotate_extrude(axis="X") > polygon(points=[ [0,0], [100,0], [100,100] ]); > > which (when the "axis" parameter is given) would apply no implicit > rotation, it would simply rotate the 2D polygon around the 3D X-axis, i.e. > the same result as the current > > translate([100,0,0]) > rotate([0,-90,0]) > rotate_extrude() > polygon(points=[ [0,0], [100,0], [100,100] ]); > > similarly > > rotate_extrude(axis="Y") > polygon(points=[ [0,0], [100,0], [100,100] ]); > > would be equivalent to the current > > rotate([-90,0,0]) > rotate_extrude() > polygon(points=[ [0,0], [100,0], [100,100] ]); > > Then, if you don't specify the axis of rotation, you get the old > "nonsensical" default, for reasons of compatibility: > > rotate_extrude() > polygon(points=[ [0,0], [100,0], [100,100] ]); > > meaning the same as > > rotate_extrude(axis="old_style") > polygon(points=[ [0,0], [100,0], [100,100] ]); > > > Just my thoughts.... > > Carsten Arnholm > > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
YA
Yona Appletree
Mon, Nov 30, 2015 9:02 PM

It seems to me that the primary confusion here is the difference between
how the *_extrude methods handle 3d-transformed 2d surfaces and how they
are displayed in preview.

Consider a simple example:

 rotate([45,0,0]) circle(r=10);

In preview, it appears as if the 2d shape is actually treated as being
in 3d space:

However, if you render the the same, it is projected onto the XY plane:

If you notice that this is the actual representation of the transformed
2d shape in OpenSCAD, then the extrusion makes much more sense, I think.

Perhaps it would be worth fixing how preview displays transformed 2d
objects?

Perhaps also worth noting this is in the docs? "If you're having trouble
with extrusion, try putting a bang (!) after the extrusion call and then
rendering, to see the 2d representation of what's going to be extruded."

~ Yona

Carsten Arnholm mailto:arnholm@arnholm.org
November 30, 2015 at 12:42

At
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#Rotate_Extrude

...it is stated "Rotational extrusion spins a 2D shape around the
Y-axis to form a solid which has rotational symmetry. The resultant
solid is placed along the Z-axis."

This is very unfortunate and confusing to say the least. What is not
stated is that the Y- and Z-axes mentioned do not refer to the same
coordinate system.

To make some sense of it, the first quoted sentence refers to the
Y-axis on a 2D [X,Y] coordinate system and the second sentence refers
to the Z-axis in a 3D [X,Y,Z] coordinate system. The 2D [X,Y]
coordinates do not correspond to the 3D [X,Y] coordinates.

As ChrisLT says, there is an unstated transformation of the 2D shape
into the 3D XZ plane before the extrusion takes place.

If I could choose, I would have preferred things to be more explicit.
Given that rotations are referring to the 3d Z axis, it really does
not make sense that this does not work:

rotate_extrude()
rotate([0,90,0])
polygon(points=[ [0,0], [100,0], [100,100] ]);

There is no output and no warning is given. The 2d polygon is placed
in the YZ plane, and you would think a rotate_extrude around Z would
be perfectly fine. But the user is simply left wondering what is going
on.

On second attempt, one might try to place the polygon in the XZ plane:

rotate_extrude()
rotate([90,0,0])
polygon(points=[ [0,0], [100,0], [100,100] ]);

The result is an infinitely thin circular face in the 3D XY plane. It
really does not make a lot of sense.

Getting a bit desperate at this stage, one might end up trying

rotate_extrude()
rotate([0,0,90])
polygon(points=[ [0,0], [100,0], [100,100] ]);

Which really just rotates the polygon around the Z axis. The result
again is nothing, no warning.

"Ah, ok" you say, "I am mixing 2d coordinates with 3d transformations"
(should be perfectly valid, though). You might perhaps then try
something like:

rotate_extrude()
rotate([90,0])
polygon(points=[ [0,0], [100,0], [100,100] ]);

Perhaps syntactically invalid, but no warning is given. The result is
the same as 2)

  1. so the only thing that "works", but appears broken is

rotate_extrude()
rotate([0,0,0])
polygon(points=[ [0,0], [100,0], [100,100] ]);

or

rotate_extrude()
polygon(points=[ [0,0], [100,0], [100,100] ]);

It is very confusing to someone who actually understands
transformations. The result is not logical.


Can it be fixed? Perhaps like this

rotate_extrude(axis="X")
polygon(points=[ [0,0], [100,0], [100,100] ]);

which (when the "axis" parameter is given) would apply no implicit
rotation, it would simply rotate the 2D polygon around the 3D X-axis,
i.e. the same result as the current

translate([100,0,0])
rotate([0,-90,0])
rotate_extrude()
polygon(points=[ [0,0], [100,0], [100,100] ]);

similarly

rotate_extrude(axis="Y")
polygon(points=[ [0,0], [100,0], [100,100] ]);

would be equivalent to the current

rotate([-90,0,0])
rotate_extrude()
polygon(points=[ [0,0], [100,0], [100,100] ]);

Then, if you don't specify the axis of rotation, you get the old
"nonsensical" default, for reasons of compatibility:

rotate_extrude()
polygon(points=[ [0,0], [100,0], [100,100] ]);

meaning the same as

rotate_extrude(axis="old_style")
polygon(points=[ [0,0], [100,0], [100,100] ]);

Just my thoughts....

Carsten Arnholm


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
ChrisLT mailto:clusbytaylor@gmail.com
November 30, 2015 at 08:11
I think the section on 2D, and especially rotate_extrude, needs some
clarification.
I've only been using OpenSCAD for a few days, but it seems to me that the
best way to think of 2D objects is as follows.

A 2D object has no thickness, so must be extruded to create a 3D
object. 2D
objects are created in the XY plane at Z=0. They can be translated and/or
rotated into any other plane. This is particularly useful for text used to
annotate a model.
In order to make it visible, a 2D object is drawn in Preview mode with a
thickness of 1 unit, but there is no actual 3D object at this time.
In Render mode, if the first object to be drawn is 2D, any 3D objects will
be ignored and vice versa. The projection of the 2D objects onto the XY
plane is drawn with zero thickness. To render the 3D objects, make
sure the
first object is a solid.

There are two ways to extrude a 2D object into a solid. In both, if the 2D
shape has been translated or rotated out of the Z=0 plane, the
extrusion is
of its projection onto that plane:

  • linear_extrude: The 2D object, or its projection, is extruded in the +Z
    direction. Any twist is applied about the Z axis. Positive twist angles
    create a left-hand twist, negative, right-hand. Center=true centres the
    solid above and below the Z=0 plane. It does not centre in X or Y.
    Centre=false extrudes from Z=0 into positive Z. You cannot set negative
    height, but can use translate to move the object into negative Z if
    needed.
  • rotate_extrude: The 2D shape, or its projection in the XY plane, is
    first
    rotated 90 degrees about the X axis to put it into the XZ plane, then
    extruded by rotation about the Z axis. You may prefer to think that the 2D
    object was first extruded about the Y axis, then the extrusion rotated to
    put its axis along the Z axis.

The current documentation says you can't use rotate_extrude to create a
model of a screw thread. True - you should use linear_extrude with twist.

Also, it says that if linear_extrude scale is a vector the resulting side
walls may be non-planar. This is relevant for polygons but not circles. It
reveals a bug in the rendering in 2015.03 which can be overcome by setting
the slices and twist parameters.

Also, it incorrectly says center=true centers a rotate_extrusion on the Z
axis. No, it doesn't. It puts the vertical centre at Z=0.

I'd be happy to edit the documentation, but don't know how to go about it.

Chris

--
View this message in context:
http://forum.openscad.org/Improving-the-doc-tp14333p14833.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
ctchin mailto:c.t.chin@szu.edu.cn
November 20, 2015 at 02:54
Many thanks to wolf for some thorough checking of my draft versions. Not
just for spotting my mistakes and deficiencies, but receiving
attention and
comments from kintel, tp3 and wolf, especially, is very encouraging.

I've pretty much implemented every one of his suggestions, plus a little
more. But on recursion:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language/Fast_Guide%28c.t.chin%29#Recursive_function_calls

wolf wrote

Here I have only copied verbatim the part from the old doc ,
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#Recursive_functions
adding or subtracting nothing. My intention was only to illustrate that
relevant sub-topics would be included in the complete ref (currently
misnamed Fast Guide).

I agree the write-up needs improvement and wolf's comment is spot-on. But
until I read thread mentioned by wolf, I wasn't even aware of tail
recursion
(well not quite true... if I think really hard, I might recall from
CS101 a
quarter century ago).

So... I'd like to wiggle out of this job: would some kind soul go and
fix up
the writing on recursive function calls? If you be bold, just go ahead and
re-write the original version. If you be shy, do feel free to experiment
with my Fast Guide, which is unofficial and work-in-progress. (both links
are found above)

--
View this message in context:
http://forum.openscad.org/Improving-the-doc-tp14333p14666.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
ctchin mailto:c.t.chin@szu.edu.cn
November 20, 2015 at 00:53
Yikes! It might have been me. VERY SORRY!

It doesn't help that I can't even tell if it's me. I found out that
sometimes I was logged out while editing the doc, leaving only some IP
address as the author.

Could the owner of the book limit editing rights to only those who are
logged in as a registered person on Wikibooks? At least that way it's
easier to trace mistakes.

I do get distracted a lot during the day, so sometimes I leave a wiki page
in the edit/open state could be some unfortunate combination of events
caused the wiping of Transformations. Luckily wiki is undo-able.

Thanks and SORRY!

--
View this message in context:
http://forum.openscad.org/Improving-the-doc-tp14333p14664.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Marius Kintel mailto:marius@kintel.net
November 19, 2015 at 22:35
Hey,

Thanks to all for contributing to the docs.

One question: I see that someone accidentally deleted most of this
page: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations

Not sure who, and somehow Wikibooks doesn't let me undo it, as it
thinks it's "suspicious".
Could someone with better wikibooks permissions take a look?

Cheers,

-Marius


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

It seems to me that the primary confusion here is the difference between how the *_extrude methods handle 3d-transformed 2d surfaces and how they are displayed in preview. Consider a simple example: rotate([45,0,0]) circle(r=10); In preview, it appears as if the 2d shape is actually treated as being in 3d space: However, if you render the the same, it is projected onto the XY plane: If you notice that this is the actual representation of the transformed 2d shape in OpenSCAD, then the extrusion makes much more sense, I think. Perhaps it would be worth fixing how preview displays transformed 2d objects? Perhaps also worth noting this is in the docs? "If you're having trouble with extrusion, try putting a bang (!) after the extrusion call and then rendering, to see the 2d representation of what's going to be extruded." ~ Yona > Carsten Arnholm <mailto:arnholm@arnholm.org> > November 30, 2015 at 12:42 > > > > At > https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#Rotate_Extrude > > ...it is stated "Rotational extrusion spins a 2D shape around the > Y-axis to form a solid which has rotational symmetry. The resultant > solid is placed along the Z-axis." > > This is very unfortunate and confusing to say the least. What is not > stated is that the Y- and Z-axes mentioned do not refer to the same > coordinate system. > > To make some sense of it, the first quoted sentence refers to the > Y-axis on a 2D [X,Y] coordinate system and the second sentence refers > to the Z-axis in a 3D [X,Y,Z] coordinate system. The 2D [X,Y] > coordinates do *not* correspond to the 3D [X,Y] coordinates. > > As ChrisLT says, there is an unstated transformation of the 2D shape > into the 3D XZ plane before the extrusion takes place. > > If I could choose, I would have preferred things to be more explicit. > Given that rotations are referring to the 3d Z axis, it really does > not make sense that this does not work: > > 1) > rotate_extrude() > rotate([0,90,0]) > polygon(points=[ [0,0], [100,0], [100,100] ]); > > There is no output and no warning is given. The 2d polygon is placed > in the YZ plane, and you would think a rotate_extrude around Z would > be perfectly fine. But the user is simply left wondering what is going > on. > > On second attempt, one might try to place the polygon in the XZ plane: > > 2) > rotate_extrude() > rotate([90,0,0]) > polygon(points=[ [0,0], [100,0], [100,100] ]); > > The result is an infinitely thin circular face in the 3D XY plane. It > really does not make a lot of sense. > > Getting a bit desperate at this stage, one might end up trying > > 3) > rotate_extrude() > rotate([0,0,90]) > polygon(points=[ [0,0], [100,0], [100,100] ]); > > Which really just rotates the polygon around the Z axis. The result > again is nothing, no warning. > > "Ah, ok" you say, "I am mixing 2d coordinates with 3d transformations" > (should be perfectly valid, though). You might perhaps then try > something like: > > 4) > rotate_extrude() > rotate([90,0]) > polygon(points=[ [0,0], [100,0], [100,100] ]); > > Perhaps syntactically invalid, but no warning is given. The result is > the same as 2) > > 5) so the only thing that "works", but appears broken is > > rotate_extrude() > rotate([0,0,0]) > polygon(points=[ [0,0], [100,0], [100,100] ]); > > or > > rotate_extrude() > polygon(points=[ [0,0], [100,0], [100,100] ]); > > It is very confusing to someone who actually understands > transformations. The result is not logical. > > ---- > > Can it be fixed? Perhaps like this > > rotate_extrude(axis="X") > polygon(points=[ [0,0], [100,0], [100,100] ]); > > which (when the "axis" parameter is given) would apply no implicit > rotation, it would simply rotate the 2D polygon around the 3D X-axis, > i.e. the same result as the current > > translate([100,0,0]) > rotate([0,-90,0]) > rotate_extrude() > polygon(points=[ [0,0], [100,0], [100,100] ]); > > similarly > > rotate_extrude(axis="Y") > polygon(points=[ [0,0], [100,0], [100,100] ]); > > would be equivalent to the current > > rotate([-90,0,0]) > rotate_extrude() > polygon(points=[ [0,0], [100,0], [100,100] ]); > > Then, if you don't specify the axis of rotation, you get the old > "nonsensical" default, for reasons of compatibility: > > rotate_extrude() > polygon(points=[ [0,0], [100,0], [100,100] ]); > > meaning the same as > > rotate_extrude(axis="old_style") > polygon(points=[ [0,0], [100,0], [100,100] ]); > > > Just my thoughts.... > > Carsten Arnholm > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > ChrisLT <mailto:clusbytaylor@gmail.com> > November 30, 2015 at 08:11 > I think the section on 2D, and especially rotate_extrude, needs some > clarification. > I've only been using OpenSCAD for a few days, but it seems to me that the > best way to think of 2D objects is as follows. > > A 2D object has no thickness, so must be extruded to create a 3D > object. 2D > objects are created in the XY plane at Z=0. They can be translated and/or > rotated into any other plane. This is particularly useful for text used to > annotate a model. > In order to make it visible, a 2D object is drawn in Preview mode with a > thickness of 1 unit, but there is no actual 3D object at this time. > In Render mode, if the first object to be drawn is 2D, any 3D objects will > be ignored and vice versa. The projection of the 2D objects onto the XY > plane is drawn with zero thickness. To render the 3D objects, make > sure the > first object is a solid. > > There are two ways to extrude a 2D object into a solid. In both, if the 2D > shape has been translated or rotated out of the Z=0 plane, the > extrusion is > of its projection onto that plane: > - linear_extrude: The 2D object, or its projection, is extruded in the +Z > direction. Any twist is applied about the Z axis. Positive twist angles > create a left-hand twist, negative, right-hand. Center=true centres the > solid above and below the Z=0 plane. It does not centre in X or Y. > Centre=false extrudes from Z=0 into positive Z. You cannot set negative > height, but can use translate to move the object into negative Z if > needed. > - rotate_extrude: The 2D shape, or its projection in the XY plane, is > first > rotated 90 degrees about the X axis to put it into the XZ plane, then > extruded by rotation about the Z axis. You may prefer to think that the 2D > object was first extruded about the Y axis, then the extrusion rotated to > put its axis along the Z axis. > > The current documentation says you can't use rotate_extrude to create a > model of a screw thread. True - you should use linear_extrude with twist. > > Also, it says that if linear_extrude scale is a vector the resulting side > walls may be non-planar. This is relevant for polygons but not circles. It > reveals a bug in the rendering in 2015.03 which can be overcome by setting > the slices and twist parameters. > > Also, it incorrectly says center=true centers a rotate_extrusion on the Z > axis. No, it doesn't. It puts the vertical centre at Z=0. > > I'd be happy to edit the documentation, but don't know how to go about it. > > Chris > > > > -- > View this message in context: > http://forum.openscad.org/Improving-the-doc-tp14333p14833.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > ctchin <mailto:c.t.chin@szu.edu.cn> > November 20, 2015 at 02:54 > Many thanks to wolf for some thorough checking of my draft versions. Not > just for spotting my mistakes and deficiencies, but receiving > attention and > comments from kintel, tp3 and wolf, especially, is very encouraging. > > I've pretty much implemented every one of his suggestions, plus a little > more. But on recursion: > https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language/Fast_Guide%28c.t.chin%29#Recursive_function_calls > > > wolf wrote > > Here I have only copied verbatim the part from the old doc , > https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#Recursive_functions > adding or subtracting nothing. My intention was only to illustrate that > relevant sub-topics would be included in the complete ref (currently > misnamed Fast Guide). > > I agree the write-up needs improvement and wolf's comment is spot-on. But > until I read thread mentioned by wolf, I wasn't even aware of tail > recursion > (well not quite true... if I think really hard, I might recall from > CS101 a > quarter century ago). > > So... I'd like to wiggle out of this job: would some kind soul go and > fix up > the writing on recursive function calls? If you be bold, just go ahead and > re-write the original version. If you be shy, do feel free to experiment > with my Fast Guide, which is unofficial and work-in-progress. (both links > are found above) > > > > > > -- > View this message in context: > http://forum.openscad.org/Improving-the-doc-tp14333p14666.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > ctchin <mailto:c.t.chin@szu.edu.cn> > November 20, 2015 at 00:53 > Yikes! It might have been me. VERY SORRY! > > It doesn't help that I can't even tell if it's me. I found out that > sometimes I was logged out while editing the doc, leaving only some IP > address as the author. > > Could the owner of the book limit editing rights to only those who are > logged in as a registered person on Wikibooks? At least that way it's > easier to trace mistakes. > > I do get distracted a lot during the day, so sometimes I leave a wiki page > in the edit/open state could be some unfortunate combination of events > caused the wiping of Transformations. Luckily wiki is undo-able. > > Thanks and SORRY! > > > > > -- > View this message in context: > http://forum.openscad.org/Improving-the-doc-tp14333p14664.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > Marius Kintel <mailto:marius@kintel.net> > November 19, 2015 at 22:35 > Hey, > > Thanks to all for contributing to the docs. > > One question: I see that someone accidentally deleted most of this > page: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations > > Not sure who, and somehow Wikibooks doesn't let me undo it, as it > thinks it's "suspicious". > Could someone with better wikibooks permissions take a look? > > Cheers, > > -Marius > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
NH
nop head
Mon, Nov 30, 2015 9:21 PM

I don't think X Y rotations should have any effect when the child is a 2D
object. Then F5 and F6 would be consistent, both a circle in this case.
Also F5 should render 2D objects as a very thin 3D object, not 1 unit thick.

On 30 November 2015 at 21:02, Yona Appletree hypher@gmail.com wrote:

It seems to me that the primary confusion here is the difference between
how the *_extrude methods handle 3d-transformed 2d surfaces and how they
are displayed in preview.

Consider a simple example:

 rotate([45,0,0]) circle(r=10);

In preview, it appears as if the 2d shape is actually treated as being in
3d space:

However, if you render the the same, it is projected onto the XY plane:

If you notice that this is the actual representation of the transformed 2d
shape in OpenSCAD, then the extrusion makes much more sense, I think.

Perhaps it would be worth fixing how preview displays transformed 2d
objects?

Perhaps also worth noting this is in the docs? "If you're having trouble
with extrusion, try putting a bang (!) after the extrusion call and then
rendering, to see the 2d representation of what's going to be extruded."

~ Yona

Carsten Arnholm arnholm@arnholm.org
November 30, 2015 at 12:42

At

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#Rotate_Extrude
...it is stated "Rotational extrusion spins a 2D shape around the Y-axis
to form a solid which has rotational symmetry. The resultant solid is
placed along the Z-axis."

This is very unfortunate and confusing to say the least. What is not
stated is that the Y- and Z-axes mentioned do not refer to the same
coordinate system.

To make some sense of it, the first quoted sentence refers to the Y-axis
on a 2D [X,Y] coordinate system and the second sentence refers to the
Z-axis in a 3D [X,Y,Z] coordinate system. The 2D [X,Y] coordinates do not
correspond to the 3D [X,Y] coordinates.

As ChrisLT says, there is an unstated transformation of the 2D shape into
the 3D XZ plane before the extrusion takes place.

If I could choose, I would have preferred things to be more explicit.
Given that rotations are referring to the 3d Z axis, it really does not
make sense that this does not work:

rotate_extrude()
rotate([0,90,0])
polygon(points=[ [0,0], [100,0], [100,100] ]);

There is no output and no warning is given. The 2d polygon is placed in
the YZ plane, and you would think a rotate_extrude around Z would be
perfectly fine. But the user is simply left wondering what is going on.

On second attempt, one might try to place the polygon in the XZ plane:

rotate_extrude()
rotate([90,0,0])
polygon(points=[ [0,0], [100,0], [100,100] ]);

The result is an infinitely thin circular face in the 3D XY plane. It
really does not make a lot of sense.

Getting a bit desperate at this stage, one might end up trying

rotate_extrude()
rotate([0,0,90])
polygon(points=[ [0,0], [100,0], [100,100] ]);

Which really just rotates the polygon around the Z axis. The result again
is nothing, no warning.

"Ah, ok" you say, "I am mixing 2d coordinates with 3d transformations"
(should be perfectly valid, though). You might perhaps then try something
like:

rotate_extrude()
rotate([90,0])
polygon(points=[ [0,0], [100,0], [100,100] ]);

Perhaps syntactically invalid, but no warning is given. The result is the
same as 2)

  1. so the only thing that "works", but appears broken is

rotate_extrude()
rotate([0,0,0])
polygon(points=[ [0,0], [100,0], [100,100] ]);

or

rotate_extrude()
polygon(points=[ [0,0], [100,0], [100,100] ]);

It is very confusing to someone who actually understands transformations.
The result is not logical.


Can it be fixed? Perhaps like this

rotate_extrude(axis="X")
polygon(points=[ [0,0], [100,0], [100,100] ]);

which (when the "axis" parameter is given) would apply no implicit
rotation, it would simply rotate the 2D polygon around the 3D X-axis, i.e.
the same result as the current

translate([100,0,0])
rotate([0,-90,0])
rotate_extrude()
polygon(points=[ [0,0], [100,0], [100,100] ]);

similarly

rotate_extrude(axis="Y")
polygon(points=[ [0,0], [100,0], [100,100] ]);

would be equivalent to the current

rotate([-90,0,0])
rotate_extrude()
polygon(points=[ [0,0], [100,0], [100,100] ]);

Then, if you don't specify the axis of rotation, you get the old
"nonsensical" default, for reasons of compatibility:

rotate_extrude()
polygon(points=[ [0,0], [100,0], [100,100] ]);

meaning the same as

rotate_extrude(axis="old_style")
polygon(points=[ [0,0], [100,0], [100,100] ]);

Just my thoughts....

Carsten Arnholm


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
ChrisLT clusbytaylor@gmail.com
November 30, 2015 at 08:11
I think the section on 2D, and especially rotate_extrude, needs some
clarification.
I've only been using OpenSCAD for a few days, but it seems to me that the
best way to think of 2D objects is as follows.

A 2D object has no thickness, so must be extruded to create a 3D object. 2D
objects are created in the XY plane at Z=0. They can be translated and/or
rotated into any other plane. This is particularly useful for text used to
annotate a model.
In order to make it visible, a 2D object is drawn in Preview mode with a
thickness of 1 unit, but there is no actual 3D object at this time.
In Render mode, if the first object to be drawn is 2D, any 3D objects will
be ignored and vice versa. The projection of the 2D objects onto the XY
plane is drawn with zero thickness. To render the 3D objects, make sure the
first object is a solid.

There are two ways to extrude a 2D object into a solid. In both, if the 2D
shape has been translated or rotated out of the Z=0 plane, the extrusion is
of its projection onto that plane:

  • linear_extrude: The 2D object, or its projection, is extruded in the +Z
    direction. Any twist is applied about the Z axis. Positive twist angles
    create a left-hand twist, negative, right-hand. Center=true centres the
    solid above and below the Z=0 plane. It does not centre in X or Y.
    Centre=false extrudes from Z=0 into positive Z. You cannot set negative
    height, but can use translate to move the object into negative Z if needed.
  • rotate_extrude: The 2D shape, or its projection in the XY plane, is first
    rotated 90 degrees about the X axis to put it into the XZ plane, then
    extruded by rotation about the Z axis. You may prefer to think that the 2D
    object was first extruded about the Y axis, then the extrusion rotated to
    put its axis along the Z axis.

The current documentation says you can't use rotate_extrude to create a
model of a screw thread. True - you should use linear_extrude with twist.

Also, it says that if linear_extrude scale is a vector the resulting side
walls may be non-planar. This is relevant for polygons but not circles. It
reveals a bug in the rendering in 2015.03 which can be overcome by setting
the slices and twist parameters.

Also, it incorrectly says center=true centers a rotate_extrusion on the Z
axis. No, it doesn't. It puts the vertical centre at Z=0.

I'd be happy to edit the documentation, but don't know how to go about it.

Chris

--
View this message in context:
http://forum.openscad.org/Improving-the-doc-tp14333p14833.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
ctchin c.t.chin@szu.edu.cn
November 20, 2015 at 02:54
Many thanks to wolf for some thorough checking of my draft versions. Not
just for spotting my mistakes and deficiencies, but receiving attention and
comments from kintel, tp3 and wolf, especially, is very encouraging.

I've pretty much implemented every one of his suggestions, plus a little
more. But on recursion:

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language/Fast_Guide%28c.t.chin%29#Recursive_function_calls

wolf wrote

Here I have only copied verbatim the part from the old doc ,

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#Recursive_functions
adding or subtracting nothing. My intention was only to illustrate that
relevant sub-topics would be included in the complete ref (currently
misnamed Fast Guide).

I agree the write-up needs improvement and wolf's comment is spot-on. But
until I read thread mentioned by wolf, I wasn't even aware of tail
recursion
(well not quite true... if I think really hard, I might recall from CS101 a
quarter century ago).

So... I'd like to wiggle out of this job: would some kind soul go and fix
up
the writing on recursive function calls? If you be bold, just go ahead and
re-write the original version. If you be shy, do feel free to experiment
with my Fast Guide, which is unofficial and work-in-progress. (both links
are found above)

--
View this message in context:
http://forum.openscad.org/Improving-the-doc-tp14333p14666.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
ctchin c.t.chin@szu.edu.cn
November 20, 2015 at 00:53
Yikes! It might have been me. VERY SORRY!

It doesn't help that I can't even tell if it's me. I found out that
sometimes I was logged out while editing the doc, leaving only some IP
address as the author.

Could the owner of the book limit editing rights to only those who are
logged in as a registered person on Wikibooks? At least that way it's
easier to trace mistakes.

I do get distracted a lot during the day, so sometimes I leave a wiki page
in the edit/open state could be some unfortunate combination of events
caused the wiping of Transformations. Luckily wiki is undo-able.

Thanks and SORRY!

--
View this message in context:
http://forum.openscad.org/Improving-the-doc-tp14333p14664.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Marius Kintel marius@kintel.net
November 19, 2015 at 22:35
Hey,

Thanks to all for contributing to the docs.

One question: I see that someone accidentally deleted most of this page:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations

Not sure who, and somehow Wikibooks doesn’t let me undo it, as it thinks
it’s “suspicious”.
Could someone with better wikibooks permissions take a look?

Cheers,

-Marius


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I don't think X Y rotations should have any effect when the child is a 2D object. Then F5 and F6 would be consistent, both a circle in this case. Also F5 should render 2D objects as a very thin 3D object, not 1 unit thick. On 30 November 2015 at 21:02, Yona Appletree <hypher@gmail.com> wrote: > It seems to me that the primary confusion here is the difference between > how the *_extrude methods handle 3d-transformed 2d surfaces and how they > are displayed in preview. > > Consider a simple example: > > rotate([45,0,0]) circle(r=10); > > In preview, it appears as if the 2d shape is actually treated as being in > 3d space: > > > However, if you render the the same, it is projected onto the XY plane: > > > > If you notice that this is the actual representation of the transformed 2d > shape in OpenSCAD, then the extrusion makes much more sense, I think. > > Perhaps it would be worth fixing how preview displays transformed 2d > objects? > > Perhaps also worth noting this is in the docs? "If you're having trouble > with extrusion, try putting a bang (!) after the extrusion call and then > rendering, to see the 2d representation of what's going to be extruded." > > ~ Yona > > Carsten Arnholm <arnholm@arnholm.org> > November 30, 2015 at 12:42 > > > > At > > https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#Rotate_Extrude > ...it is stated "Rotational extrusion spins a 2D shape around the Y-axis > to form a solid which has rotational symmetry. The resultant solid is > placed along the Z-axis." > > This is very unfortunate and confusing to say the least. What is not > stated is that the Y- and Z-axes mentioned do not refer to the same > coordinate system. > > To make some sense of it, the first quoted sentence refers to the Y-axis > on a 2D [X,Y] coordinate system and the second sentence refers to the > Z-axis in a 3D [X,Y,Z] coordinate system. The 2D [X,Y] coordinates do *not* > correspond to the 3D [X,Y] coordinates. > > As ChrisLT says, there is an unstated transformation of the 2D shape into > the 3D XZ plane before the extrusion takes place. > > If I could choose, I would have preferred things to be more explicit. > Given that rotations are referring to the 3d Z axis, it really does not > make sense that this does not work: > > 1) > rotate_extrude() > rotate([0,90,0]) > polygon(points=[ [0,0], [100,0], [100,100] ]); > > There is no output and no warning is given. The 2d polygon is placed in > the YZ plane, and you would think a rotate_extrude around Z would be > perfectly fine. But the user is simply left wondering what is going on. > > On second attempt, one might try to place the polygon in the XZ plane: > > 2) > rotate_extrude() > rotate([90,0,0]) > polygon(points=[ [0,0], [100,0], [100,100] ]); > > The result is an infinitely thin circular face in the 3D XY plane. It > really does not make a lot of sense. > > Getting a bit desperate at this stage, one might end up trying > > 3) > rotate_extrude() > rotate([0,0,90]) > polygon(points=[ [0,0], [100,0], [100,100] ]); > > Which really just rotates the polygon around the Z axis. The result again > is nothing, no warning. > > "Ah, ok" you say, "I am mixing 2d coordinates with 3d transformations" > (should be perfectly valid, though). You might perhaps then try something > like: > > 4) > rotate_extrude() > rotate([90,0]) > polygon(points=[ [0,0], [100,0], [100,100] ]); > > Perhaps syntactically invalid, but no warning is given. The result is the > same as 2) > > 5) so the only thing that "works", but appears broken is > > rotate_extrude() > rotate([0,0,0]) > polygon(points=[ [0,0], [100,0], [100,100] ]); > > or > > rotate_extrude() > polygon(points=[ [0,0], [100,0], [100,100] ]); > > It is very confusing to someone who actually understands transformations. > The result is not logical. > > ---- > > Can it be fixed? Perhaps like this > > rotate_extrude(axis="X") > polygon(points=[ [0,0], [100,0], [100,100] ]); > > which (when the "axis" parameter is given) would apply no implicit > rotation, it would simply rotate the 2D polygon around the 3D X-axis, i.e. > the same result as the current > > translate([100,0,0]) > rotate([0,-90,0]) > rotate_extrude() > polygon(points=[ [0,0], [100,0], [100,100] ]); > > similarly > > rotate_extrude(axis="Y") > polygon(points=[ [0,0], [100,0], [100,100] ]); > > would be equivalent to the current > > rotate([-90,0,0]) > rotate_extrude() > polygon(points=[ [0,0], [100,0], [100,100] ]); > > Then, if you don't specify the axis of rotation, you get the old > "nonsensical" default, for reasons of compatibility: > > rotate_extrude() > polygon(points=[ [0,0], [100,0], [100,100] ]); > > meaning the same as > > rotate_extrude(axis="old_style") > polygon(points=[ [0,0], [100,0], [100,100] ]); > > > Just my thoughts.... > > Carsten Arnholm > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > ChrisLT <clusbytaylor@gmail.com> > November 30, 2015 at 08:11 > I think the section on 2D, and especially rotate_extrude, needs some > clarification. > I've only been using OpenSCAD for a few days, but it seems to me that the > best way to think of 2D objects is as follows. > > A 2D object has no thickness, so must be extruded to create a 3D object. 2D > objects are created in the XY plane at Z=0. They can be translated and/or > rotated into any other plane. This is particularly useful for text used to > annotate a model. > In order to make it visible, a 2D object is drawn in Preview mode with a > thickness of 1 unit, but there is no actual 3D object at this time. > In Render mode, if the first object to be drawn is 2D, any 3D objects will > be ignored and vice versa. The projection of the 2D objects onto the XY > plane is drawn with zero thickness. To render the 3D objects, make sure the > first object is a solid. > > There are two ways to extrude a 2D object into a solid. In both, if the 2D > shape has been translated or rotated out of the Z=0 plane, the extrusion is > of its projection onto that plane: > - linear_extrude: The 2D object, or its projection, is extruded in the +Z > direction. Any twist is applied about the Z axis. Positive twist angles > create a left-hand twist, negative, right-hand. Center=true centres the > solid above and below the Z=0 plane. It does not centre in X or Y. > Centre=false extrudes from Z=0 into positive Z. You cannot set negative > height, but can use translate to move the object into negative Z if needed. > - rotate_extrude: The 2D shape, or its projection in the XY plane, is first > rotated 90 degrees about the X axis to put it into the XZ plane, then > extruded by rotation about the Z axis. You may prefer to think that the 2D > object was first extruded about the Y axis, then the extrusion rotated to > put its axis along the Z axis. > > The current documentation says you can't use rotate_extrude to create a > model of a screw thread. True - you should use linear_extrude with twist. > > Also, it says that if linear_extrude scale is a vector the resulting side > walls may be non-planar. This is relevant for polygons but not circles. It > reveals a bug in the rendering in 2015.03 which can be overcome by setting > the slices and twist parameters. > > Also, it incorrectly says center=true centers a rotate_extrusion on the Z > axis. No, it doesn't. It puts the vertical centre at Z=0. > > I'd be happy to edit the documentation, but don't know how to go about it. > > Chris > > > > -- > View this message in context: > http://forum.openscad.org/Improving-the-doc-tp14333p14833.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > ctchin <c.t.chin@szu.edu.cn> > November 20, 2015 at 02:54 > Many thanks to wolf for some thorough checking of my draft versions. Not > just for spotting my mistakes and deficiencies, but receiving attention and > comments from kintel, tp3 and wolf, especially, is very encouraging. > > I've pretty much implemented every one of his suggestions, plus a little > more. But on recursion: > > https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language/Fast_Guide%28c.t.chin%29#Recursive_function_calls > > > wolf wrote > > Here I have only copied verbatim the part from the old doc , > > https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#Recursive_functions > adding or subtracting nothing. My intention was only to illustrate that > relevant sub-topics would be included in the complete ref (currently > misnamed Fast Guide). > > I agree the write-up needs improvement and wolf's comment is spot-on. But > until I read thread mentioned by wolf, I wasn't even aware of tail > recursion > (well not quite true... if I think really hard, I might recall from CS101 a > quarter century ago). > > So... I'd like to wiggle out of this job: would some kind soul go and fix > up > the writing on recursive function calls? If you be bold, just go ahead and > re-write the original version. If you be shy, do feel free to experiment > with my Fast Guide, which is unofficial and work-in-progress. (both links > are found above) > > > > > > -- > View this message in context: > http://forum.openscad.org/Improving-the-doc-tp14333p14666.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > ctchin <c.t.chin@szu.edu.cn> > November 20, 2015 at 00:53 > Yikes! It might have been me. VERY SORRY! > > It doesn't help that I can't even tell if it's me. I found out that > sometimes I was logged out while editing the doc, leaving only some IP > address as the author. > > Could the owner of the book limit editing rights to only those who are > logged in as a registered person on Wikibooks? At least that way it's > easier to trace mistakes. > > I do get distracted a lot during the day, so sometimes I leave a wiki page > in the edit/open state could be some unfortunate combination of events > caused the wiping of Transformations. Luckily wiki is undo-able. > > Thanks and SORRY! > > > > > -- > View this message in context: > http://forum.openscad.org/Improving-the-doc-tp14333p14664.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > Marius Kintel <marius@kintel.net> > November 19, 2015 at 22:35 > Hey, > > Thanks to all for contributing to the docs. > > One question: I see that someone accidentally deleted most of this page: > https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations > > Not sure who, and somehow Wikibooks doesn’t let me undo it, as it thinks > it’s “suspicious”. > Could someone with better wikibooks permissions take a look? > > Cheers, > > -Marius > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >