discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Mirror operator

PF
Peter Falke
Thu, Mar 16, 2017 4:24 PM

This subject comes up every few years.
For a long time I thought the best way to deal with this is to add an
option mirror(v,keep=fales/true).
In the hope that this will it make it easier for people to learn OpenSCAD
and to have shorter code.

This subject comes up every few years. For a long time I thought the best way to deal with this is to add an option mirror(v,keep=fales/true). In the hope that this will it make it easier for people to learn OpenSCAD and to have shorter code.
CA
Carsten Arnholm
Thu, Mar 16, 2017 6:58 PM

On 16. mars 2017 17:24, Peter Falke wrote:

This subject comes up every few years.
For a long time I thought the best way to deal with this is to add an
option mirror(v,keep=fales/true).
In the hope that this will it make it easier for people to learn
OpenSCAD and to have shorter code.

I don't think so, it would solidify confusion unless you want to do the
same for translate, rotate, scale and mirror. And multmatrix too.

These are all just variants of the same thing: different ways of
expressing a transformation via a 4x4 homogeneous transformation matrix.
They all simply transform the object to which the transformation is
applied, no children left behind.

Carsten Arnholm

On 16. mars 2017 17:24, Peter Falke wrote: > This subject comes up every few years. > For a long time I thought the best way to deal with this is to add an > option mirror(v,keep=fales/true). > In the hope that this will it make it easier for people to learn > OpenSCAD and to have shorter code. I don't think so, it would solidify confusion unless you want to do the same for translate, rotate, scale and mirror. And multmatrix too. These are all just variants of the same thing: different ways of expressing a transformation via a 4x4 homogeneous transformation matrix. They all simply transform the object to which the transformation is applied, no children left behind. Carsten Arnholm
J
jim_klessig
Thu, Mar 16, 2017 11:19 PM

I would disagree that it "solidifies confusion".
I think the confusion is inherent in the name "mirror".Scale, rotate, and translate do not carry the same basic connotation (that "mirror" does) of "creating a copy".To me "reflect" would have been less confusing. Far more confusing to this new user, was the combination of the words and the illustrations used in the example.

Sent from my U.S. Cellular® Smartphone
-------- Original message --------From: "cacb [via OpenSCAD]" ml-node+s1091067n20936h19@n5.nabble.com Date: 3/16/17  11:59 AM  (GMT-08:00) To: jim_klessig jim.klessig@gmail.com Subject: Re: Mirror operator

On 16. mars 2017 17:24, Peter Falke wrote:

This subject comes up every few years.

For a long time I thought the best way to deal with this is to add an

option mirror(v,keep=fales/true).

In the hope that this will it make it easier for people to learn

OpenSCAD and to have shorter code.

I don't think so, it would solidify confusion unless you want to do the

same for translate, rotate, scale and mirror. And multmatrix too.

These are all just variants of the same thing: different ways of

expressing a transformation via a 4x4 homogeneous transformation matrix.

They all simply transform the object to which the transformation is

applied, no children left behind.

Carsten Arnholm


OpenSCAD mailing list

[hidden email]

http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

	If you reply to this email, your message will be added to the discussion below:
	http://forum.openscad.org/Mirror-operator-tp20900p20936.html


	
	To unsubscribe from Mirror operator, click here.

	NAML

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

I would disagree that it "solidifies confusion". I think the confusion is inherent in the name "mirror".Scale, rotate, and translate do not carry the same basic connotation (that "mirror" does) of "creating a copy".To me "reflect" would have been less confusing. Far more confusing to this new user, was the combination of the words and the illustrations used in the example. Sent from my U.S. Cellular® Smartphone -------- Original message --------From: "cacb [via OpenSCAD]" <ml-node+s1091067n20936h19@n5.nabble.com> Date: 3/16/17 11:59 AM (GMT-08:00) To: jim_klessig <jim.klessig@gmail.com> Subject: Re: Mirror operator On 16. mars 2017 17:24, Peter Falke wrote: > This subject comes up every few years. > For a long time I thought the best way to deal with this is to add an > option mirror(v,keep=fales/true). > In the hope that this will it make it easier for people to learn > OpenSCAD and to have shorter code. I don't think so, it would solidify confusion unless you want to do the same for translate, rotate, scale and mirror. And multmatrix too. These are all just variants of the same thing: different ways of expressing a transformation via a 4x4 homogeneous transformation matrix. They all simply transform the object to which the transformation is applied, no children left behind. Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org If you reply to this email, your message will be added to the discussion below: http://forum.openscad.org/Mirror-operator-tp20900p20936.html To unsubscribe from Mirror operator, click here. NAML -- View this message in context: http://forum.openscad.org/Mirror-operator-tp20900p20937.html Sent from the OpenSCAD mailing list archive at Nabble.com.
JL
Jean-Paul Louis
Fri, Mar 17, 2017 3:36 AM

