math

package
v0.0.0-...-e1c21c9 Latest Latest
Warning

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

Go to latest
Published: May 10, 2019 License: Zlib Imports: 4 Imported by: 33

Documentation

Index

Constants

View Source
const MaxFloat32 float32 = 3.40282346638528859811704183484516925440e+38
View Source
const Pi = math.Pi

Variables

This section is empty.

Functions

func ABS

func ABS(a float32) float32

func Angle

func Angle(v f32.Vec2) float32

func AngleTo

func AngleTo(v1, v2 f32.Vec2) (dot float32)

func Atan2

func Atan2(y, x float32) float32

func Ceil

func Ceil(v float32) float32

func Clamp

func Clamp(v, left, right float32) float32

func Cos

func Cos(r float32) float32

func Degree

func Degree(r float32) float32

Degree converts radian to degree.

func Direction

func Direction(v1, v2 f32.Vec2) float32

func Floor

func Floor(v float32) float32

func InvLength

func InvLength(x, y, fail float32) float32

func InvSqrt

func InvSqrt(x float32) float32

/ This is A approximate yet fast inverse square-root.

func IsPow2

func IsPow2(x uint32) bool

IsPow2 returns true if the given value if a power-of-two.

func Max

func Max(a, b float32) float32

func Min

func Min(a, b float32) float32

func Pow2

func Pow2(x uint32) uint32

Pow2 returns the first power-of-two value >= to n. This can be used to create suitable Texture dimensions.

func Radian

func Radian(d float32) float32

Radian converts degree to radian.

func Random

func Random(low, high float32) float32

/ a faster way ?

func Sin

func Sin(r float32) float32

func U16Clamp

func U16Clamp(v, low, high uint16) uint16

func U16Max

func U16Max(a, b uint16) uint16

func U16Min

func U16Min(a, b uint16) uint16

func U32Clamp

func U32Clamp(v, low, high uint32) uint32

func U32Max

func U32Max(a, b uint32) uint32

func U32Min

func U32Min(a, b uint32) uint32

func Vector

func Vector(a float32) f32.Vec2

Types

type Point

type Point struct {
	X, Y float32
}

type Rect

type Rect struct {
	Min, Max Point
}

矩形

func (*Rect) Center

func (rect *Rect) Center() Point

func (*Rect) Dx

func (rect *Rect) Dx() float32

func (*Rect) Dy

func (rect *Rect) Dy() float32

type Size

type Size struct {
	Width, Height float32
}

大小

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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