gl3n.aabb

  • Declaration

    struct AABBT(type);

    Base template for all AABB-types.

    Parameters

    type

    all values get stored as this type

    • at

      Declaration

      alias at = type;

      Holds the internal type of the AABB.

    • Declaration

      alias vec3 = Vector!(at, 3);

      Convenience alias to the corresponding vector type.

    • min

      Declaration

      vec3 min;

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

    • max

      Declaration

      vec3 max;

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

    • Declaration

      this(vec3 min, vec3 max);

      Constructs the AABB.

      Parameters

      vec3 min

      minimum of the AABB

      vec3 max

      maximum of the AABB

    • Declaration

      static AABBT from_points(vec3[] points);

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

    • Declaration

      void expand(AABBT b);

      Expands the AABB by another AABB.

    • Declaration

      void expand(vec3 v);

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

    • Declaration

      const bool intersects(AABBT box);

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

    • Declaration

      const @property vec3 extent();

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

    • Declaration

      const @property vec3 half_extent();

      Returns the half extent.

    • Declaration

      const @property at area();

      Returns the area of the AABB.

    • Declaration

      const @property vec3 center();

      Returns the center of the AABB.

    • Declaration

      const @property vec3[] vertices();

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