I do not understand the confusion.
A real life mirror do not create two images. What you see is a mirror image, but you do not see the original object.

So why OpenSCAD should be different? you apply mirror() to an object, and you get the mirror image, not the original object. Nothing is wrong with that.

My $0.02,
Jean-Paul
N1JPL

On Mar 16, 2017, at 7:19 PM, jim_klessig jim.klessig@gmail.com wrote:

I would disagree that it "solidifies confusion".

I think the confusion is inherent in the name "mirror".
Scale, rotate, and translate do not carry the same basic connotation (that "mirror" does) of "creating a copy".
To me "reflect" would have been less confusing. Far more confusing to this new user, was the combination of the words and the illustrations used in the example.

Sent from my U.S. Cellular® Smartphone

-------- Original message --------
From: "cacb [via OpenSCAD]" <[hidden email]>
Date: 3/16/17 11:59 AM (GMT-08:00)
To: jim_klessig <[hidden email]>
Subject: Re: Mirror operator

On 16. mars 2017 17:24, Peter Falke wrote:

This subject comes up every few years.
For a long time I thought the best way to deal with this is to add an
option mirror(v,keep=fales/true).
In the hope that this will it make it easier for people to learn
OpenSCAD and to have shorter code.

I don't think so, it would solidify confusion unless you want to do the
same for translate, rotate, scale and mirror. And multmatrix too.

These are all just variants of the same thing: different ways of
expressing a transformation via a 4x4 homogeneous transformation matrix.
They all simply transform the object to which the transformation is
applied, no children left behind.

Carsten Arnholm


OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

If you reply to this email, your message will be added to the discussion below:
http://forum.openscad.org/Mirror-operator-tp20900p20936.html
To unsubscribe from Mirror operator, click here.
NAML

View this message in context: Re: Mirror operator
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

I do not understand the confusion. A real life mirror do not create two images. What you see is a mirror image, but you do not see the original object. So why OpenSCAD should be different? you apply mirror() to an object, and you get the mirror image, not the original object. Nothing is wrong with that. My $0.02, Jean-Paul N1JPL > On Mar 16, 2017, at 7:19 PM, jim_klessig <jim.klessig@gmail.com> wrote: > > I would disagree that it "solidifies confusion". > > I think the confusion is inherent in the name "mirror". > Scale, rotate, and translate do not carry the same basic connotation (that "mirror" does) of "creating a copy". > To me "reflect" would have been less confusing. Far more confusing to this new user, was the combination of the words and the illustrations used in the example. > > > > > Sent from my U.S. Cellular® Smartphone > > -------- Original message -------- > From: "cacb [via OpenSCAD]" <[hidden email]> > Date: 3/16/17 11:59 AM (GMT-08:00) > To: jim_klessig <[hidden email]> > Subject: Re: Mirror operator > > On 16. mars 2017 17:24, Peter Falke wrote: > > This subject comes up every few years. > > For a long time I thought the best way to deal with this is to add an > > option mirror(v,keep=fales/true). > > In the hope that this will it make it easier for people to learn > > OpenSCAD and to have shorter code. > > I don't think so, it would solidify confusion unless you want to do the > same for translate, rotate, scale and mirror. And multmatrix too. > > These are all just variants of the same thing: different ways of > expressing a transformation via a 4x4 homogeneous transformation matrix. > They all simply transform the object to which the transformation is > applied, no children left behind. > > Carsten Arnholm > > > _______________________________________________ > OpenSCAD mailing list > [hidden email] > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > If you reply to this email, your message will be added to the discussion below: > http://forum.openscad.org/Mirror-operator-tp20900p20936.html > To unsubscribe from Mirror operator, click here. > NAML > > View this message in context: Re: Mirror operator > 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
JL
Jean-Paul Louis
Fri, Mar 17, 2017 3:36 AM

