discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Improving the doc

YA
Yona Appletree
Mon, Nov 30, 2015 9:25 PM

While that would make some sense, it would be backwards incompatible.
Anything that relied on the projection functionality would be broken.
Probably wouldn't have a huge impact, but it is a breaking change,
nonetheless.

nop head mailto:nop.head@gmail.com
November 30, 2015 at 13:21
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.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
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

While that would make some sense, it would be backwards incompatible. Anything that relied on the projection functionality would be broken. Probably wouldn't have a huge impact, but it is a breaking change, nonetheless. > nop head <mailto:nop.head@gmail.com> > November 30, 2015 at 13:21 > 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. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > 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
NH
nop head
Tue, Dec 1, 2015 12:09 AM

Yes but does anybody rely on an undocumented implicit projection? It was a
total surprise to me when I tried it.

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

While that would make some sense, it would be backwards incompatible.
Anything that relied on the projection functionality would be broken.
Probably wouldn't have a huge impact, but it is a breaking change,
nonetheless.

nop head nop.head@gmail.com
November 30, 2015 at 13:21
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.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
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


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

Yes but does anybody rely on an undocumented implicit projection? It was a total surprise to me when I tried it. On 30 November 2015 at 21:25, Yona Appletree <hypher@gmail.com> wrote: > While that would make some sense, it would be backwards incompatible. > Anything that relied on the projection functionality would be broken. > Probably wouldn't have a huge impact, but it is a breaking change, > nonetheless. > > nop head <nop.head@gmail.com> > November 30, 2015 at 13:21 > 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. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > 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 > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
C
ctchin
Tue, Dec 1, 2015 7:10 AM

cacb wrote

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.

I have made changes to the main section and rotate extrusion subsection:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/2D_to_3D_Extrusion

And added a new subsection
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General_(by_c.t.chin)#Objects

For now I don't see merits in ChrisLT's complaints and proposals except his
complaints about the doc is quite valid and I'm trying my best to improve
it.
It does not help that I also have to learn the underlying logics and
mechanisms
before being able to write some non-garbage into the doc.

Particularly Chris' view of 2D and 3D being not a subset/superset relation
is a
valid one.  So I want to get some authoritative position from the dev on 3D
polygons.
(that's what I call a 2D shape that's been translate()'d or rotate()'d off
the X-Y plane.)
Are they an abomination that is liable to extermination without warning?  Or
are they
there to prepare for a future feature of hull() accepting 3D polygons as
input?

Or there's some deeply mystery behind the disparate behavior of Preview vs.
Render?

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

cacb wrote > 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. I have made changes to the main section and rotate extrusion subsection: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/2D_to_3D_Extrusion And added a new subsection https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General_(by_c.t.chin)#Objects For now I don't see merits in ChrisLT's complaints and proposals except his complaints about the doc is quite valid and I'm trying my best to improve it. It does not help that I also have to learn the underlying logics and mechanisms before being able to write some non-garbage into the doc. Particularly Chris' view of 2D and 3D being not a subset/superset relation is a valid one. So I want to get some authoritative position from the dev on 3D polygons. (that's what I call a 2D shape that's been translate()'d or rotate()'d off the X-Y plane.) Are they an abomination that is liable to extermination without warning? Or are they there to prepare for a future feature of hull() accepting 3D polygons as input? Or there's some deeply mystery behind the disparate behavior of Preview vs. Render? -- View this message in context: http://forum.openscad.org/Improving-the-doc-tp14333p14861.html Sent from the OpenSCAD mailing list archive at Nabble.com.
MK
Marius Kintel
Tue, Dec 1, 2015 11:06 PM

On Nov 30, 2015, at 16:02 PM, Yona Appletree hypher@gmail.com wrote:

In preview, it appears as if the 2d shape is actually treated as being in 3d space:
<image.png>

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

<image.png>

I would consider this a bug. It’s due to a cheap attempt at creating a 3x3 transformation matrix starting with a 4x4 one:
https://github.com/openscad/openscad/blob/master/src/GeometryEvaluator.cc#L566

I have no idea how many are depending on this bug, but we should consider deprecating this and leaving those few behind.

2D display should, ideally, stay 2D in the preview mode as well. That has been a source of confusion for a while.

-Marius

> On Nov 30, 2015, at 16:02 PM, Yona Appletree <hypher@gmail.com> wrote: > > In preview, it appears as if the 2d shape is actually treated as being in 3d space: > <image.png> > > However, if you render the the same, it is projected onto the XY plane: > > <image.png> > I would consider this a bug. It’s due to a cheap attempt at creating a 3x3 transformation matrix starting with a 4x4 one: https://github.com/openscad/openscad/blob/master/src/GeometryEvaluator.cc#L566 I have no idea how many are depending on this bug, but we should consider deprecating this and leaving those few behind. 2D display should, ideally, stay 2D in the preview mode as well. That has been a source of confusion for a while. -Marius
PF
Peter Falke
Wed, Dec 2, 2015 3:25 PM

Any rotation not around the z axis of a 2d-object should through an error.

The question is, is the code that does the rotation 'aware' that it is
acting on a 2d object?

2015-12-02 0:06 GMT+01:00 Marius Kintel marius@kintel.net:

On Nov 30, 2015, at 16:02 PM, Yona Appletree hypher@gmail.com wrote:

In preview, it appears as if the 2d shape is actually treated as being

in 3d space:

<image.png>

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

<image.png>

I would consider this a bug. It’s due to a cheap attempt at creating a 3x3
transformation matrix starting with a 4x4 one:

https://github.com/openscad/openscad/blob/master/src/GeometryEvaluator.cc#L566

I have no idea how many are depending on this bug, but we should consider
deprecating this and leaving those few behind.

2D display should, ideally, stay 2D in the preview mode as well. That has
been a source of confusion for a while.

-Marius


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

Any rotation not around the z axis of a 2d-object should through an error. The question is, is the code that does the rotation 'aware' that it is acting on a 2d object? 2015-12-02 0:06 GMT+01:00 Marius Kintel <marius@kintel.net>: > > On Nov 30, 2015, at 16:02 PM, Yona Appletree <hypher@gmail.com> wrote: > > > > In preview, it appears as if the 2d shape is actually treated as being > in 3d space: > > <image.png> > > > > However, if you render the the same, it is projected onto the XY plane: > > > > <image.png> > > > I would consider this a bug. It’s due to a cheap attempt at creating a 3x3 > transformation matrix starting with a 4x4 one: > > https://github.com/openscad/openscad/blob/master/src/GeometryEvaluator.cc#L566 > > I have no idea how many are depending on this bug, but we should consider > deprecating this and leaving those few behind. > > 2D display should, ideally, stay 2D in the preview mode as well. That has > been a source of confusion for a while. > > -Marius > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >