Documentation
¶
Index ¶
- Constants
- func AngleDifference(p_from, p_to float64) float64
- func BezierDerivative(p_start, p_control_1, p_control_2, p_end, p_t float64) float64
- func BezierInterpolate(p_start, p_control_1, p_control_2, p_end, p_t float64) float64
- func Clampf(val, min, max float64) float64
- func Clampi(val, min, max int) int
- func CubicInterpolate(p_from, p_to, p_pre, p_post, p_weight float64) float64
- func CubicInterpolateAngle(p_from, p_to, p_pre, p_post, p_weight float64) float64
- func CubicInterpolateAngleInTime(p_from, p_to, p_pre, p_post, p_weight, p_to_t, p_pre_t, p_post_t float64) float64
- func CubicInterpolateInTime(p_from, p_to, p_pre, p_post, p_weight, p_to_t, p_pre_t, p_post_t float64) float64
- func DbToLinear(p_db float64) float64
- func DegToRad(deg float64) float64
- func Fposmod(x, y float64) float64
- func Fract(value float64) float64
- func InverseLerp(p_from, p_to, p_value float64) float64
- func IsEqualApprox(x, y float64) bool
- func IsZeroApprox(x float64) bool
- func Lerp(p_from, p_to, p_weight float64) float64
- func LerpAngle(p_from, p_to, p_weight float64) float64
- func LinearToDb(p_linear float64) float64
- func MoveToward(p_from, p_to, p_delta float64) float64
- func Pingpong(value, length float64) float64
- func RadToDeg(rad float64) float64
- func Remap(p_value, p_istart, p_istop, p_ostart, p_ostop float64) float64
- func RotateToward(p_from, p_to, p_delta float64) float64
- func Sign(x float64) float64
- func Smoothstep(p_from, p_to, p_s float64) float64
- func SnapScalar(p_offset, p_step, p_target float64) float64
- func SnapScalarSeparation(p_offset, p_step, p_target, p_separation float64) float64
- func Snapped(from, to float64) float64
- func Wrapf(value, min, max float64) float64
- func Wrapi(value, min, max int) int
- type EulerOrder
Constants ¶
const CMP_EPSILON = 0.00001
CMP_EPSILON represents the tolerance value used for floating-point comparison.
const CMP_EPSILON2 = CMP_EPSILON * CMP_EPSILON
CMP_EPSILON2 represents the square of CMP_EPSILON.
const CMP_NORMALIZE_TOLERANCE = 0.000001
CMP_NORMALIZE_TOLERANCE represents the tolerance value used for normalizing vectors.
const CMP_POINT_IN_PLANE_EPSILON = 0.00001
CMP_POINT_IN_PLANE_EPSILON represents the tolerance value used for checking if a point lies on a plane.
const PI = 3.1415926535897932384626433833
PI represents the mathematical constant Pi.
const TAU = 6.2831853071795864769252867666
TAU represents the mathematical constant Tau (2 * Pi).
Variables ¶
This section is empty.
Functions ¶
func AngleDifference ¶
AngleDifference calculates the difference between two angles in radians. It returns the difference between 'p_from' and 'p_to' taking into account angle wrapping around the unit circle.
func BezierDerivative ¶
BezierDerivative calculates the derivative of a cubic Bezier curve at a given position. It returns the derivative value at position 'p_t' between 'p_start' and 'p_end' with control points 'p_control_1' and 'p_control_2'.
func BezierInterpolate ¶
BezierInterpolate interpolates between two points using a cubic Bezier curve. It returns the interpolated value at position 'p_t' between 'p_start' and 'p_end' with control points 'p_control_1' and 'p_control_2'.
func Clampf ¶
Clamp clamps a value within a specified range. If val is less than min, it returns min. If val is greater than max, it returns max. Otherwise, it returns val.
func Clampi ¶
Clamp clamps a value within a specified range. If val is less than min, it returns min. If val is greater than max, it returns max. Otherwise, it returns val.
func CubicInterpolate ¶
CubicInterpolate performs cubic interpolation between two values. It interpolates between 'p_from' and 'p_to' using 'p_pre' and 'p_post' as control points, with 'p_weight' determining the position between 'p_from' and 'p_to'.
func CubicInterpolateAngle ¶
CubicInterpolateAngle performs cubic interpolation between two angles represented in radians. It ensures smooth interpolation by handling angle wrapping around the unit circle.
func CubicInterpolateAngleInTime ¶
func CubicInterpolateAngleInTime(p_from, p_to, p_pre, p_post, p_weight, p_to_t, p_pre_t, p_post_t float64) float64
CubicInterpolateAngleInTime performs cubic interpolation in time domain between two angles represented in radians. It ensures smooth interpolation by handling angle wrapping around the unit circle. The interpolation is done using the Barry-Goldman method.
func CubicInterpolateInTime ¶
func CubicInterpolateInTime(p_from, p_to, p_pre, p_post, p_weight, p_to_t, p_pre_t, p_post_t float64) float64
CubicInterpolateInTime performs cubic interpolation in time domain using the Barry-Goldman method. It interpolates between 'p_from' and 'p_to' using 'p_pre' and 'p_post' as control points, with 'p_weight' determining the position between 'p_to' and 'p_from' in time. 'p_to_t', 'p_pre_t', and 'p_post_t' represent the time values corresponding to 'p_to', 'p_pre', and 'p_post' respectively.
func DbToLinear ¶
DbToLinear converts a decibel value to linear scale. It returns the exponential conversion of 'p_db' value from decibels to linear scale.
func DegToRad ¶
DegToRad converts degrees to radians. It multiplies the input value 'deg' by the ratio of Pi to 180.
func Fposmod ¶
Fposmod returns the positive floating-point modulus of x modulo y. If the result of the modulo operation is negative, it wraps around to ensure a positive result.
func Fract ¶
Fract returns the fractional part of a floating-point number. It returns the fractional part of 'value' after subtracting the integer part.
func InverseLerp ¶
InverseLerp calculates the interpolation parameter ('t') between two values 'p_from' and 'p_to' based on a given value 'p_value'. It returns the interpolation parameter that corresponds to 'p_value' relative to the range between 'p_from' and 'p_to'.
func IsEqualApprox ¶
IsEqualApprox checks if two floating-point numbers are approximately equal within a certain tolerance.
func IsZeroApprox ¶
IsZeroApprox checks if a floating-point number is approximately zero within a certain tolerance.
func Lerp ¶
Lerp performs linear interpolation between two values. It returns a value between 'p_from' and 'p_to' based on the interpolation weight 'p_weight'.
func LerpAngle ¶
LerpAngle performs linear interpolation between two angles represented in radians. It returns the interpolated angle at position 'p_weight' between 'p_from' and 'p_to'.
func LinearToDb ¶
LinearToDb converts a linear value to decibels. It returns the logarithmic conversion of 'p_linear' value to decibels.
func MoveToward ¶
MoveToward moves a value towards another value by a given delta amount. It returns the value moved from 'p_from' towards 'p_to' by 'p_delta' amount.
func Pingpong ¶
Pingpong calculates the ping-pong value within a specified length. It returns the ping-pong value of 'value' within the range defined by 'length'.
func RadToDeg ¶
RadToDeg converts radians to degrees. It multiplies the input value 'rad' by the ratio of 180 to Pi.
func Remap ¶
Remap remaps a value from one range to another. It linearly interpolates the value 'p_value' from the range defined by 'p_istart' and 'p_istop' to the range defined by 'p_ostart' and 'p_ostop'.
func RotateToward ¶
RotateToward rotates a value towards another value by a given delta amount. It returns the value rotated from 'p_from' towards 'p_to' by 'p_delta' amount.
func Sign ¶
Sign returns the sign of a floating-point number. It returns 1 if x is positive, -1 if x is negative, and 0 if x is zero.
func Smoothstep ¶
Smoothstep interpolates smoothly between two values based on a third value. It returns a value between 'p_from' and 'p_to' based on 'p_s', using Hermite interpolation.
func SnapScalar ¶
SnapScalar snaps a value to the nearest multiple of a step size. It returns the snapped value of 'p_target' relative to 'p_offset' and 'p_step'.
func SnapScalarSeparation ¶
SnapScalarSeparation snaps a value to the nearest multiple of a step size with a specified separation. It returns the snapped value of 'p_target' relative to 'p_offset', 'p_step', and 'p_separation'.
func Snapped ¶
Snapped returns the nearest value to 'from' that is a multiple of 'to'. If 'to' is zero, it returns 0.
Types ¶
type EulerOrder ¶
type EulerOrder int
const ( EulerOrderXYZ EulerOrder = iota EulerOrderXZY EulerOrderYXZ EulerOrderYZX EulerOrderZXY EulerOrderZYX )