Degrees instead of radians

classic Classic list List threaded Threaded
27 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Degrees instead of radians

szabi

actually using *RAD is even cleaner: you can use it already and don't have to alter, even less break anything.
You could even create a user library with the definition and include it...

You know,  the KISS-principle...

Am 21.03.2014 21:54 schrieb "Johannes Reinhardt" <[hidden email]>:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I like the sin(pi, use_radians=false). It also avoids name space
pollution by leaving RAD free. This seems to be the cleanest of
all proposals.

On Fri, 21 Mar 2014 12:29:44 -0700 (PDT)
tp3 <[hidden email]> wrote:

> Brad Pitcher wrote
> > Would it be insane to have it be configurable via preferences?
>
> Actually yes ;-). That would randomly break existing libraries. I
> think that type of setting should not be installation dependent.
>
>
> Brad Pitcher wrote
> > Or it could even be a variable that is specified in the script, eg:
> >
> > use_degrees = false; // defaults to true
>
> That could work if it's scoped correctly for exactly only the script
> where it's set. It would probably still break scripts imported by
> include<>. It might
> be possible to get use<> behavior correct. It still feels a bit risky
> to do.
>
>
> Brad Pitcher wrote
> > Another similar possibility would be to use a keyword argument to
> > functions
> > that take angles as arguments, eg:
> >
> > sin(pi, use_degrees = false); // use_degrees defaults to true
>
> That's of cause possible, I can't see any risk breaking existing
> scripts with that.
> Hard to say if that's much better than angle * RAD or something
> similar. It might be a bit clearer (but I'd vote for radians=true
> with default false instead).
>
>
>
>
>
>
> -----
> -- Torsten
> --
> View this message in context:
> http://forum.openscad.org/Degrees-instead-of-radians-tp7398p7458.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
> _______________________________________________ OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
> http://openscad.org - https://flattr.com/thing/121566



- --

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBAgAGBQJTLKbmAAoJED3c2393ksVEg1UP/0OxDwZ7REX/L01+uzFLtxxr
RfbI27BDSu4mNJ/SVLPtsHz2mwuFe/6GF13RqI4GxefQse8npu10ujiXH7KlMqqN
rIi/jwmRUh0fRnlgvsQ0dWAZ+YTrU2RPifiTUNQGLt5EVWt02K8t6ksf0/Gtxke2
WXkOKu02LNqygzpMfBXxEaqz7UgMY+zVIWwMsxskyX9UrdR2AR8uj/744KCxR/Es
zaimLjACp7F2O2Xr06aQotQxnuMeruhj+FtkWDL/IEqTU/8ViKMN2FZsxHdwuBWN
4FOkXj9Rgk06yyjfjutyWoUco0XBLKgVYURHzYClrubX1W0wObu3sR5Fe3Vc7Zq2
buQUJ7oYLRmsK9rppAa+/DnHXT1BKM+C7BJgXnR3pkTE6K7zzTvZ2U21/mqHr5a1
EQiGjgpE3vrvKhdeD+Jt1aLAZgtD/uv34HjPTiavqqt1gobzJYWALFky5hid5sXk
+zoe0aXtxPsezo0on1KwXzKF4kTQFfg/Qc/exJN7CoDt6JlbQEQVzUqs3mpqBKw3
/37YO3EmgYA31jDi25rErW2Lhaji411iQqXmZdepJZ0jm9/ggklefDrNBJJzkdDJ
kWeim9MoHrQ8CJ0RDukVVhw5O3lV4Gh5ctRDNizOyJ/7y+VGO9mNtww13bpletcq
bICGbYolnva5x82nTW/T
=G2gx
-----END PGP SIGNATURE-----
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Degrees instead of radians

doug.moen
In reply to this post by Johannes Reinhardt
sin(pi, use_radians=true) is not really as clean as sin(pi * RADIAN) if you consider the bigger context.

If the OpenSCAD community were to start using radians more extensively, then we'll start to see library abstractions where you pass angles in or out as radians instead of as degrees. So now, we've got some library abstractions that use degrees, and some that use radians, and users will need to write code to convert between degrees and angles in order to glue these things together. And maybe some of these library functions & modules will add use_radians= arguments in order to follow the standard set by the trig functions, but it's a lot of extra work and complication to do that, so many authors won't bother.

In other words, I think that setting the precedent of a 'use_radians=' argument in the trig functions will eventually lead to a complicated mess, and won't eliminate the need for a standard idiom to convert between radians and degrees within an expression.


On 21 March 2014 16:53, Johannes Reinhardt <[hidden email]> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I like the sin(pi, use_radians=false). It also avoids name space
pollution by leaving RAD free. This seems to be the cleanest of
all proposals.

