struct AABB
- AABB
- Struct
- Value
- Object
Overview
AABB = Axis-Aligned Bounding Boxes
An AABB
is defined by two points, @min
and @max
,
and is part of every BoundedHitable
.
There it is used when constructing Hitable::BVHNode
s
Defined in:
aabb.crConstructors
-
.new(min, max)
Create a new AABB from two points.
-
.new
Create an empty AABB.
Class Method Summary
-
.around(point : Point, radius : Float64)
Create a AABB around some point
-
.from_points(points : Array(Point))
Create an AABB wraping a list of points
Instance Method Summary
-
#area : Float64
Surface area
-
#centroid
Center point of the AABB
-
#diagonal : Vector
Vector from
@min
to@max
-
#fast_hit(ray : Ray)
Check if a Ray intersects the AABB.
- #max : Point
-
#merge(other : AABB)
Create a new AABB that wraps this and the other AABB
-
#merge(other : Point)
Create a new AABB that wraps this one and the some
Point
- #min : Point
-
#offset(point : Point) : Point
Relative position of a point inside the AABB.
Constructor Detail
Create an empty AABB.
@min
will be the largest possible point
while @max
will be the smallest possible one.
This way the result of merging with another box
is always equal to the other box
Class Method Detail
Instance Method Detail
Check if a Ray intersects the AABB.
This only returns true
or false
,
not a HitRecord
.
Relative position of a point inside the AABB.
The result is a Point
ranging from
(0, 0, 0)
to (1, 1, 1)
.