Documentation ¶
Index ¶
- func AnyIntersections(boxes []AABB, search AABB) bool
- type AABB
- func (aabb AABB) CalculateXOffset(nearby AABB, deltaX float64) float64
- func (aabb AABB) CalculateYOffset(nearby AABB, deltaY float64) float64
- func (aabb AABB) CalculateZOffset(nearby AABB, deltaZ float64) float64
- func (aabb AABB) Extend(vec mgl64.Vec3) AABB
- func (aabb AABB) ExtendTowards(f cube.Face, x float64) AABB
- func (aabb AABB) Grow(x float64) AABB
- func (aabb AABB) GrowVec3(vec mgl64.Vec3) AABB
- func (aabb AABB) Height() float64
- func (aabb AABB) IntersectsWith(other AABB) bool
- func (aabb AABB) Length() float64
- func (aabb AABB) Max() mgl64.Vec3
- func (aabb AABB) Min() mgl64.Vec3
- func (aabb AABB) Stretch(a cube.Axis, x float64) AABB
- func (aabb AABB) Translate(vec mgl64.Vec3) AABB
- func (aabb AABB) Vec3Within(vec mgl64.Vec3) bool
- func (aabb AABB) Vec3WithinXY(vec mgl64.Vec3) bool
- func (aabb AABB) Vec3WithinXZ(vec mgl64.Vec3) bool
- func (aabb AABB) Vec3WithinYZ(vec mgl64.Vec3) bool
- func (aabb AABB) Width() float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnyIntersections ¶
AnyIntersections checks if any of boxes1 have intersections with any of boxes2 and returns true if this happens to be the case.
Types ¶
type AABB ¶
type AABB struct {
// contains filtered or unexported fields
}
AABB represents an Axis Aligned Bounding Box in a 3D space. It is defined as two Vec3s, of which one is the minimum and one is the maximum.
func NewAABB ¶
NewAABB creates a new axis aligned bounding box with the minimum and maximum coordinates provided.
func (AABB) CalculateXOffset ¶
CalculateXOffset calculates the offset on the X axis between two bounding boxes, returning a delta always smaller than or equal to deltaX if deltaX is bigger than 0, or always bigger than or equal to deltaX if it is smaller than 0.
func (AABB) CalculateYOffset ¶
CalculateYOffset calculates the offset on the Y axis between two bounding boxes, returning a delta always smaller than or equal to deltaY if deltaY is bigger than 0, or always bigger than or equal to deltaY if it is smaller than 0.
func (AABB) CalculateZOffset ¶
CalculateZOffset calculates the offset on the Z axis between two bounding boxes, returning a delta always smaller than or equal to deltaZ if deltaZ is bigger than 0, or always bigger than or equal to deltaZ if it is smaller than 0.
func (AABB) Extend ¶
Extend expands the AABB on all axes as represented by the Vec3 passed. Negative coordinates result in an expansion towards the negative axis, and vice versa for positive coordinates.
func (AABB) ExtendTowards ¶
ExtendTowards extends the bounding box by x in a given direction.
func (AABB) Grow ¶
Grow grows the bounding box in all directions by x and returns the new bounding box.
func (AABB) GrowVec3 ¶
GrowVec3 grows the AABB on all axes as represented by the Vec3 passed. The vec values are subtracted from the minimum values of the AABB and added to the maximum values of the AABB.
func (AABB) IntersectsWith ¶
IntersectsWith checks if the AABB intersects with another AABB, returning true if this is the case.
func (AABB) Translate ¶
Translate moves the entire AABB with the Vec3 given. The (minimum and maximum) x, y and z coordinates are moved by those in the Vec3 passed.
func (AABB) Vec3Within ¶
Vec3Within checks if the AABB has a Vec3 within it, returning true if it does.
func (AABB) Vec3WithinXY ¶ added in v0.3.0
Vec3WithinXY checks if the AABB has a Vec3 within its X and Y bounds, returning true if it does.
func (AABB) Vec3WithinXZ ¶ added in v0.3.0
Vec3WithinXZ checks if the AABB has a Vec3 within its X and Z bounds, returning true if it does.
func (AABB) Vec3WithinYZ ¶ added in v0.3.0
Vec3WithinYZ checks if the AABB has a Vec3 within its Y and Z bounds, returning true if it does.