mosaic

package module
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plane

type Plane struct {
	Normal Vector
	// Distance from the origin
	Distance float64
}

func NewPlane

func NewPlane(v, w Vector) Plane

func (Plane) DistanceTo

func (p Plane) DistanceTo(v Vector) float64

func (Plane) Invert

func (p Plane) Invert() Plane

type Polygon

type Polygon struct {
	Position    Vector
	Vectors     []Vector
	CalcVectors []Vector
	Planes      []Plane
	Bounds      Rectangle
}

func NewPolygon

func NewPolygon(position Vector, vectors []Vector) Polygon

NewPolygon accepts an array of vectors in CCW rotation

func (Polygon) Add

func (p Polygon) Add(v Vector) Polygon

func (Polygon) CheckPosition

func (p Polygon) CheckPosition(position Vector) Polygon

func (Polygon) Clone

func (p Polygon) Clone() Polygon

func (Polygon) ContainsPolygon

func (p Polygon) ContainsPolygon(q Polygon) (normal Vector, depth float64)

func (Polygon) ContainsVector

func (p Polygon) ContainsVector(v Vector) bool

func (Polygon) Copy

func (p Polygon) Copy(q Polygon) Polygon

func (Polygon) Intersects

func (p Polygon) Intersects(q Polygon) (normal Vector, depth float64)

func (Polygon) Join added in v1.4.0

func (p Polygon) Join(q Polygon) (Polygon, Polygon)

func (Polygon) SetPosition

func (p Polygon) SetPosition(position Vector) Polygon

func (Polygon) Update

func (p Polygon) Update() Polygon

type Rectangle

type Rectangle struct {
	Position Vector
	Height   float64
	Width    float64
}

func NewRectangle

func NewRectangle(position Vector, w, h float64) Rectangle

func (Rectangle) Area added in v1.1.0

func (r Rectangle) Area() float64

func (Rectangle) AreaOfOverlap added in v1.1.0

func (r Rectangle) AreaOfOverlap(o Rectangle) float64

func (Rectangle) Contains

func (r Rectangle) Contains(x, y float64) bool

func (Rectangle) Intersects

func (r Rectangle) Intersects(s Rectangle) bool

func (Rectangle) MaxPoint

func (r Rectangle) MaxPoint() Vector

func (Rectangle) MinPoint

func (r Rectangle) MinPoint() Vector

func (Rectangle) Scale

func (r Rectangle) Scale(c float64) Rectangle

func (Rectangle) ToPolygon

func (r Rectangle) ToPolygon() Polygon

type Vector

type Vector struct {
	X float64
	Y float64
}

func NewVector

func NewVector(x, y float64) Vector

func (Vector) Add

func (v Vector) Add(w Vector) Vector

func (Vector) Clone

func (v Vector) Clone() Vector

func (Vector) Copy

func (v Vector) Copy(w Vector) Vector

func (Vector) Distance added in v1.2.0

func (v Vector) Distance(w Vector) float64

func (Vector) DotProduct

func (v Vector) DotProduct(w Vector) float64

func (Vector) Invert

func (v Vector) Invert() Vector

func (Vector) LeftNormal

func (v Vector) LeftNormal(w Vector) Vector

For clockwise order

func (Vector) Length

func (v Vector) Length() float64

func (Vector) Magnitude

func (v Vector) Magnitude() float64

func (Vector) Normal

func (v Vector) Normal(w Vector) Vector

func (Vector) Normalize

func (v Vector) Normalize() Vector

func (Vector) Perpendicular

func (v Vector) Perpendicular() Vector

func (Vector) Projection

func (v Vector) Projection(w Vector) Vector

func (Vector) Reflect

func (v Vector) Reflect(w Vector) Vector

func (Vector) RightNormal

func (v Vector) RightNormal(w Vector) Vector

For counter clockwise order

func (Vector) Scale

func (v Vector) Scale(c float64) Vector

func (Vector) ScaleXY

func (v Vector) ScaleXY(cx, cy float64) Vector

func (Vector) Subtract

func (v Vector) Subtract(w Vector) Vector

func (Vector) UnitProjection

func (v Vector) UnitProjection(w Vector) Vector

func (Vector) UnitReflect

func (v Vector) UnitReflect(w Vector) Vector

Jump to

Keyboard shortcuts

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