Documentation ¶
Index ¶
- func Cos(x Radians) Float.X
- func Cosh[X Float.Any](x X) X
- func Sin(x Radians) Float.X
- func Sinh[X Float.Any](x X) X
- func Tan(x Radians) Float.X
- func Tanh(x Radians) Float.X
- type Degrees
- type Euler3D
- type Order
- type Radians
- func Acos[X Float.Any](x X) Radians
- func Acosh[X Float.Any](x X) Radians
- func Asin[X Float.Any](x X) Radians
- func Asinh[X Float.Any](x X) Radians
- func Atan[X Float.Any](x X) Radians
- func Atan2[X Float.Any](y, x X) Radians
- func Atanh[X Float.Any](x X) Radians
- func CubicInterpolate(from, to, pre, post, weight Radians) Radians
- func CubicInterpolateAngleInTime(from, to, pre, post, weight, to_t, pre_t, post_t Radians) Radians
- func Difference(from, to Radians) Radians
- func InRadians(deg Degrees) Radians
- func Lerp[X Float.Any](from, to Radians, weight X) Radians
- func RotateToward[X Float.Any](from, to Radians, delta X) Radians
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Radians ¶
func Acos ¶
Acos returns the arc cosine of x in radians. Use to get the angle of cosine x. x will be clamped between -1.0 and 1.0 (inclusive), in order to prevent acos from returning NaN.
func Asin ¶
Asin returns the arc sine of x in radians. Use to get the angle of sine x. x will be clamped between -1.0 and 1.0 (inclusive), in order to prevent asin from returning NaN.
func Atan ¶
Atan returns the arc tangent of x in radians. Use it to get the angle from an angle's tangent in trigonometry. The method cannot know in which quadrant the angle should fall. See atan2 if you have both y and x.
func Atan2 ¶
Atan2 returns the arc tangent of y/x in radians. Use to get the angle of tangent y/x. To compute the value, the method takes into account the sign of both arguments in order to determine the quadrant.
Important note: The Y coordinate comes first, by convention.
func CubicInterpolate ¶
CubicInterpolateAngle cubic interpolates between two rotation values with shortest path by the factor defined in weight with pre and post values. See also Lerp.
func CubicInterpolateAngleInTime ¶
CubicInterpolateAngleInTime cubic interpolates between two rotation values with shortest path by the factor defined in weight with pre and post values. See also Lerp.
It can perform smoother interpolation than CubicInterpolate by the time values.
func Difference ¶
Difference returns the difference between the two angles, in the range of [-Pi, +Pi]. When from and to are opposite, returns -Pi if from is smaller than to, or Pi otherwise.
func Lerp ¶
Lerp linearly interpolates between two angles (in radians) by a weight value between 0.0 and 1.0. Similar to lerp, but interpolates correctly when the angles wrap around Tau. To perform eased interpolation with Lerp, combine it with [Float.Ease] or [Float.Smoothstep].
Note: This function lerps through the shortest path between from and to. However, when these two angles are approximately Pi + k * Tau apart for any integer k, it's not obvious which way they lerp due to floating-point precision errors. For example, Lerp(0, Pi, weight) lerps counter-clockwise, while Lerp(0, Pi + 5 * Tau, weight) lerps clockwise.
func RotateToward ¶
RotateToward rotates from toward to by the delta amount. Will not go past to.
Similar to move_toward, but interpolates correctly when the angles wrap around Tau.
If delta is negative, this function will rotate away from to, toward the opposite angle, and will not go past the opposite angle.