I do not understand the confusion.
A real life mirror do not create two images. What you see is a mirror image, but you do not see the original object.

So why OpenSCAD should be different? you apply mirror() to an object, and you get the mirror image, not the original object. Nothing is wrong with that.

My $0.02,
Jean-Paul
N1JPL

On Mar 16, 2017, at 7:19 PM, jim_klessig jim.klessig@gmail.com wrote:

I would disagree that it "solidifies confusion".

I think the confusion is inherent in the name "mirror".
Scale, rotate, and translate do not carry the same basic connotation (that "mirror" does) of "creating a copy".
To me "reflect" would have been less confusing. Far more confusing to this new user, was the combination of the words and the illustrations used in the example.

Sent from my U.S. Cellular® Smartphone

-------- Original message --------
From: "cacb [via OpenSCAD]" <[hidden email]>
Date: 3/16/17 11:59 AM (GMT-08:00)
To: jim_klessig <[hidden email]>
Subject: Re: Mirror operator

On 16. mars 2017 17:24, Peter Falke wrote:

This subject comes up every few years.
For a long time I thought the best way to deal with this is to add an
option mirror(v,keep=fales/true).
In the hope that this will it make it easier for people to learn
OpenSCAD and to have shorter code.

I don't think so, it would solidify confusion unless you want to do the
same for translate, rotate, scale and mirror. And multmatrix too.

These are all just variants of the same thing: different ways of
expressing a transformation via a 4x4 homogeneous transformation matrix.
They all simply transform the object to which the transformation is
applied, no children left behind.

Carsten Arnholm


OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

If you reply to this email, your message will be added to the discussion below:
http://forum.openscad.org/Mirror-operator-tp20900p20936.html
To unsubscribe from Mirror operator, click here.
NAML

View this message in context: Re: Mirror operator
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

I do not understand the confusion. A real life mirror do not create two images. What you see is a mirror image, but you do not see the original object. So why OpenSCAD should be different? you apply mirror() to an object, and you get the mirror image, not the original object. Nothing is wrong with that. My $0.02, Jean-Paul N1JPL > On Mar 16, 2017, at 7:19 PM, jim_klessig <jim.klessig@gmail.com> wrote: > > I would disagree that it "solidifies confusion". > > I think the confusion is inherent in the name "mirror". > Scale, rotate, and translate do not carry the same basic connotation (that "mirror" does) of "creating a copy". > To me "reflect" would have been less confusing. Far more confusing to this new user, was the combination of the words and the illustrations used in the example. > > > > > Sent from my U.S. Cellular® Smartphone > > -------- Original message -------- > From: "cacb [via OpenSCAD]" <[hidden email]> > Date: 3/16/17 11:59 AM (GMT-08:00) > To: jim_klessig <[hidden email]> > Subject: Re: Mirror operator > > On 16. mars 2017 17:24, Peter Falke wrote: > > This subject comes up every few years. > > For a long time I thought the best way to deal with this is to add an > > option mirror(v,keep=fales/true). > > In the hope that this will it make it easier for people to learn > > OpenSCAD and to have shorter code. > > I don't think so, it would solidify confusion unless you want to do the > same for translate, rotate, scale and mirror. And multmatrix too. > > These are all just variants of the same thing: different ways of > expressing a transformation via a 4x4 homogeneous transformation matrix. > They all simply transform the object to which the transformation is > applied, no children left behind. > > Carsten Arnholm > > > _______________________________________________ > OpenSCAD mailing list > [hidden email] > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > If you reply to this email, your message will be added to the discussion below: > http://forum.openscad.org/Mirror-operator-tp20900p20936.html > To unsubscribe from Mirror operator, click here. > NAML > > View this message in context: Re: Mirror operator > 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
A
arnholm@arnholm.org
Fri, Mar 17, 2017 6:59 AM