On Fri, 21 Mar 2014 12:29:44 -0700 (PDT)
tp3 <[hidden email]> wrote:

> Brad Pitcher wrote
> > Would it be insane to have it be configurable via preferences?
>
> Actually yes ;-). That would randomly break existing libraries. I
> think that type of setting should not be installation dependent.
>
>
> Brad Pitcher wrote
> > Or it could even be a variable that is specified in the script, eg:
> >
> > use_degrees = false; // defaults to true
>
> That could work if it's scoped correctly for exactly only the script
> where it's set. It would probably still break scripts imported by
> include<>. It might
> be possible to get use<> behavior correct. It still feels a bit risky
> to do.
>
>
> Brad Pitcher wrote
> > Another similar possibility would be to use a keyword argument to
> > functions
> > that take angles as arguments, eg:
> >
> > sin(pi, use_degrees = false); // use_degrees defaults to true
>
> That's of cause possible, I can't see any risk breaking existing
> scripts with that.
> Hard to say if that's much better than angle * RAD or something
> similar. It might be a bit clearer (but I'd vote for radians=true
> with default false instead).
>
>
>
>
>
>
> -----
> -- Torsten
> --
> View this message in context:
> http://forum.openscad.org/Degrees-instead-of-radians-tp7398p7458.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
> _______________________________________________ OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
> http://openscad.org - https://flattr.com/thing/121566



- --

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBAgAGBQJTLKbmAAoJED3c2393ksVEg1UP/0OxDwZ7REX/L01+uzFLtxxr
RfbI27BDSu4mNJ/SVLPtsHz2mwuFe/6GF13RqI4GxefQse8npu10ujiXH7KlMqqN
rIi/jwmRUh0fRnlgvsQ0dWAZ+YTrU2RPifiTUNQGLt5EVWt02K8t6ksf0/Gtxke2
WXkOKu02LNqygzpMfBXxEaqz7UgMY+zVIWwMsxskyX9UrdR2AR8uj/744KCxR/Es
zaimLjACp7F2O2Xr06aQotQxnuMeruhj+FtkWDL/IEqTU/8ViKMN2FZsxHdwuBWN
4FOkXj9Rgk06yyjfjutyWoUco0XBLKgVYURHzYClrubX1W0wObu3sR5Fe3Vc7Zq2
buQUJ7oYLRmsK9rppAa+/DnHXT1BKM+C7BJgXnR3pkTE6K7zzTvZ2U21/mqHr5a1
EQiGjgpE3vrvKhdeD+Jt1aLAZgtD/uv34HjPTiavqqt1gobzJYWALFky5hid5sXk
+zoe0aXtxPsezo0on1KwXzKF4kTQFfg/Qc/exJN7CoDt6JlbQEQVzUqs3mpqBKw3
/37YO3EmgYA31jDi25rErW2Lhaji411iQqXmZdepJZ0jm9/ggklefDrNBJJzkdDJ
kWeim9MoHrQ8CJ0RDukVVhw5O3lV4Gh5ctRDNizOyJ/7y+VGO9mNtww13bpletcq
bICGbYolnva5x82nTW/T
=G2gx
-----END PGP SIGNATURE-----
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Degrees instead of radians

Kevin Crowley
I did a quick survey of about 15 members of my local makerspace.  Lots of CNC and 3d printing going on there.  The usual response was "Huh??  Radians?? I never use radians."


On Fri, Mar 21, 2014 at 5:23 PM, doug moen <[hidden email]> wrote:
sin(pi, use_radians=true) is not really as clean as sin(pi * RADIAN) if you consider the bigger context.

If the OpenSCAD community were to start using radians more extensively, then we'll start to see library abstractions where you pass angles in or out as radians instead of as degrees. So now, we've got some library abstractions that use degrees, and some that use radians, and users will need to write code to convert between degrees and angles in order to glue these things together. And maybe some of these library functions & modules will add use_radians= arguments in order to follow the standard set by the trig functions, but it's a lot of extra work and complication to do that, so many authors won't bother.

In other words, I think that setting the precedent of a 'use_radians=' argument in the trig functions will eventually lead to a complicated mess, and won't eliminate the need for a standard idiom to convert between radians and degrees within an expression.


On 21 March 2014 16:53, Johannes Reinhardt <[hidden email]> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I like the sin(pi, use_radians=false). It also avoids name space
pollution by leaving RAD free. This seems to be the cleanest of
all proposals.

On Fri, 21 Mar 2014 12:29:44 -0700 (PDT)
tp3 <[hidden email]> wrote:

