zerogdscript

package module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 1 Imported by: 2

README

zero-gdscript

A growing Go port for select gdscript classes and methods.

Documentation

Index

Constants

View Source
const CMP_EPSILON = 0.00001

CMP_EPSILON represents the tolerance value used for floating-point comparison.

View Source
const CMP_EPSILON2 = CMP_EPSILON * CMP_EPSILON

CMP_EPSILON2 represents the square of CMP_EPSILON.

View Source
const CMP_NORMALIZE_TOLERANCE = 0.000001

CMP_NORMALIZE_TOLERANCE represents the tolerance value used for normalizing vectors.

View Source
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.

View Source
const PI = 3.1415926535897932384626433833

PI represents the mathematical constant Pi.

View Source
const TAU = 6.2831853071795864769252867666

TAU represents the mathematical constant Tau (2 * Pi).

Variables

This section is empty.

Functions

func AngleDifference

func AngleDifference(p_from, p_to float64) float64

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

func BezierDerivative(p_start, p_control_1, p_control_2, p_end, p_t float64) float64

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

func BezierInterpolate(p_start, p_control_1, p_control_2, p_end, p_t float64) float64

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

func Clampf(val, min, max float64) float64

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

func Clampi(val, min, max int) int

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

func CubicInterpolate(p_from, p_to, p_pre, p_post, p_weight float64) float64

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

func CubicInterpolateAngle(p_from, p_to, p_pre, p_post, p_weight float64) float64

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

func DbToLinear(p_db float64) float64

DbToLinear converts a decibel value to linear scale. It returns the exponential conversion of 'p_db' value from decibels to linear scale.

func DegToRad

func DegToRad(deg float64) float64

DegToRad converts degrees to radians. It multiplies the input value 'deg' by the ratio of Pi to 180.

func Fposmod

func Fposmod(x, y float64) float64

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

func Fract(value float64) float64

Fract returns the fractional part of a floating-point number. It returns the fractional part of 'value' after subtracting the integer part.

func InverseLerp

func InverseLerp(p_from, p_to, p_value float64) float64

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

func IsEqualApprox(x, y float64) bool

IsEqualApprox checks if two floating-point numbers are approximately equal within a certain tolerance.

func IsZeroApprox

func IsZeroApprox(x float64) bool

IsZeroApprox checks if a floating-point number is approximately zero within a certain tolerance.

func Lerp

func Lerp(p_from, p_to, p_weight float64) float64

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

func LerpAngle(p_from, p_to, p_weight float64) float64

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

func LinearToDb(p_linear float64) float64

LinearToDb converts a linear value to decibels. It returns the logarithmic conversion of 'p_linear' value to decibels.

func MoveToward

func MoveToward(p_from, p_to, p_delta float64) float64

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

func Pingpong(value, length float64) float64

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

func RadToDeg(rad float64) float64

RadToDeg converts radians to degrees. It multiplies the input value 'rad' by the ratio of 180 to Pi.

func Remap

func Remap(p_value, p_istart, p_istop, p_ostart, p_ostop float64) float64

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

func RotateToward(p_from, p_to, p_delta float64) float64

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

func Sign(x float64) float64

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

func Smoothstep(p_from, p_to, p_s float64) float64

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

func SnapScalar(p_offset, p_step, p_target float64) float64

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

func SnapScalarSeparation(p_offset, p_step, p_target, p_separation float64) float64

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

func Snapped(from, to float64) float64

Snapped returns the nearest value to 'from' that is a multiple of 'to'. If 'to' is zero, it returns 0.

func Wrapf

func Wrapf(value, min, max float64) float64

Wrapf wraps a float64 value within a specified range. It returns the wrapped value of 'value' within the range defined by 'min' and 'max'.

func Wrapi

func Wrapi(value, min, max int) int

Wrapi wraps an integer value within a specified range. It returns the wrapped value of 'value' within the range defined by 'min' and 'max'.

Types

type EulerOrder

type EulerOrder int
const (
	EulerOrderXYZ EulerOrder = iota
	EulerOrderXZY
	EulerOrderYXZ
	EulerOrderYZX
	EulerOrderZXY
	EulerOrderZYX
)

Directories

Path Synopsis
internal
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL