Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Update sin(), cos(), and tan() docs to respect angleMode() & cl… #7593

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/core/shape/2d_primitives.js
Original file line number Diff line number Diff line change
@@ -110,7 +110,10 @@ p5.prototype._normalizeArcAngles = (
*
* The fifth and sixth parameters, `start` and `stop`, set the angles
* between which to draw the arc. Arcs are always drawn clockwise from
* `start` to `stop`. Angles are always given in radians.
* `start` to `stop`. The fifth and sixth parameters, start and stop, set the
* angles between which to draw the arc. Arcs are always drawn clockwise from
* start to stop. By default, angles are given in radians, but if angleMode
* (DEGREES) is set, the function interprets the values in degrees.
*
* The seventh parameter, `mode`, is optional. It determines the arc's fill
* style. The fill modes are a semi-circle (`OPEN`), a closed semi-circle
20 changes: 13 additions & 7 deletions src/math/trigonometry.js
Original file line number Diff line number Diff line change
@@ -283,10 +283,12 @@ p5.prototype.atan2 = function(y, x) {
*
* `cos()` is useful for many geometric tasks in creative coding. The values
* returned oscillate between -1 and 1 as the input angle increases. `cos()`
* takes into account the current <a href="#/p5/angleMode">angleMode()</a>.
* calculates the cosine of an angle, using radians by default or degrees if <a
* href="#/p5/angleMode">angleMode(DEGREES)</a> is set.
*
* @method cos
* @param {Number} angle the angle in radians unless specified by <a href="/reference/p5/angleMode/">angleMode()</a>.
* @param {Number} angle the angle, in radians by default or degrees
* if <a href="/reference/p5/angleMode/">angleMode(DEGREES)</a> is set.
* @return {Number} cosine of the angle.
*
* @example
@@ -363,10 +365,12 @@ p5.prototype.cos = function(angle) {
*
* `sin()` is useful for many geometric tasks in creative coding. The values
* returned oscillate between -1 and 1 as the input angle increases. `sin()`
* takes into account the current <a href="#/p5/angleMode">angleMode()</a>.
* calculates the sine of an angle, using radians by default or degrees if <a
* href="#/p5/angleMode">angleMode(DEGREES)</a> is set.
*
* @method sin
* @param {Number} angle the angle in radians unless specified by <a href="/reference/p5/angleMode/">angleMode()</a>.
* @param {Number} angle the angle, in radians by default or degrees
* if <a href="/reference/p5/angleMode/">angleMode(DEGREES)</a> is set.
* @return {Number} sine of the angle.
*
* @example
@@ -443,11 +447,13 @@ p5.prototype.sin = function(angle) {
*
* `tan()` is useful for many geometric tasks in creative coding. The values
* returned range from -Infinity to Infinity and repeat periodically as the
* input angle increases. `tan()` takes into account the current
* <a href="#/p5/angleMode">angleMode()</a>.
* input angle increases. `tan()` calculates the tan of an angle, using radians
* by default or degrees if <a
* href="#/p5/angleMode">angleMode(DEGREES)</a> is set.
*
* @method tan
* @param {Number} angle the angle in radians unless specified by <a href="/reference/p5/angleMode/">angleMode()</a>.
* @param {Number} angle the angle, in radians by default or degrees
* if <a href="/reference/p5/angleMode/">angleMode(DEGREES)</a> is set.
* @return {Number} tangent of the angle.
*
* @example