-
Notifications
You must be signed in to change notification settings - Fork 0
DegOperations.js
-
rad(d) ⇒
number
-
converts radians to degrees
-
deg(r) ⇒
number
-
converts degrees to radians
-
sinDeg(a) ⇒
number
-
calculates sines with value in degrees
-
cosDeg(a) ⇒
number
-
calculates cosines with value in degrees
-
tanDeg(a) ⇒
number
-
calculates tangent with value in degrees
-
atanDeg(x) ⇒
number
-
calculates arctangent in degrees
-
ascent(p0, p1) ⇒
number
-
calculates ascent of two two-dimentsional points in radians
-
ascentDeg(p0, p1) ⇒
number
-
calculates ascent of two two-dimentsional points in degrees
-
simplifyRotation(val) ⇒
number
-
Sometimes, it's inpractical when the angles are bigger than a half turn or smaller than -a half turn. This function aims to avoid this problem by 'normalizing' the value
converts radians to degrees
Kind: global function
Returns: number
- number in radians
Param | Type | Description |
---|---|---|
d | number |
number in degree |
Example
DegOperations.rad(0) //is 0
DegOperations.rad(90) === Math.PI/2 //is true
DegOperations.rad(180) === Math.PI //is true
converts degrees to radians
Kind: global function
Returns: number
- number in degree
Param | Type | Description |
---|---|---|
r | number |
number in radians |
Example
DegOperations.deg(0) //is 0
DegOperations.deg(Math.PI) //is 180
calculates sines with value in degrees
Kind: global function
Returns: number
- sines value
Param | Type | Description |
---|---|---|
a | number |
abscissa for the sines function in degrees |
Example
DegOperations.sinDeg(0) //is 0
DegOperations.sinDeg(90) //is 1
calculates cosines with value in degrees
Kind: global function
Returns: number
- cosines value
Param | Type | Description |
---|---|---|
a | number |
abscissa for the cosines function in degrees |
Example
DegOperations.cosDeg(0) //is 1
DegOperations.cosDeg(90) //is 0
DegOperations.cosDeg(180) //is -1
DegOperations.cosDeg(270) //is 0
calculates tangent with value in degrees
Kind: global function
Returns: number
- tangent value
Param | Type | Description |
---|---|---|
a | number |
abscissa for the tangent function in degrees |
Example
DegOperations.tanDeg(0) //is 0
DegOperations.tanDeg(90) //is 16331239353195370
calculates arctangent in degrees
Kind: global function
Returns: number
- arctangent value in degrees
Param | Type | Description |
---|---|---|
x | number |
abscissa for the arctangent function |
Example
DegOperations.atanDeg(0) //is 0
DegOperations.atanDeg(16331239353195370) //is 90
calculates ascent of two two-dimentsional points in radians
Kind: global function
Returns: number
- ascent in rad
Param | Type | Description |
---|---|---|
p0 | Array.<number> |
first of two two-dimensional points |
p1 | Array.<number> |
second of two two-dimensional points |
Example
const p0 = [0, 0],
p1 = [1, 1];
DegOperations.ascent(p0, p1) === Math.PI/4 //is true
Example
const p0 = [0, 0],
p1 = [1, 0];
DegOperations.ascent(p0, p1) //is 0
calculates ascent of two two-dimentsional points in degrees
Kind: global function
Returns: number
- ascent in deg
Param | Type | Description |
---|---|---|
p0 | Array.<number> |
first of two two-dimensional points |
p1 | Array.<number> |
second of two two-dimensional points |
Example
const p0 = [0, 0],
p1 = [1, 1];
DegOperations.ascentDeg(p0, p1) //is 45
Example
const p0 = [0, 0],
p1 = [1, 0];
DegOperations.ascentDeg(p0, p1) //is 0
Sometimes, it's inpractical when the angles are bigger than a half turn or smaller than -a half turn. This function aims to avoid this problem by 'normalizing' the value
Kind: global function
Returns: number
- angle between -πrad and πrad
Param | Type | Description |
---|---|---|
val | number |
initial angle in rad that might be too big or small |
Example
DegOperations.simplifyRotation(0) //is 0
DegOperations.simplifyRotation(2 * Math.PI) //is 0
DegOperations.simplifyRotation(10 * Math.PI + 1) //is 1
Attention: don't edit these files directly! They are auto-generated and pushed by Travis CI. Add your changes in the jsdoc comments in the code files.