Discuss Scratch

_7z
Scratcher
3 posts

Option to switch between radians and degrees

Currently, the scratch editor uses degrees for its trig functions, but sometimes it is easier to work with radians.
I am suggesting a block similar to the “set drag mode ( draggable v )” block but instead residing in the operators section, allowing you to switch between radians and degrees for trig.
change trigonometry unit to [ radians v] 
change trigonometry unit to [ degrees v]

Some scratchers may not know how to use this block, which is okay, because those scratchers are the same ones that probably haven't learned trigonometry and will never touch half of the operators.
To minimize confusion, this block should be at the bottom of the list of operators, living with the other complicated ones.
musicROCKS013
Scratcher
1000+ posts

Option to switch between radians and degrees

Fixed blocks:

change trig unit to [radians v] :: operators
change trig unit to [degrees v] :: operators

You can also use a conversion like this to convert degrees to radians:

(((degrees) * (3.141592)) / (180))
_7z
Scratcher
3 posts

Option to switch between radians and degrees

While it is simple to add a variable “rad2deg” in a project and set it to 180/pi, pi is still not implemented into the editor so conversion precision will be lost depending on how accurate your approximation of pi is. Also, if you forget to multiply the radians during a trig operation once, most of the project is probably going to fail (because of the fact that the rest of the project is probably also working with radians). Just putting it out there.

Last edited by _7z (Aug. 7, 2022 17:59:23)

RL1123
Scratcher
1000+ posts

Option to switch between radians and degrees

_7z wrote:

While it is simple to add a variable “rad2deg” in a project and set it to 180/pi, pi is still not implemented into the editor so conversion precision will be lost depending on how accurate your approximation of pi is.
What kind of project needs that much precision? Javascript can only store 16 digits after the decimal point, but 3.14 is already 99.95% of 3.14159265. Extreme precision is not needed, even NASA only uses 15 digits of pi.

_7z wrote:

Also, if you forget to multiply the radians during a trig operation once, most of the project is probably going to fail (because of the fact that the rest of the project is probably also working with radians).
I suppose you could create a custom block that you could use every time you wanted to do a trig operation to prevent forgetting to convert to radians? It's not great, but it's just an idea.
portalpower
Scratcher
1000+ posts

Option to switch between radians and degrees

Just curious, when would an example of when this would be used be.
Viloa_
Scratcher
15 posts

Option to switch between radians and degrees

(()° to radians)
and
(()° to degrees)
Would also be useful

Last edited by Viloa_ (Jan. 19, 2025 06:33:27)

-Kyronis-
Scratcher
59 posts

Option to switch between radians and degrees

Support (my signature says it all)

Last edited by -Kyronis- (Jan. 19, 2025 11:39:58)

Powered by DjangoBB