hyperrectangle

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	SideN = 1 << iota
	SideE
	SideS
	SideW

	CornerNE = SideN | SideE
	CornerSE = SideS | SideE
	CornerSW = SideS | SideW
	CornerNW = SideN | SideW
)

Variables

This section is empty.

Functions

func IntersectCircle

func IntersectCircle(r hyperrectangle.R, p vector.V, radius float64) bool

IntersectCircle checks if a circle overlaps an AABB. Note that this can be decomposed into three checks --

  1. if the circle center lies inside the rectangle,
  2. if the an edge of the rectangle crosses the circle at some point, and
  3. if the rectangle lies entirely within the circle, but does not overlap the circle center

See https://stackoverflow.com/a/402019/873865 for more information.

func Normal

func Normal(r hyperrectangle.R, v vector.V) (float64, vector.V)

Normal finds the appropriate normal vector of the hyperrectangle which is closest to the input vector v. Also returns the distance to the corresponding edge or corner.

Types

type Side

type Side uint64

Jump to

Keyboard shortcuts

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