On 2017-03-17 00:19, jim_klessig wrote:

I would disagree that it "solidifies confusion".

I think the confusion is inherent in the name "mirror".
Scale, rotate, and translate do not carry the same basic connotation
(that "mirror" does) of "creating a copy".
To me "reflect" would have been less confusing. Far more confusing to
this new user, was the combination of the words and the illustrations
used in the example.

The words translate, rotate, scale and mirror are universal terms in the
context of 3d transformations expressed as 4x4 homogeneous
transformation matrices, just look up any book on transformations in
computer graphics, CAD systems, or finite elements. OpenSCAD has simply
adopted the established nomenclature and interpretation. Applying a new
meaning to these terms would indeed cause more confusion.

Carsten Arnholm

On 2017-03-17 00:19, jim_klessig wrote: > I would disagree that it "solidifies confusion". > > I think the confusion is inherent in the name "mirror". > Scale, rotate, and translate do not carry the same basic connotation > (that "mirror" does) of "creating a copy". > To me "reflect" would have been less confusing. Far more confusing to > this new user, was the combination of the words and the illustrations > used in the example. The words translate, rotate, scale and mirror are universal terms in the context of 3d transformations expressed as 4x4 homogeneous transformation matrices, just look up any book on transformations in computer graphics, CAD systems, or finite elements. OpenSCAD has simply adopted the established nomenclature and interpretation. Applying a new meaning to these terms would indeed cause more confusion. Carsten Arnholm
J
jim_klessig
Fri, Mar 17, 2017 3:11 PM

That argument doesn't quite fly for me. In most cad systems I have ever used, a mirror operation, creates a mirror imaged copy. In many cases with the option of deleting or keeping the original.
The mere fact that we are even having this discussion, illustrates that there EXISTS a "confusion", no matter what it's origination.

Sent from my U.S. Cellular® Smartphone
-------- Original message --------From: "cacb [via OpenSCAD]" ml-node+s1091067n20943h36@n5.nabble.com Date: 3/17/17  12:01 AM  (GMT-08:00) To: jim_klessig jim.klessig@gmail.com Subject: Re: Mirror operator

On 2017-03-17 00:19, jim_klessig wrote:

I would disagree that it "solidifies confusion".

I think the confusion is inherent in the name "mirror".

Scale, rotate, and translate do not carry the same basic connotation

(that "mirror" does) of "creating a copy".

To me "reflect" would have been less confusing. Far more confusing to

this new user, was the combination of the words and the illustrations

used in the example.

The words translate, rotate, scale and mirror are universal terms in the

context of 3d transformations expressed as 4x4 homogeneous

transformation matrices, just look up any book on transformations in

computer graphics, CAD systems, or finite elements. OpenSCAD has simply

adopted the established nomenclature and interpretation. Applying a new

meaning to these terms would indeed cause more confusion.

Carsten Arnholm


OpenSCAD mailing list

[hidden email]

http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

	If you reply to this email, your message will be added to the discussion below:
	http://forum.openscad.org/Mirror-operator-tp20900p20943.html


	
	To unsubscribe from Mirror operator, click here.

	NAML

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

That argument doesn't quite fly for me. In most cad systems I have ever used, a mirror operation, creates a mirror imaged copy. In many cases with the option of deleting or keeping the original. The mere fact that we are even having this discussion, illustrates that there EXISTS a "confusion", no matter what it's origination. Sent from my U.S. Cellular® Smartphone -------- Original message --------From: "cacb [via OpenSCAD]" <ml-node+s1091067n20943h36@n5.nabble.com> Date: 3/17/17 12:01 AM (GMT-08:00) To: jim_klessig <jim.klessig@gmail.com> Subject: Re: Mirror operator On 2017-03-17 00:19, jim_klessig wrote: > I would disagree that it "solidifies confusion". > > I think the confusion is inherent in the name "mirror". > Scale, rotate, and translate do not carry the same basic connotation > (that "mirror" does) of "creating a copy". > To me "reflect" would have been less confusing. Far more confusing to > this new user, was the combination of the words and the illustrations > used in the example. The words translate, rotate, scale and mirror are universal terms in the context of 3d transformations expressed as 4x4 homogeneous transformation matrices, just look up any book on transformations in computer graphics, CAD systems, or finite elements. OpenSCAD has simply adopted the established nomenclature and interpretation. Applying a new meaning to these terms would indeed cause more confusion. Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org If you reply to this email, your message will be added to the discussion below: http://forum.openscad.org/Mirror-operator-tp20900p20943.html To unsubscribe from Mirror operator, click here. NAML -- View this message in context: http://forum.openscad.org/Mirror-operator-tp20900p20944.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Sun, Mar 19, 2017 5:07 PM

