maf

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SMOOTHNESS = 0.20
)

Variables

This section is empty.

Functions

func AngleFromDirection

func AngleFromDirection(vector t.Vector2) float64

AngleFromDirection converts a vector to an angle x and y will move from -1 to 1, which shows the angle

func AngleFromTwoDirections

func AngleFromTwoDirections(from, to t.Vector2) float64

AngleFromTwoDirections calculates the angle between two vectors

func AngleFromTwoDirectionsReversed

func AngleFromTwoDirectionsReversed(to, from t.Vector2) float64

AngleFromTwoDirectionsReversed calculates the angle between two vectors (reversed order)

func CheckCollisionRecs

func CheckCollisionRecs(rect1, rect2 image.Rectangle) bool

CheckCollisionRecs checks collision between two rectangles

func ClerpAngle

func ClerpAngle(from, to float64) float64

ClerpAngle performs a linear interpolation to smooth transitions between angles It normalizes the angle to the range −𝜋 to π by repeatedly adding or subtracting 2𝜋 until the angle falls within the desired range.

func ClerpDegrees

func ClerpDegrees(from, to float64) float64

func DegreesFromRadians

func DegreesFromRadians(radians float64) float64

degrees=radians×(180/π) DegreesFromRadians converts an angle from radians to degrees

func DirectionFromDegrees

func DirectionFromDegrees(angleDegrees float64) t.Vector2

AngleToVector converts an angle in degrees to a vector

func DirectionFromRadians

func DirectionFromRadians(angle float64) t.Vector2

DirectionFromRadians converts an angle to a vector

func GetRandom

func GetRandom[L any](list []L) L

func GetRandomNumberFrom1ToMaxIncluded

func GetRandomNumberFrom1ToMaxIncluded(max int) int

func GetRandomNumberMinMaxIncluded

func GetRandomNumberMinMaxIncluded(min, max int) int

GetRandomNumber returns a random integer between min and max (inclusive)

func GetRandomNumberZeroToMaxMinusOne

func GetRandomNumberZeroToMaxMinusOne(max int) int

GetRandomNumberZeroToMaxMinusOne returns a random integer between 0 and max (inclusive)

func Min

func Min(a, b int) int

Min returns the minimum of two integers

func OriginFromEbitenImage

func OriginFromEbitenImage(rect *t.Rectangle) t.Vector2

func OriginFromRectangle

func OriginFromRectangle(r image.Rectangle) t.Vector2

gets middle of rectangle (size/2) for rotating. X and Y added to the position(upper left) of the rectangle

func RadiansFromDegrees

func RadiansFromDegrees(degrees float64) float64

RadiansFromDegrees converts an angle from degrees to radians

func RectFromRLRect

func RectFromRLRect(rlRect t.RLRectangle) image.Rectangle

CheckCollisionRecs checks collision between two rectangles deprecated use rlRect.ToImageRectangle

func RoundTo3

func RoundTo3[N ~float32 | ~float64](value N) N

func RoundTo4

func RoundTo4[N ~float32 | ~float64](value N) N

Generics

func Vector2Subtract

func Vector2Subtract(v1, v2 t.Vector2) t.Vector2

t.Vector2Subtract - Subtract two vectors (v1 - v2)

func VectorToDegrees

func VectorToDegrees(vector t.Vector2) float64

func WrapAngle

func WrapAngle(angle float64) float64

WrapAngle reduces the given angle to a value between -pi and pi The Clerp function calls WrapAngle to ensure the angle difference is normalized before performing the linear interpolation.

func WrapDegrees

func WrapDegrees(angle float64) float64

WrapAngle reduces the given angle to a value between -180° and 180° The Clerp function calls WrapAngle to ensure the angle difference is normalized before performing the linear interpolation.

Types

This section is empty.

Jump to

Keyboard shortcuts

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