Color picker improvements

This commit is contained in:
barsdeveloper
2022-10-16 13:56:38 +02:00
parent 0b19d89416
commit 192f2a4c11
23 changed files with 500 additions and 231 deletions

View File

@@ -244,10 +244,14 @@ export default class Utility {
}
/** @param {[Number, Number]} param0 */
static getPolarCoordinates([x, y]) {
static getPolarCoordinates([x, y], positiveTheta = false) {
let theta = Math.atan2(y, x)
if (positiveTheta && theta < 0) {
theta = 2 * Math.PI + theta
}
return [
Math.sqrt(x * x + y * y),
Math.atan2(y, x),
theta,
]
}