In one simple sketch sin(30) and cos(30) produce results that appear incorrect while the exact same code in another sketch (from the Examples section) returns the correct result.
Here’s the code in each sketch (placed in the Setup section)
print(sin(30));
print(cos(30));
Screenshot of the erroneous sketch + console output is attached (as a newbie I can only attach one pic). Thx for whatever insights anyone can provide!
Hi! Default setting for both Processing and p5.js are radians. They are similar to the ° (degrees (360)) we use in Europe, however, they are between 0 and PI*2 (TWO_PI). There are several ways to make turn degrees into radians;
Radian - Wikipedia States that:
The radian , denoted by the symbol {\displaystyle {\text{rad}}},[1] is the SI unit for measuring angles, and is the standard unit of angular measure used in many areas of mathematics.