mirror of https://gitee.com/cf-fz/WebCAD.git
parent
5b14b26b40
commit
37e0ccb719
@ -1,53 +0,0 @@
|
|||||||
/**
|
|
||||||
* MathUtils contains auxiliar values and function to help with mathematical operations.
|
|
||||||
* @static
|
|
||||||
*/
|
|
||||||
|
|
||||||
export class MathUtils
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Value of PI*2. 360 degrees.
|
|
||||||
*
|
|
||||||
* @attribute pi2
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
static pi2 = 2 * Math.PI;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Value of PI/3. 60 degrees.
|
|
||||||
*
|
|
||||||
* @attribute pid3
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
static pid3 = Math.PI / 3;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Value of PI/2. 45 degrees.
|
|
||||||
*
|
|
||||||
* @attribute pid2
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
static pid2 = Math.PI / 2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a random color code.
|
|
||||||
*
|
|
||||||
* Uses the #RRGGBB format.
|
|
||||||
*
|
|
||||||
* @method randomColor
|
|
||||||
* @return {String} Generated color code.
|
|
||||||
*/
|
|
||||||
static randomColor()
|
|
||||||
{
|
|
||||||
var letters = "0123456789ABCDEF";
|
|
||||||
var color = "#";
|
|
||||||
|
|
||||||
for (var i = 0; i < 6; i++)
|
|
||||||
{
|
|
||||||
color += letters[Math.floor(Math.random() * 16)];
|
|
||||||
}
|
|
||||||
|
|
||||||
return color;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in new issue