gl3n



struct AABBT(type);

Base template for all AABB-types.

Parameters
type all values get stored as this type

alias at = type;

Holds the internal type of the AABB.


alias vec3 = Vector!(at, 3);

Convenience alias to the corresponding vector type.


vec3 min;

The minimum of the AABB (e.g. vec3(0, 0, 0)).


vec3 max;

The maximum of the AABB (e.g. vec3(1, 1, 1)).


this(vec3 min, vec3 max);

Constructs the AABB.

Parameters
vec3 min minimum of the AABB
vec3 max maximum of the AABB

AABBT from_points(vec3[] points);

Constructs the AABB around N points (all points will be part of the AABB).


void expand(AABBT b);

Expands the AABB by another AABB.


void expand(vec3 v);

Expands the AABB, so that v is part of the AABB.


const bool intersects(AABBT box);

Returns true if the AABBs intersect. This also returns true if one AABB lies inside another.


const vec3 extent();

Returns the extent of the AABB (also sometimes called size).


const vec3 half_extent();

Returns the half extent.


const at area();

Returns the area of the AABB.


const vec3 center();

Returns the center of the AABB.


const vec3[] vertices();

Returns all vertices of the AABB, basically one vec3 per corner.