Documentation
¶
Overview ¶
Package collide finds and separates overlapping boxes of a Space: BroadPhase names the pairs that may touch, a NarrowPhase gathers them as Pairs, and Separate tests each exactly and pushes the overlapping apart.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BroadPhase ¶
func BroadPhase(space *aabbworld.Space, reach float64, want aabbworld.Capability, fn func(a, b uid.UID64))
BroadPhase calls fn once per pair sharing want that may touch in a step of reach × shorter side.
Types ¶
type NarrowPhase ¶
type NarrowPhase struct {
// contains filtered or unexported fields
}
NarrowPhase tests a batch of candidate pairs exactly and separates the ones that overlap. The zero value is ready, buffers are reused between batches; one serves one goroutine.
func (*NarrowPhase) Add ¶
func (n *NarrowPhase) Add(p Pair) int
Add enters a pair into the batch and returns the index onContact and whose name it by.
func (*NarrowPhase) Left ¶
func (n *NarrowPhase) Left() []uid.UID64
Left is who the last Separate pushed out through an open edge; good until the next Reset.
func (*NarrowPhase) Reset ¶
func (n *NarrowPhase) Reset()
Reset empties the batch, keeping the memory.
type Pair ¶
type Pair struct {
A, B *plane.AABB
KeyA, KeyB uint32 // one key per box across the batch; zero measures every pass
StaticA, StaticB bool
Sensor bool
}
Pair is two boxes that may be in contact; the narrow phase moves them in place through A and B. A static side is never moved; a Sensor pair is reported but never separated.