util

package
v0.0.0-...-e229e0e Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: GPL-2.0 Imports: 12 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64ToBytes

func Base64ToBytes(base64String string) []byte

func BoolBytes

func BoolBytes(w io.Writer, b bool) error

func BoolFromBytes

func BoolFromBytes(r io.Reader) (bool, error)

func FacingOrientation

func FacingOrientation(rotation float32, direction, normal, tangent mgl32.Vec3) mgl32.Quat

FacingOrientation - return an orientation that always faces the given direction with rotation

func FacingOrientation64

func FacingOrientation64(rotation float64, direction, normal, tangent mgl64.Vec3) mgl64.Quat

func Float32bytes

func Float32bytes(w io.Writer, float float32) error

func Float32frombytes

func Float32frombytes(r io.Reader) (float32, error)

func Float64bytes

func Float64bytes(w io.Writer, float float64) error

func Float64frombytes

func Float64frombytes(r io.Reader) (float64, error)

func ImageColor

func ImageColor(r, g, b, a uint8) image.Image

ImageColor - returns an image with a single pixel

func Mat4From

func Mat4From(scale, translation mgl32.Vec3, orientation mgl32.Quat) mgl32.Mat4

func Mat4From64

func Mat4From64(scale, translation mgl64.Vec3, orientation mgl64.Quat) mgl64.Mat4

func Max

func Max(values ...float64) float64

Max - returns the largest value of the values provided.

func MaxF32

func MaxF32(values ...float32) float32

Max - returns the largest value of the values provided.

func Min

func Min(values ...float64) float64

Min - returns the smallest value of the values provided.

func MinF32

func MinF32(values ...float32) float32

Min - returns the smallest value of the values provided.

func PointLiesInsideAABB

func PointLiesInsideAABB(a, b, point mgl32.Vec2) bool

PointLiesInsideAABB - return true if the point lies within the rectan formed by points a and b

func PointLiesInsideTriangle

func PointLiesInsideTriangle(a, b, c, point mgl32.Vec3) bool

PointLiesInsideTriangle - return true if the point lies within the triangle formed by points (a,b,c)

func PointToLineDist

func PointToLineDist(a, b, point mgl32.Vec3) float32

PointToLineDist distance from line (a,b) to point

func PointToPlaneDist

func PointToPlaneDist(a, b, c, point mgl32.Vec3) float32

PointToPlaneDist distance from plane (a,b,c) to point

func Quat_32_from

func Quat_32_from(q mgl64.Quat) mgl32.Quat

func Quat_64_from

func Quat_64_from(q mgl32.Quat) mgl64.Quat

func RayTriangleIntersect

func RayTriangleIntersect(a, b, c, start, direction mgl32.Vec3) (point mgl32.Vec3, ok bool)

RayTriangleIntersect - return true if the ray formed by start and direction intersects with the triangle formed by points (a,b,c)

func Round

func Round(val float32, roundOn float32, places int) float32

func RoundHalfUp

func RoundHalfUp(val float32) (newVal int)

func SegmentCircleIntersect

func SegmentCircleIntersect(radius float32, center, start, finish mgl32.Vec2) (mgl32.Vec2, error)

func SerializeArgs

func SerializeArgs(args ...interface{}) ([]byte, error)

func SetInterval

func SetInterval(fn func(), interval time.Duration) func()

func Stringbytes

func Stringbytes(w io.Writer, str string) error

func Stringfrombytes

func Stringfrombytes(r io.Reader) (string, error)

func TwoSegmentIntersect

func TwoSegmentIntersect(p11, p12, p21, p22 mgl32.Vec2) (mgl32.Vec2, error)

TwoSegmentIntersect - find the intersection point of two line segments <p11-p12> and <p21-p22>

func UInt16Bytes

func UInt16Bytes(w io.Writer, i uint16) error

func UInt16frombytes

func UInt16frombytes(r io.Reader) (uint16, error)

func UInt32Bytes

func UInt32Bytes(w io.Writer, i uint32) error

func UInt32frombytes

func UInt32frombytes(r io.Reader) (uint32, error)

func UInt64Bytes

func UInt64Bytes(w io.Writer, i uint64) error

func UInt64frombytes

func UInt64frombytes(r io.Reader) (uint64, error)

func UInt8Bytes

func UInt8Bytes(w io.Writer, i uint8) error

func UInt8frombytes

func UInt8frombytes(r io.Reader) (uint8, error)

func Vec2AngleBetween

func Vec2AngleBetween(v1, v2 mgl32.Vec2) float32

func Vec2Cross

func Vec2Cross(v1, v2 mgl32.Vec2) float32

func Vec2LenSq

func Vec2LenSq(v1 mgl32.Vec2) float32

func Vec2LenSq64

func Vec2LenSq64(v1 mgl64.Vec2) float64

func Vec2Rotate

func Vec2Rotate(v mgl32.Vec2, angle float32) mgl32.Vec2

func Vec3LenSq

func Vec3LenSq(v1 mgl32.Vec3) float32

func Vec3LenSq64

func Vec3LenSq64(v1 mgl64.Vec3) float64

func Vec3Lerp

func Vec3Lerp(start, end mgl32.Vec3, amount float32) mgl32.Vec3

func Vec3Lerp64

func Vec3Lerp64(start, end mgl64.Vec3, amount float64) mgl64.Vec3

func Vec3_32_from

func Vec3_32_from(v mgl64.Vec3) mgl32.Vec3

func Vec3_64_from

func Vec3_64_from(v mgl32.Vec3) mgl64.Vec3

func Vector2bytes

func Vector2bytes(w io.Writer, vector mgl32.Vec2) error

func Vector2bytes64

func Vector2bytes64(w io.Writer, vector mgl64.Vec2) error

func Vector2frombytes

func Vector2frombytes(r io.Reader) (mgl32.Vec2, error)

func Vector2frombytes64

func Vector2frombytes64(r io.Reader) (mgl64.Vec2, error)

func Vector3bytes

func Vector3bytes(w io.Writer, vector mgl32.Vec3) error

func Vector3bytes64

func Vector3bytes64(w io.Writer, vector mgl64.Vec3) error

func Vector3frombytes

func Vector3frombytes(r io.Reader) (mgl32.Vec3, error)

func Vector3frombytes64

func Vector3frombytes64(r io.Reader) (mgl64.Vec3, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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