Documentation
¶
Overview ¶
Package plane is a box as a Space holds it: a geom.AABB that knows its own size and how far it runs past the far edges of a wrapping world, so that its wrapped pieces follow from it. It is the public face of the geometry a Space normalises; the normalising itself is done by the Space.
AABB ¶
An AABB embeds a geom.AABB and adds a Size, which survives clamping at an edge, and an Overhang: how far the box reaches past the right and bottom edge of the world once its top-left corner has been folded inside. A box with no Overhang lies whole in the world. NewAABB builds one not yet folded by any Space; Space.WrapAABB, Space.Place and Space.Move of package aabbworld fold it.
Fragments ¶
A box straddling a wrapping seam is its main piece plus up to three wrapped pieces, named by FragPosition: FRAG_RIGHT for what came back through the left edge, FRAG_BOTTOM for what came back through the top, FRAG_BOTTOM_RIGHT for the corner that did both. AABB.VisitFragments hands each wrapped piece to a FragVisitor until it says stop; the main piece is the embedded geom.AABB itself.
Overlap ¶
AABB.DeepestOverlapWith compares every piece of one box with every piece of another and returns the deepest Overlap: the two pieces that meet and the penetration between them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AABB ¶
AABB is a box kept canonical within a Space: its corners, its size, and its Overhang — how far it runs past the world's far edges, from which its wrapped pieces follow.
func (*AABB) DeepestOverlapWith ¶
DeepestOverlapWith is the deepest overlap of ab and other, wrapped images included, if any.
func (*AABB) VisitFragments ¶
func (ab *AABB) VisitFragments(fn FragVisitor)
VisitFragments calls fn for each piece the box wraps into, until fn returns false.
type FragPosition ¶
type FragPosition int
FragPosition names a wrapped piece of a box by the edge of the parent it lies past.
const ( FRAG_MAIN FragPosition = iota // FRAG_RIGHT is the fragment that spans the parent's right edge. FRAG_RIGHT // FRAG_BOTTOM is the fragment along the parent's bottom edge. FRAG_BOTTOM // FRAG_BOTTOM_RIGHT is the fragment covering the parent's bottom-right quadrant. FRAG_BOTTOM_RIGHT )
type FragVisitor ¶
type FragVisitor func(pos FragPosition, box geom.AABB) bool
FragVisitor is handed each wrapped piece of a box and says whether to go on to the next.