brangerbriz / liBB.js

A JavaScript library/framework for creating interactive && generative apps + installations in/out of the browser
http://libb.brangerbriz.com/
GNU General Public License v3.0
1 stars 2 forks source link

MathUtils.polarToCartesian() #30

Closed nbriz closed 7 years ago

nbriz commented 8 years ago

@brannondorsey was using polarToCartesian( radius, degrees ) && getting some funky results, but then when i passed it ( radius, radians ) it worked as expected. should we change the function so that it actually takes degrees? or should we just change the documentation to radians... or am i missing something else entirely?

brannondorsey commented 8 years ago

Ah, probably related to this. I implemented those functions very quickly and never went back to test very thoroughly. Hm... I don't remember us yet choosing a style for liBB that prefers degrees over radians (or vice versa) as parameters for functions. Do you have a preference? I'd say update it to use whatever you feel makes the most sense and then I can go back and update all uses of the function in the library/examples to match the preferred style. As for preferring radians to degrees I don't care much either way as long as we stay consistent.

nbriz commented 8 years ago

i don't have a preference, but seeing as how the native API's default to radians, maybe we make that our default too?

nbriz commented 7 years ago

i rewrote these two functions ( for what is now called BB.Maths ) like so:

static cartesianToPolar(x, y) 
// returns { distance, radians, degrees }

static polarToCartesian(distance, angle) // angle in radians
// returns { x, y }