Skip to documentation
SLOP

tiny.geometry.Aabb

Reference tiny.geometry Aabb

Defined in tiny.geometry.

An axis-aligned box.

API (14)

Actions

Public operations.

Types and contracts

Public types and contracts.

Fields and members

Public fields and members.

No direct callersNo direct callstiny.geometryAabb
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/geometry/src/primitive.zig:64

zig
/// An axis-aligned box. A box with `min` above `max` on any axis is empty.pub const Aabb = extern struct {    min: Vec3,    max: Vec3,    /// The box that contains nothing and grows to fit whatever joins it.    pub const empty: Aabb = .{        .min = Vec3.splat(std.math.inf(f32)),        .max = Vec3.splat(-std.math.inf(f32)),    };    pub fn fromPoint(p: Vec3) Aabb {        return .{ .min = p, .max = p };    }    pub fn join(a: Aabb, b: Aabb) Aabb {        return .{ .min = a.min.min(b.min), .max = a.max.max(b.max) };    }    pub fn joinPoint(box: Aabb, p: Vec3) Aabb {        return .{ .min = box.min.min(p), .max = box.max.max(p) };    }    pub fn inflate(box: Aabb, margin: f32) Aabb {        return .{ .min = box.min.sub(Vec3.splat(margin)), .max = box.max.add(Vec3.splat(margin)) };    }    pub fn isEmpty(box: Aabb) bool {        return box.min.x > box.max.x or box.min.y > box.max.y or box.min.z > box.max.z;    }    pub fn center(box: Aabb) Vec3 {        return box.min.add(box.max).scale(0.5);    }    pub fn extent(box: Aabb) Vec3 {        return box.max.sub(box.min);    }    /// Half the surface area, the cost weight of a surface area heuristic.    pub fn halfArea(box: Aabb) f32 {        if (box.isEmpty()) return 0;        const e = box.extent();        return e.x * e.y + e.y * e.z + e.z * e.x;    }    /// The largest coordinate magnitude of either corner.    pub fn magnitude(box: Aabb) f32 {        return @max(box.min.abs().maxComponent(), box.max.abs().maxComponent());    }    pub fn containsPoint(box: Aabb, p: Vec3) bool {        return p.x >= box.min.x and p.x <= box.max.x and            p.y >= box.min.y and p.y <= box.max.y and            p.z >= box.min.z and p.z <= box.max.z;    }    pub fn overlaps(a: Aabb, b: Aabb) bool {        return a.min.x <= b.max.x and b.min.x <= a.max.x and            a.min.y <= b.max.y and b.min.y <= a.max.y and            a.min.z <= b.max.z and b.min.z <= a.max.z;    }};

Source: lib/geometry/src/root.zig:17

zig
pub const Aabb = primitive.Aabb;
Called byCallsNo direct callsSphereboundsTriangleboundsAabbfromPoint
Static calls · unresolved targets: 0 · external targets: 0.

Audit

Definitions13
Public names13
Members2
Version26.7.0
Revisiondaab053ee433