Coppercube API Documentation
Class Core
Contains basic helper functions to convert between angles, finding minima and maxima of numbers and similar
Class Overview
Core()
Contains basic helper functions to convert between angles, finding minima and maxima of numbers and similar
Field Attributes | Field Name and Description |
---|---|
<static> |
Core.TOLERANCE
Low tolerance value deciding which floating point values are considered equal.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
Core.clamp(n, low, high)
Returns a new value which is clamped between low and high.
|
<static> |
Core.createColor(a, r, g, b)
Creates a 32bit value representing a color
|
<static> |
Core.degToRad(deg)
Converts an angle from degrees to radians.
|
<static> |
Core.equals(a, b)
Returns if two floating point values are considered similar, depending on TOLERANCE.
|
<static> |
Core.fract(n)
Returns the fraction part of a floating point value.
|
<static> |
Core.getAlpha(clr)
Returns the alpha component of a color compressed into one 32bit integer value
|
<static> |
Core.getBlue(clr)
Returns the blue component of a color compressed into one 32bit integer value
|
<static> |
Core.getGreen(clr)
Returns the green component of a color compressed into one 32bit integer value
|
<static> |
Core.getRed(clr)
Returns the red component of a color compressed into one 32bit integer value
|
<static> |
Core.isone(a)
Returns if a floating point value is considered similar to 0, depending on TOLERANCE.
|
<static> |
Core.iszero(a)
Returns if a floating point value is considered similar to 0, depending on TOLERANCE.
|
<static> |
Core.max3(a, b, c)
Returns the maximum value of 3 input values.
|
<static> |
Core.min3(a, b, c)
Returns the minimum of 3 input values.
|
<static> |
Core.radToDeg(radians)
Converts an angle from radians to degrees.
|
Field Detail
<static>
Core.TOLERANCE
Low tolerance value deciding which floating point values are considered equal.
Method Detail
<static>
Core.clamp(n, low, high)
Returns a new value which is clamped between low and high.
- Parameters:
- n
- low
- high
<static>
{Number}
Core.createColor(a, r, g, b)
Creates a 32bit value representing a color
- Parameters:
- a
- {Number} Alpha component of the color (value between 0 and 255)
- r
- {Number} Red component of the color (value between 0 and 255)
- g
- {Number} Green component of the color (value between 0 and 255)
- b
- {Number} Blue component of the color (value between 0 and 255)
- Returns:
- {Number} 32 bit color
<static>
Core.degToRad(deg)
Converts an angle from degrees to radians.
- Parameters:
- deg
<static>
Core.equals(a, b)
Returns if two floating point values are considered similar, depending on TOLERANCE.
- Parameters:
- a
- b
<static>
Core.fract(n)
Returns the fraction part of a floating point value. Given for example 6.788, this would return 0.788.
- Parameters:
- n
<static>
{Number}
Core.getAlpha(clr)
Returns the alpha component of a color compressed into one 32bit integer value
- Parameters:
- clr
- {Number} color
- Returns:
- {Number} color component value, a value between 0 and 255
<static>
{Number}
Core.getBlue(clr)
Returns the blue component of a color compressed into one 32bit integer value
- Parameters:
- clr
- {Number} 32 bit color
- Returns:
- {Number} color component value, a value between 0 and 255
<static>
{Number}
Core.getGreen(clr)
Returns the green component of a color compressed into one 32bit integer value
- Parameters:
- clr
- {Number} color
- Returns:
- {Number} color component value, a value between 0 and 255
<static>
{Number}
Core.getRed(clr)
Returns the red component of a color compressed into one 32bit integer value
- Parameters:
- clr
- {Number} color
- Returns:
- {Number} color component value, a value between 0 and 255
<static>
Core.isone(a)
Returns if a floating point value is considered similar to 0, depending on TOLERANCE.
- Parameters:
- a
<static>
Core.iszero(a)
Returns if a floating point value is considered similar to 0, depending on TOLERANCE.
- Parameters:
- a
<static>
Core.max3(a, b, c)
Returns the maximum value of 3 input values.
- Parameters:
- a
- b
- c
<static>
Core.min3(a, b, c)
Returns the minimum of 3 input values.
- Parameters:
- a
- b
- c
<static>
Core.radToDeg(radians)
Converts an angle from radians to degrees.
- Parameters:
- radians