Parkinbot wrote

besides the fact that it has really some funny implementation.

Comming back to the utility of mirror. As a reflection, two subsequent
mirrors are equivalent to a rotation:

// rotate children about x axis
module rotX(a)
mirror([0,cos(a/2),sin(a/2)]) mirror([0,1,0]) children();

Although this usually have little interest, there are cases where the
rotation angle computation may be avoided by using mirror. For instance when
we need the minimum angle rotation that brings a direction d0 to a direction
d1:

module rotFromTo(d0,d1)
mirror(unit(d1)+unit(d0)) mirror(d0) children();
function unit(v) = v/norm(v);

This minimum angle rotation is part of the line definition in  Drawing
"lines" in OpenSCAD
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Tips_and_Tricks#Drawing_.22lines.22_in_OpenSCAD
that could be rephrased as:

module line(p0, p1, diameter=1) {
v = p1-p0;
translate(p0)
// rotate the cylinder so its z axis is brought to direction v
rotFromTo([0,0,1],v))
cylinder(d=diameter, h=norm(v), $fn=4);
}

However, thanks to the cylinder symmetries a simpler and more general
polyline may use just one mirror:

module polyline(p,t=1) {
for(i=[0:len(p)-2])
translate(p[i+1])
mirror([0,0,1]+unit(p[i+1]-p[i]))
cylinder(r=t,h=norm(p[i+1]-p[i]));
}
n=500;
k=50;
spiral = [for(i=[0:n])
[cos(-90+180i/n)cos(360i/k),
cos(-90+180
i/n)sin(360i/k),sin(-90+180i/n)]];
polyline(20
spiral,t=1);

http://forum.openscad.org/file/n20960/SphereSpiral.png
Don't try to render it!

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

Parkinbot wrote > besides the fact that it has really some funny implementation. Comming back to the utility of mirror. As a reflection, two subsequent mirrors are equivalent to a rotation: > // rotate children about x axis > module rotX(a) > mirror([0,cos(a/2),sin(a/2)]) mirror([0,1,0]) children(); Although this usually have little interest, there are cases where the rotation angle computation may be avoided by using mirror. For instance when we need the minimum angle rotation that brings a direction d0 to a direction d1: > module rotFromTo(d0,d1) > mirror(unit(d1)+unit(d0)) mirror(d0) children(); > function unit(v) = v/norm(v); This minimum angle rotation is part of the line definition in Drawing "lines" in OpenSCAD <https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Tips_and_Tricks#Drawing_.22lines.22_in_OpenSCAD> that could be rephrased as: > module line(p0, p1, diameter=1) { > v = p1-p0; > translate(p0) > // rotate the cylinder so its z axis is brought to direction v > rotFromTo([0,0,1],v)) > cylinder(d=diameter, h=norm(v), $fn=4); > } However, thanks to the cylinder symmetries a simpler and more general polyline may use just one mirror: > module polyline(p,t=1) { > for(i=[0:len(p)-2]) > translate(p[i+1]) > mirror([0,0,1]+unit(p[i+1]-p[i])) > cylinder(r=t,h=norm(p[i+1]-p[i])); > } > n=500; > k=50; > spiral = [for(i=[0:n]) > [cos(-90+180*i/n)*cos(360*i/k), > cos(-90+180*i/n)*sin(360*i/k),sin(-90+180*i/n)]]; > polyline(20*spiral,t=1); <http://forum.openscad.org/file/n20960/SphereSpiral.png> Don't try to render it! -- View this message in context: http://forum.openscad.org/Mirror-operator-tp20900p20960.html Sent from the OpenSCAD mailing list archive at Nabble.com.