misc

package
v0.0.0-...-b1374c3 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCircleZone

func NewCircleZone() api.IZone

NewCircleZone constructs a new CircleZone

func NewDragState

func NewDragState() api.IDragging

NewDragState returns a dragging state object

Types

type AABB

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

AABB is an axis-aligned-bounding-box typically used for debug visuals but can be used for anything.

func NewAABB

func NewAABB() *AABB

NewAABB constructs a new AABB

func (*AABB) Expand

func (a *AABB) Expand(vertices []api.IPoint)

Expand expands the current AABB using the provided mesh

func (*AABB) Max

func (a *AABB) Max() api.IPoint

Max returns the lower-right corner

func (*AABB) Min

func (a *AABB) Min() api.IPoint

Min returns the upper-left corner

func (*AABB) SetBounds

func (a *AABB) SetBounds(vertices []api.IPoint)

SetBounds sets the bounds based on the provided Mesh

type CircleZone

type CircleZone struct {
	Zone
	// contains filtered or unexported fields
}

CircleZone is a trigger region or area with an inner and out circular boundary

func (*CircleZone) DistanceFromCenter

func (z *CircleZone) DistanceFromCenter(point api.IPoint) float64

DistanceFromCenter returns distance from point to circle center

func (*CircleZone) DistanceFromEdge

func (z *CircleZone) DistanceFromEdge(point api.IPoint) float64

DistanceFromEdge returns distance from point to outer radius

func (*CircleZone) PointInside

func (z *CircleZone) PointInside(point api.IPoint) int

PointInside checks if point is inside either inner or outer radius

func (*CircleZone) SetPosition

func (z *CircleZone) SetPosition(x, y float64)

SetPosition sets the center location of zone.

func (*CircleZone) SetRadi

func (z *CircleZone) SetRadi(innerRadius, outerRadius float64)

SetRadi sets zone's inner and outer radi

func (*CircleZone) Update

func (z *CircleZone) Update(position api.IPoint) (state int, stateChanged bool)

Update changes zone's state based on point and returns new state

type Zone

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

Zone is a trigger region or area with an inner and out boundary Zones collect subscribers such that the subscribers can be notified of enter/exit states.

func NewZone

func NewZone() *Zone

NewZone constructs a new Zone

func (*Zone) InitializeZone

func (z *Zone) InitializeZone()

InitializeZone initializes the base zone

func (*Zone) State

func (z *Zone) State() int

State returns the current state

func (*Zone) UpdateState

func (z *Zone) UpdateState(currentState int) (state int, stateChanged bool)

UpdateState checks if an object crossed into/out-of the zone, and updates and returns the internal state. In addition, it will send messages to listeners if state changed.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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