utils

package
v0.0.0-...-9ae1339 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TheRand = &rand{12345678, 4185243, 776511, 45411}

Functions

func Between

func Between(min, max int) int

func Constrain

func Constrain[T Numeric](i, low, high T) T

func Fill

func Fill(buffer *image.RGBA, rgba color.RGBA)

func Interpolate

func Interpolate[T Numeric](i, start1, stop1, start2, stop2 T) T

func Lerp

func Lerp[T Numeric](a, b, k T) T

func LoadBufferGray

func LoadBufferGray(b []byte) *image.Gray

func LoadBufferPaletted

func LoadBufferPaletted(b []byte) *image.Paletted

func LoadBufferRGBA

func LoadBufferRGBA(b []byte) *image.RGBA

func LoadFileRGBA

func LoadFileRGBA(filename string) *image.RGBA

func Max

func Max[T Numeric](x, y T) T

func Memset

func Memset(a *[64000]uint16, v uint16)

func Min

func Min[T Numeric](x, y T) T

func Random

func Random() float64

Types

type Matrix

type Matrix [3]Vector

func NewMatrix

func NewMatrix(a11, a12, a13, a21, a22, a23, a31, a32, a33 float64) (m Matrix)

func RotX

func RotX(theta float64) Matrix

func RotY

func RotY(theta float64) Matrix

func RotZ

func RotZ(theta float64) Matrix

func (Matrix) MulMat

func (m Matrix) MulMat(b Matrix) (r Matrix)

func (Matrix) MulVec

func (m Matrix) MulVec(v Vector) (r Vector)

type Numeric

type Numeric interface {
	constraints.Integer | constraints.Float
}

type Vector

type Vector [3]float64

func NewVector

func NewVector(x, y, z float64) (r Vector)

func (Vector) Add

func (v Vector) Add(a Vector) (r Vector)

func (Vector) Normalize

func (v Vector) Normalize() Vector

func (Vector) Sub

func (v Vector) Sub(a Vector) (r Vector)

Jump to

Keyboard shortcuts

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