math32

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const FLT_EPSILON float64 = 1.19209290e-07

FLT_EPSILON is the C++ FLT_EPSILON epsilon constant

Variables

This section is empty.

Functions

func Clamp

func Clamp(curr, min, max float64) float64

func GetProjectionRadius

func GetProjectionRadius(checkAxis, axis *Vector2) float64

func IsCover

func IsCover(vp1p2 *Vector2, checkAxisRadius float64, deg float64, targetAxis1 *Vector2, targetAxis2 *Vector2) bool

Types

type OBB

type OBB struct {
	// contains filtered or unexported fields
}

func NewOBB

func NewOBB(centerPoint *Vector2, width, height, rotation float64) *OBB

type Rect

type Rect struct {
	X      float64
	Y      float64
	Width  float64
	Height float64
}

func NewRect

func NewRect(x float64, y float64, width float64, height float64) (rc *Rect)

func NewRect2

func NewRect2() (rc *Rect)

func NewRect3

func NewRect3(p1 *Vector2, p2 *Vector2) (rc *Rect)

func NewRect4

func NewRect4(p *Vector2, s *Size) (rc *Rect)

func (*Rect) Area

func (rc *Rect) Area() float64

func (*Rect) Br

func (rc *Rect) Br() *Vector2

func (*Rect) Clone

func (rc *Rect) Clone() *Rect

func (*Rect) Contains

func (rc *Rect) Contains(p *Vector2) bool

func (*Rect) Empty

func (rc *Rect) Empty() bool

func (*Rect) Equals

func (rc *Rect) Equals(obj interface{}) bool

func (*Rect) Intersect

func (rc *Rect) Intersect(dst *Rect) *Rect

func (*Rect) Size

func (rc *Rect) Size() *Size

func (*Rect) String

func (rc *Rect) String() string

func (*Rect) Tl

func (rc *Rect) Tl() *Vector2

type RotatedRect

type RotatedRect struct {
	Center *Vector2
	Size   *Size
	Angle  float64
}

func ApplyGeoForRotatedRect

func ApplyGeoForRotatedRect(rect image.Rectangle, op *ebiten.GeoM) *RotatedRect

func NewRotatedRect

func NewRotatedRect() (rcvr *RotatedRect)

func NewRotatedRect1

func NewRotatedRect1(r *Rect) (rcvr *RotatedRect)

func NewRotatedRect2

func NewRotatedRect2(c *Vector2, s *Size, a float64) (rcvr *RotatedRect)

func NewRotatedRect3

func NewRotatedRect3(v1 *Vector2, v2 *Vector2, v3 *Vector2) (rcvr *RotatedRect)

func (*RotatedRect) BoundingRect

func (rcvr *RotatedRect) BoundingRect() *Rect

func (*RotatedRect) Clone

func (rcvr *RotatedRect) Clone() *RotatedRect

func (*RotatedRect) Contains

func (rcvr *RotatedRect) Contains(v *Vector2) bool

func (*RotatedRect) Equals

func (rcvr *RotatedRect) Equals(obj interface{}) bool

func (*RotatedRect) IsCollision

func (rcvr *RotatedRect) IsCollision(other *RotatedRect) bool

func (*RotatedRect) Points

func (rcvr *RotatedRect) Points() []*Vector2

func (*RotatedRect) String

func (rcvr *RotatedRect) String() string

type Size

type Size struct {
	Width  float64
	Height float64
}

func NewSize

func NewSize(width float64, height float64) (rcvr *Size)

func NewSize2

func NewSize2() (rcvr *Size)

func NewSize3

func NewSize3(p *Vector2) (rcvr *Size)

func NewSize4

func NewSize4(vals []float64) (rcvr *Size)

func (*Size) Area

func (rcvr *Size) Area() float64

func (*Size) Clone

func (rcvr *Size) Clone() *Size

func (*Size) Empty

func (rcvr *Size) Empty() bool

func (*Size) Equals

func (rcvr *Size) Equals(obj interface{}) bool

func (*Size) Set

func (rcvr *Size) Set(vals []float64)

func (*Size) String

func (rcvr *Size) String() string

type Vector2

type Vector2 struct {
	X float64
	Y float64
}

func ApplyGeoForVector2

func ApplyGeoForVector2(p *Vector2, op *ebiten.GeoM) *Vector2

func NewVector2

func NewVector2(x, y float64) *Vector2

func NewVector2Zero

func NewVector2Zero() *Vector2

func (*Vector2) Add

func (this *Vector2) Add(otherVector *Vector2) *Vector2

func (*Vector2) Clone

func (this *Vector2) Clone() *Vector2

func (*Vector2) Coords

func (this *Vector2) Coords() (float64, float64)

func (*Vector2) CopyFrom

func (this *Vector2) CopyFrom(source *Vector2)

func (*Vector2) Cross

func (this *Vector2) Cross(otherVector *Vector2) float64

func (*Vector2) Ddot

func (this *Vector2) Ddot(otherVector *Vector2) float64

func (*Vector2) Equals

func (this *Vector2) Equals(otherVector *Vector2) bool

func (*Vector2) Invert

func (this *Vector2) Invert() *Vector2

Receiver is returned for easy chaning.

func (*Vector2) Inverted

func (this *Vector2) Inverted() *Vector2

Inverted returns a new *T which is receiver inverted.

func (*Vector2) Length

func (this *Vector2) Length() float64

func (*Vector2) LengthSquared

func (this *Vector2) LengthSquared() float64

func (*Vector2) Lerp

func (this *Vector2) Lerp(end *Vector2, amount float64) *Vector2

func (*Vector2) Multiply

func (this *Vector2) Multiply(otherVector *Vector2) *Vector2

func (*Vector2) Normalize

func (this *Vector2) Normalize()

func (*Vector2) Scale

func (this *Vector2) Scale(scale float64) *Vector2

func (*Vector2) Set

func (this *Vector2) Set(x, y float64)

func (*Vector2) String

func (this *Vector2) String() string

func (*Vector2) Sub

func (this *Vector2) Sub(otherVector *Vector2) *Vector2

Jump to

Keyboard shortcuts

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