> Brad Pitcher wrote
> > Would it be insane to have it be configurable via preferences?
>
> Actually yes ;-). That would randomly break existing libraries. I
> think that type of setting should not be installation dependent.
>
>
> Brad Pitcher wrote
> > Or it could even be a variable that is specified in the script, eg:
> >
> > use_degrees = false; // defaults to true
>
> That could work if it's scoped correctly for exactly only the script
> where it's set. It would probably still break scripts imported by
> include<>. It might
> be possible to get use<> behavior correct. It still feels a bit risky
> to do.
>
>
> Brad Pitcher wrote
> > Another similar possibility would be to use a keyword argument to
> > functions
> > that take angles as arguments, eg:
> >
> > sin(pi, use_degrees = false); // use_degrees defaults to true
>
> That's of cause possible, I can't see any risk breaking existing
> scripts with that.
> Hard to say if that's much better than angle * RAD or something
> similar. It might be a bit clearer (but I'd vote for radians=true
> with default false instead).
>
>
>
>
>
>
> -----
> -- Torsten
> --
> View this message in context:
> http://forum.openscad.org/Degrees-instead-of-radians-tp7398p7458.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
> _______________________________________________ OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
> http://openscad.org - https://flattr.com/thing/121566



- --

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBAgAGBQJTLKbmAAoJED3c2393ksVEg1UP/0OxDwZ7REX/L01+uzFLtxxr
RfbI27BDSu4mNJ/SVLPtsHz2mwuFe/6GF13RqI4GxefQse8npu10ujiXH7KlMqqN
rIi/jwmRUh0fRnlgvsQ0dWAZ+YTrU2RPifiTUNQGLt5EVWt02K8t6ksf0/Gtxke2
WXkOKu02LNqygzpMfBXxEaqz7UgMY+zVIWwMsxskyX9UrdR2AR8uj/744KCxR/Es
zaimLjACp7F2O2Xr06aQotQxnuMeruhj+FtkWDL/IEqTU/8ViKMN2FZsxHdwuBWN
4FOkXj9Rgk06yyjfjutyWoUco0XBLKgVYURHzYClrubX1W0wObu3sR5Fe3Vc7Zq2
buQUJ7oYLRmsK9rppAa+/DnHXT1BKM+C7BJgXnR3pkTE6K7zzTvZ2U21/mqHr5a1
EQiGjgpE3vrvKhdeD+Jt1aLAZgtD/uv34HjPTiavqqt1gobzJYWALFky5hid5sXk
+zoe0aXtxPsezo0on1KwXzKF4kTQFfg/Qc/exJN7CoDt6JlbQEQVzUqs3mpqBKw3
/37YO3EmgYA31jDi25rErW2Lhaji411iQqXmZdepJZ0jm9/ggklefDrNBJJzkdDJ
kWeim9MoHrQ8CJ0RDukVVhw5O3lV4Gh5ctRDNizOyJ/7y+VGO9mNtww13bpletcq
bICGbYolnva5x82nTW/T
=G2gx
-----END PGP SIGNATURE-----
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Degrees instead of radians

Greg Frost
In reply to this post by Johannes Reinhardt
Why not:
sin (radians=pi/2)

Wouldn't this be more consistent with other language features like being able to specify the same circle in the following ways:

circle(10)
circle(r=10)
circle(d=20)
Reply | Threaded
Open this post in threaded view
|

Re: Degrees instead of radians

sclaes
Perhaps it would also be a good idea to allow linear_extrude(h=10)

(h instead of height)


On 28 March 2014 07:35, Greg Frost <[hidden email]> wrote:

> Why not:
> sin (radians=pi/2)
>
> Wouldn't this be more consistent with other language features like being
> able to specify the same circle in the following ways:
>
> circle(10)
> circle(r=10)
> circle(d=20)
>
>
>
> --
> View this message in context: http://forum.openscad.org/Degrees-instead-of-radians-tp7398p7510.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
> http://openscad.org - https://flattr.com/thing/121566
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Degrees instead of radians

sclaes
In reply to this post by Greg Frost
Perhaps it would also be a good idea to allow linear_extrude(h=10)

(h instead of height)


On 28 March 2014 07:35, Greg Frost <[hidden email]> wrote:

> Why not:
> sin (radians=pi/2)
>
> Wouldn't this be more consistent with other language features like being
> able to specify the same circle in the following ways:
>
> circle(10)
> circle(r=10)
> circle(d=20)
>
>
>
> --
> View this message in context: http://forum.openscad.org/Degrees-instead-of-radians-tp7398p7510.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
> http://openscad.org - https://flattr.com/thing/121566
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Degrees instead of radians

kintel
Administrator
In reply to this post by sclaes
On Mar 28, 2014, at 05:58 AM, Stefaan Claes <[hidden email]> wrote:

> Perhaps it would also be a good idea to allow linear_extrude(h=10)
>
That would make sense. I always mistype it.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
12