collision

package
v0.0.0-...-1ebc2e8 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: LGPL-3.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AABBCollision

func AABBCollision(a, b BoundingBox) bool

TODO: replace with Separating Axis Theorem to accomodate for rotation of rectangles TODO: easier to grok: https://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect and do this for each line of a rectacle vs all lines of the other

Types

type BoundingBox

type BoundingBox struct {
	X      float64
	Y      float64
	Width  float64
	Height float64

	E *ecs.Entity // #38 - TODO remove, collision should work with primitives and not know about about ecs*
	// contains filtered or unexported fields
}

func (*BoundingBox) Edges

func (b *BoundingBox) Edges() [4]vector.Vec2d

func (*BoundingBox) MinArea

func (b *BoundingBox) MinArea() BoundingBox

MinArea returns a new bounding box covering the original boundingbox based incorperating rotation see https://i.stack.imgur.com/ExZl3.png

func (*BoundingBox) Rotate

func (b *BoundingBox) Rotate(theta float64) BoundingBox

Rotate sets the edges of the rectangle based on the origin X,Y, width and height and the given rotation in deg by multipliying with rotation matrix. See https://ebitengine.org/en/documents/matrix.html

Jump to

Keyboard shortcuts

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