struct AABB

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::BVHNodes

Defined in:

aabb.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(min, max) #

Create a new AABB from two points. There is no need to check if min < max.


[View source]
def self.new #

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


[View source]

Class Method Detail

def self.around(point : Point, radius : Float64) #

Create a AABB around some point


[View source]
def self.from_points(points : Array(Point)) #

Create an AABB wraping a list of points


[View source]

Instance Method Detail

def area : Float64 #

Surface area


[View source]
def centroid #

Center point of the AABB


[View source]
def diagonal : Vector #

Vector from @min to @max


[View source]
def fast_hit(ray : Ray) #

Check if a Ray intersects the AABB. This only returns true or false, not a HitRecord.


[View source]
def max : Point #

[View source]
def merge(other : AABB) #

Create a new AABB that wraps this and the other AABB


[View source]
def merge(other : Point) #

Create a new AABB that wraps this one and the some Point


[View source]
def min : Point #

[View source]
def offset(point : Point) : Point #

Relative position of a point inside the AABB. The result is a Point ranging from (0, 0, 0) to (1, 1, 1).


[View source]