processing / processing/p5.js

Feature: Add function to get the principal value of angles

Open
#5,893 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area:Math Feature Request
Dominant language
JavaScript
Stars
24k
Forks
3.8k
Avg merge
3d 16h
Merged PRs (30d)
25

Description

Increasing Access

While using angles in mathematical and geometric constructions, we often want the angle to be in the principal range i.e. from -180 to 180 degrees (or -PI to PI in radians). We can implement one such utility method.

Most appropriate sub-area of p5.js?
  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build Process
  • Unit Testing
  • Internalization
  • Friendly Errors
  • Other (specify if possible)
Feature request details

The method can be added with documentation in the src/math/trignometry.js file so that he conversion takes place after detecting the current angle mode.

Can also be complemented with another boolean function isPrincipalArgument() to check the same.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/math/trignometry.js and inspect how the current angle mode is detected. Define the principal-angle behavior for degree and radian modes, and determine whether the optional isPrincipalArgument() check belongs in the same API. Update the method documentation and verify the documented ranges and conversions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.