Skip to content

Commit 537e860

Browse files
committed
Fix: Update sin(), cos(), and tan() docs to respect angleMode() & clarify arc() behavior.
1 parent 389b77d commit 537e860

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/core/shape/2d_primitives.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ p5.prototype._normalizeArcAngles = (
110110
*
111111
* The fifth and sixth parameters, `start` and `stop`, set the angles
112112
* between which to draw the arc. Arcs are always drawn clockwise from
113-
* `start` to `stop`. Angles are always given in radians.
113+
* `start` to `stop`. The fifth and sixth parameters, start and stop, set the
114+
* angles between which to draw the arc. Arcs are always drawn clockwise from
115+
* start to stop. By default, angles are given in radians, but if angleMode
116+
* (DEGREES) is set, the function interprets the values in degrees.
114117
*
115118
* The seventh parameter, `mode`, is optional. It determines the arc's fill
116119
* style. The fill modes are a semi-circle (`OPEN`), a closed semi-circle

src/math/trigonometry.js

+13-7
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,12 @@ p5.prototype.atan2 = function(y, x) {
283283
*
284284
* `cos()` is useful for many geometric tasks in creative coding. The values
285285
* returned oscillate between -1 and 1 as the input angle increases. `cos()`
286-
* takes into account the current <a href="#/p5/angleMode">angleMode()</a>.
286+
* calculates the cosine of an angle, using radians by default, or according to
287+
* if <a href="#/p5/angleMode">angleMode()</a> setting (RADIANS or DEGREES).
287288
*
288289
* @method cos
289-
* @param {Number} angle the angle in radians unless specified by <a href="/reference/p5/angleMode/">angleMode()</a>.
290+
* @param {Number} angle the angle, in radians by default, or according to
291+
* if <a href="/reference/p5/angleMode/">angleMode()</a> setting (RADIANS or DEGREES).
290292
* @return {Number} cosine of the angle.
291293
*
292294
* @example
@@ -363,10 +365,12 @@ p5.prototype.cos = function(angle) {
363365
*
364366
* `sin()` is useful for many geometric tasks in creative coding. The values
365367
* returned oscillate between -1 and 1 as the input angle increases. `sin()`
366-
* takes into account the current <a href="#/p5/angleMode">angleMode()</a>.
368+
* calculates the sine of an angle, using radians by default, or according to
369+
* if <a href="#/p5/angleMode">angleMode()</a> setting (RADIANS or DEGREES).
367370
*
368371
* @method sin
369-
* @param {Number} angle the angle in radians unless specified by <a href="/reference/p5/angleMode/">angleMode()</a>.
372+
* @param {Number} angle the angle, in radians by default, or according to
373+
* if <a href="/reference/p5/angleMode/">angleMode()</a> setting (RADIANS or DEGREES).
370374
* @return {Number} sine of the angle.
371375
*
372376
* @example
@@ -443,11 +447,13 @@ p5.prototype.sin = function(angle) {
443447
*
444448
* `tan()` is useful for many geometric tasks in creative coding. The values
445449
* returned range from -Infinity to Infinity and repeat periodically as the
446-
* input angle increases. `tan()` takes into account the current
447-
* <a href="#/p5/angleMode">angleMode()</a>.
450+
* input angle increases. `tan()` calculates the tan of an angle, using radians
451+
* by default, or according to
452+
* if <a href="#/p5/angleMode">angleMode()</a> setting (RADIANS or DEGREES).
448453
*
449454
* @method tan
450-
* @param {Number} angle the angle in radians unless specified by <a href="/reference/p5/angleMode/">angleMode()</a>.
455+
* @param {Number} angle the angle, in radians by default, or according to
456+
* if <a href="/reference/p5/angleMode/">angleMode()</a> setting (RADIANS or DEGREES).
451457
* @return {Number} tangent of the angle.
452458
*
453459
* @example

0 commit comments

Comments
 (0)