aabb_t Derived Type

type, public :: aabb_t


Inherited by

type~~aabb_t~~InheritedByGraph type~aabb_t aabb_t type~node_t node_t type~node_t->type~aabb_t aabb type~aabbtree_t aabbtree_t type~aabbtree_t->type~node_t nodes

Contents

Source Code


Components

TypeVisibility AttributesNameInitial
real(kind=rp), public, dimension(3):: lbnd
real(kind=rp), public, dimension(3):: ubnd
real(kind=rp), public, dimension(3):: center
real(kind=rp), public :: srfarea

Type-Bound Procedures

procedure, public :: init => aabb_init

  • public subroutine aabb_init(this, lbnd, ubnd)

    Initializes an aabb_t instance from lower and upper bounds.

    Arguments

    Type IntentOptional AttributesName
    class(aabb_t), intent(out) :: this

    An aabb_t instance.

    real(kind=rp), intent(in), dimension(3):: lbnd

    Lower bound

    real(kind=rp), intent(in), dimension(3):: ubnd

    Upper bound

procedure, public :: print => aabb_print

  • public subroutine aabb_print(this, frmt, str)

    Prints an AABB.

    Arguments

    Type IntentOptional AttributesName
    class(aabb_t), intent(in) :: this

    An aabb_t instance.

    character(len=*), intent(in), optional :: frmt

    Fortran-style format string for a real number. Default: (g0.6).

    character(len=:), intent(out), optional allocatable:: str

    If present, the output is printed to this string instead of STDOUT.

procedure, public :: clear => aabb_clear

  • public subroutine aabb_clear(this)

    Clears all attributes of an AABB and sets them to zero.

    Arguments

    Type IntentOptional AttributesName
    class(aabb_t), intent(inout) :: this

    An aabb_t instance.

procedure, public :: get_extent => aabb_get_extent

  • public subroutine aabb_get_extent(this, extent)

    Calculates the extent of an aabb. The extent of an AABB is defined as the difference between its upper and lower bounds.

    Arguments

    Type IntentOptional AttributesName
    class(aabb_t), intent(in) :: this

    An aabb_t instance.

    real(kind=rp), intent(out), dimension(3):: extent

    Extent of an AABB.

procedure, public :: update => aabb_update

  • public subroutine aabb_update(this, lbnd, ubnd)

    Updates an AABB with new bounds.

    Arguments

    Type IntentOptional AttributesName
    class(aabb_t), intent(inout) :: this

    An aabb_t instance.

    real(kind=rp), intent(in), optional dimension(3):: lbnd

    Lower bound

    real(kind=rp), intent(in), optional dimension(3):: ubnd

    Upper bound

procedure, public :: fatten => aabb_fatten

  • public subroutine aabb_fatten(this, frac)

    Fattens an AABB by a fraction of its base extent.

    Arguments

    Type IntentOptional AttributesName
    class(aabb_t), intent(inout) :: this

    An aabb_t instance.

    real(kind=rp), intent(in) :: frac

    Fraction of AABB base extent.

procedure, public :: includes => aabb_includes

  • public function aabb_includes(this, other) result(res)

    Returns true if this includes other, false otherwise. Inclusion is considered in a strict sense.

    Arguments

    Type IntentOptional AttributesName
    class(aabb_t), intent(in) :: this

    An aabb_t instance.

    type(aabb_t), intent(in) :: other

    An aabb_t instance.

    Return Value logical

procedure, public :: overlaps => aabb_overlaps

  • public function aabb_overlaps(this, other) result(res)

    Returns true if this overlaps other, false otherwise. Touching does not count as an overlap.

    Arguments

    Type IntentOptional AttributesName
    class(aabb_t), intent(in) :: this

    An aabb_t instance.

    type(aabb_t), intent(in) :: other

    An aabb_t instance.

    Return Value logical

procedure, private :: calc_center => aabb_calc_center

  • public subroutine aabb_calc_center(this)

    Calculates the center of an aabb.

    Arguments

    Type IntentOptional AttributesName
    class(aabb_t), intent(inout) :: this

    An aabb_t instance.

procedure, private :: calc_srfarea => aabb_calc_srfarea

  • public subroutine aabb_calc_srfarea(this)

    Calculates the surface area of an aabb.

    Arguments

    Type IntentOptional AttributesName
    class(aabb_t), intent(inout) :: this

    An aabb_t instance.

Source Code

type aabb_t
    real(rp), dimension(3) :: lbnd
    real(rp), dimension(3) :: ubnd
    real(rp), dimension(3) :: center
    real(rp) :: srfarea
    contains
        procedure :: init => aabb_init
        procedure :: print => aabb_print
        procedure :: clear => aabb_clear
        procedure :: get_extent => aabb_get_extent
        procedure :: update => aabb_update
        procedure :: fatten => aabb_fatten
        procedure :: includes => aabb_includes
        procedure :: overlaps => aabb_overlaps
        procedure, private :: calc_center => aabb_calc_center
        procedure, private :: calc_srfarea => aabb_calc_srfarea
end type aabb_t