Documentation
¶
Index ¶
- Constants
- func AbsInt(value int) int
- func CirclePoint(cx, cy int, radius, thetaRadians float64) (x, y int)
- func DegreesAdd(baseDegrees, deltaDegrees float64) float64
- func DegreesToCompass(deg float64) float64
- func DegreesToRadians(degrees float64) float64
- func GetRoundToForDelta(delta float64) float64
- func MaxInt(values ...int) (max int)
- func Mean(values ...float64) float64
- func MeanInt(values ...int) int
- func MinInt(values ...int) (min int)
- func MinMax(values ...float64) (min, max float64)
- func NormalizeToProportions(values ...float64) []float64
- func PercentDifference(v1, v2 float64) float64
- func PercentToRadians(pct float64) float64
- func RadianAdd(base, delta float64) float64
- func RadiansToDegrees(value float64) float64
- func RotateCoordinate(cx, cy, x, y int, thetaRadians float64) (rx, ry int)
- func Round(value float64) int
- func RoundDown(value, roundTo float64) float64
- func RoundPlaces(input float64, places int) (rounded float64)
- func RoundToInt(value float64) int
- func RoundUp(value, roundTo float64) float64
- func Sum(values ...float64) float64
- func SumInt(values ...int) int
Constants ¶
const ( Pi = 3.14159265358979323846264338327950288419716939937510582097494459 // 3.14159 returns 3.141592653589793238462643383279502 TwoPi = 2 * Pi // returns 6.283185307179586476925286766559005 )
Variables ¶
This section is empty.
Functions ¶
func CirclePoint ¶
CirclePoint returns the absolute config.Alignment of a circle diameter point given by the radius and the theta.
func DegreesAdd ¶
DegreesAdd adds a delta to a base in radians.
func DegreesToCompass ¶
DegreesToCompass returns the degree value in compass / clock orientation.
func DegreesToRadians ¶
DegreesToRadians returns degrees as radians.
func GetRoundToForDelta ¶
GetRoundToForDelta returns a `roundTo` value for a given delta.
func NormalizeToProportions ¶
NormalizeToProportions convierte un conjunto de números en sus proporciones relativas en el intervalo [0,1]. Por ejemplo: 4,3,2,1 => 0.4, 0.3, 0.2, 0.1 Los valores se redondean para evitar errores de punto flotante, pero la suma puede no ser exactamente 1.0.
func PercentDifference ¶
PercentDifference computes the percentage difference between two values. The formula is (v2-v1)/v1.
func PercentToRadians ¶
PercentToRadians converts a normalized value (0,1) to radians.
func RadiansToDegrees ¶
RadiansToDegrees translates a radian value to a degree value.
func RotateCoordinate ¶
RotateCoordinate rotates a coordinate around a given center by a theta in radians.
func Round ¶ added in v0.0.67
Round rounds a float64 to the nearest int. eg: 1.5 -> 2, 1.4 -> 1, -1.5 -> -2, -1.4 -> -1
func RoundPlaces ¶
RoundPlaces rounds an input to a given places.
func RoundToInt ¶
RoundToInt convierte un float64 a int redondeando al entero más cercano
Types ¶
This section is empty.