OrientedBoundingBox Module



Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: TASK_THRESHOLD = 10000
integer, public, parameter :: LOCAL = 0
integer, public, parameter :: GLOBAL = 1
real(kind=RP), public, parameter :: SAFETY_FACTOR = 0.001_RP
type(OBB_type), public, allocatable :: OBB(:)

Derived Types

type, public ::  Hull_type

Components

Type Visibility Attributes Name Initial
type(point_type), public, dimension(:), allocatable :: Points
integer, public :: NumOfPoints

type, public ::  rectangle

Components

Type Visibility Attributes Name Initial
real(kind=rp), public, dimension(2,4) :: Vertices
real(kind=rp), public, dimension(2) :: Center
real(kind=rp), public, dimension(NDIM) :: normal
real(kind=rp), public, dimension(NDIM) :: t1
real(kind=rp), public, dimension(NDIM) :: t2
real(kind=rp), public :: Length
real(kind=rp), public :: Width
real(kind=rp), public :: Angle

Type-Bound Procedures

procedure, public :: ComputeVertices

type, public ::  OBB_type

Components

Type Visibility Attributes Name Initial
type(point_type), public, dimension(:), allocatable :: Points
type(point_type), public, dimension(:), allocatable :: HullPoints
type(rectangle), public :: MBR
real(kind=rp), public, dimension(NDIM,8) :: vertices
real(kind=rp), public, dimension(NDIM,8) :: LocVertices
real(kind=rp), public, dimension(NDIM,NDIM) :: R
real(kind=rp), public, dimension(NDIM,NDIM) :: invR
real(kind=rp), public, dimension(NDIM) :: CloudCenter
real(kind=rp), public, dimension(NDIM) :: LocFrameCenter
real(kind=rp), public :: nMin
real(kind=rp), public :: nMax
integer, public :: NumOfPoints
integer, public :: center
integer, public :: left
integer, public :: right
character(len=LINE_LENGTH), public :: filename
logical, public :: verbose
logical, public :: AAB

Type-Bound Procedures

procedure, public :: construct => OBB_construct
procedure, public :: ReadStorePoints => OBB_ReadStorePoints
procedure, public :: ComputeAngle => OBB_ComputeAngle
procedure, public :: SortingNodes => OBB_SortingNodes
procedure, public :: isPointInside => OBB_isPointInside
procedure, public :: ChangeObjsRefFrame => OBB_ChangeObjsRefFrame
procedure, public :: STL_rotate => OBB_STL_rotate
procedure, public :: STL_translate => OBB_STL_translate
procedure, public :: ChangeRefFrame
procedure, public :: ComputeRotationMatrix
procedure, public :: plot => OBB_plot

Functions

public function Determinant(Mat) result(det)

Arguments

Type IntentOptional Attributes Name
real(kind=rp), intent(in), dimension(:,:) :: Mat

Return Value real(kind=rp)

public function RotationType(Point1, Point2, Point3) result(Rotation)

Arguments

Type IntentOptional Attributes Name
type(point_type), intent(in) :: Point1
type(point_type), intent(in) :: Point2
type(point_type), intent(in) :: Point3

Return Value integer

public function ComputeCentroid(OBB) result(CloudCenter)

Arguments

Type IntentOptional Attributes Name
type(OBB_type), intent(in) :: OBB

Return Value real(kind=rp), dimension(NDIM)

public function ComputingAngle(a, b) result(Angle)

Arguments

Type IntentOptional Attributes Name
real(kind=rp), intent(in), dimension(:) :: a
real(kind=rp), intent(in), dimension(:) :: b

Return Value real(kind=rp)

public function CurvAbscissa(p1, p2, p3) result(t)

Arguments

Type IntentOptional Attributes Name
type(point_type), intent(in) :: p1
type(point_type), intent(in) :: p2
type(point_type), intent(in) :: p3

Return Value real(kind=rp)

public function ComputeWidth(p1, p2, p3) result(width)

Arguments

Type IntentOptional Attributes Name
type(point_type), intent(in) :: p1
type(point_type), intent(in) :: p2
type(point_type), intent(in) :: p3

Return Value real(kind=rp)

public function OBB_isPointInside(this, coords, coeff) result(isInsideOBB)

Arguments

Type IntentOptional Attributes Name
class(OBB_type), intent(inout) :: this
real(kind=rp), intent(in), dimension(:) :: coords
real(kind=rp), intent(in), optional :: coeff

Return Value logical

public function isInsideBox(Point, vertices, equal) result(isInside)

Arguments

Type IntentOptional Attributes Name
real(kind=rp), intent(in), dimension(:) :: Point
real(kind=rp), intent(in), dimension(:,:) :: vertices
logical, intent(in), optional :: equal

Return Value logical

public function ElementOBBintersect(corners, coeff, STLNum) result(intersect)

Arguments

Type IntentOptional Attributes Name
real(kind=RP), intent(in) :: corners(NDIM,8)
real(kind=RP), intent(in) :: coeff
integer, intent(in) :: STLNum

Return Value logical

public function AABTriangleIntersection(v0, v1, v2) result(Intersect)

Arguments

Type IntentOptional Attributes Name
real(kind=RP), intent(in) :: v0(NDIM)
real(kind=RP), intent(in) :: v1(NDIM)
real(kind=RP), intent(in) :: v2(NDIM)

Return Value logical


Subroutines

public subroutine ComputeEigenStructure(A, EigenVal, EigenVec1, EigenVec2, EigenVec3)

Arguments

Type IntentOptional Attributes Name
real(kind=rp), intent(in), dimension(:,:) :: A
real(kind=rp), intent(out) :: EigenVal
real(kind=rp), intent(out), dimension(NDIM) :: EigenVec1
real(kind=rp), intent(out), dimension(NDIM) :: EigenVec2
real(kind=rp), intent(out), dimension(NDIM) :: EigenVec3

public subroutine ComputeVertices(this)

Arguments

Type IntentOptional Attributes Name
class(rectangle), intent(inout) :: this

public subroutine OBB_ReadStorePoints(this, stl)

Arguments

Type IntentOptional Attributes Name
class(OBB_type), intent(inout) :: this
type(STLfile), intent(in) :: stl

public subroutine OBB_plot(this)

Arguments

Type IntentOptional Attributes Name
class(OBB_type), intent(inout) :: this

public subroutine ChangeRefFrame(this, v, FRAME, vNew)

Arguments

Type IntentOptional Attributes Name
class(OBB_type), intent(inout) :: this
real(kind=rp), intent(in), dimension(:) :: v
integer, intent(in) :: FRAME
real(kind=rp), intent(out), dimension(NDIM) :: vNew

public subroutine ComputeRotationMatrix(this, u, v, w)

Arguments

Type IntentOptional Attributes Name
class(OBB_type), intent(inout) :: this
real(kind=rp), intent(in), dimension(NDIM) :: u
real(kind=rp), intent(in), dimension(NDIM) :: v
real(kind=rp), intent(in), dimension(NDIM) :: w

public subroutine OBB_construct(this, stl, isPlot, AAB)

Arguments

Type IntentOptional Attributes Name
class(OBB_type), intent(inout) :: this
type(STLfile), intent(in) :: stl
logical, intent(in) :: isPlot
logical, intent(in) :: AAB

public subroutine OBB_ComputeAngle(this, LowestIndex)

Arguments

Type IntentOptional Attributes Name
class(OBB_type), intent(inout) :: this
integer, intent(in) :: LowestIndex

public subroutine ComputeHullExtremePoint(OBB, LowestIndex)

Arguments

Type IntentOptional Attributes Name
class(OBB_type), intent(inout) :: OBB
integer, intent(out) :: LowestIndex

public subroutine OBB_SortingNodes(this, left, right)

Arguments

Type IntentOptional Attributes Name
class(OBB_type), intent(inout) :: this
integer, intent(in) :: left
integer, intent(in) :: right

public recursive subroutine sort(a, b, coordx, coordy, coordz, left, right)

Arguments

Type IntentOptional Attributes Name
real(kind=rp), intent(inout), dimension(:) :: a
integer, intent(inout), dimension(:) :: b
real(kind=rp), intent(inout), dimension(:) :: coordx
real(kind=rp), intent(inout), dimension(:) :: coordy
real(kind=rp), intent(inout), dimension(:) :: coordz
integer, intent(in) :: left
integer, intent(in) :: right

public recursive subroutine sortReal(a, left, right)

Arguments

Type IntentOptional Attributes Name
real(kind=rp), intent(inout), dimension(:) :: a
integer, intent(in) :: left
integer, intent(in) :: right

public subroutine CovarianceMatrix(OBB, CovMat)

Arguments

Type IntentOptional Attributes Name
type(OBB_type), intent(in) :: OBB
real(kind=rp), intent(out), dimension(NDIM,NDIM) :: CovMat

public subroutine ProjectPointsOnPlane(OBB)

Arguments

Type IntentOptional Attributes Name
type(OBB_type), intent(inout) :: OBB

public subroutine PointsCloudDiagonalization(OBB, EigenVal, EigenVec1, EigenVec2, EigenVec3)

Arguments

Type IntentOptional Attributes Name
type(OBB_type), intent(inout) :: OBB
real(kind=rp), intent(out) :: EigenVal
real(kind=rp), intent(out), dimension(NDIM) :: EigenVec1
real(kind=rp), intent(out), dimension(NDIM) :: EigenVec2
real(kind=rp), intent(out), dimension(NDIM) :: EigenVec3

public subroutine ConvexHull(Hull, OBB)

Arguments

Type IntentOptional Attributes Name
type(Hull_type), intent(inout) :: Hull
type(OBB_type), intent(inout) :: OBB

public subroutine RotateVector(RotVec, theta)

Arguments

Type IntentOptional Attributes Name
real(kind=rp), intent(inout), dimension(:) :: RotVec
real(kind=rp), intent(in) :: theta

public subroutine RotatingCalipers(Hull, rectWidth, rectLength, rectAngle, rectCenter, AAB)

Arguments

Type IntentOptional Attributes Name
type(Hull_type), intent(inout) :: Hull
real(kind=rp), intent(out) :: rectWidth
real(kind=rp), intent(out) :: rectLength
real(kind=rp), intent(out) :: rectAngle
real(kind=rp), intent(out), dimension(:) :: rectCenter
logical, intent(in) :: AAB

public subroutine ExtrudeMBR(OBB)

Arguments

Type IntentOptional Attributes Name
type(OBB_type), intent(inout) :: OBB

public subroutine OBB_ChangeObjsRefFrame(this, objs, FRAME)

Arguments

Type IntentOptional Attributes Name
class(OBB_type), intent(inout) :: this
type(Object_type), intent(inout) :: objs(:)
integer, intent(in) :: FRAME

public subroutine OBB_STL_rotate(this, stl, surface)

Arguments

Type IntentOptional Attributes Name
class(OBB_type), intent(inout) :: this
type(STLfile), intent(inout) :: stl
logical, intent(in) :: surface

public subroutine OBB_STL_translate(this, stl, surface)

Arguments

Type IntentOptional Attributes Name
class(OBB_type), intent(inout) :: this
type(STLfile), intent(inout) :: stl
logical, intent(in) :: surface

public subroutine RayAABIntersection(P, direction, corners, intersect, t)

Arguments

Type IntentOptional Attributes Name
real(kind=RP), intent(in) :: P(NDIM)
real(kind=RP), intent(in) :: direction(NDIM)
real(kind=RP), intent(in) :: corners(:,:)
logical, intent(out) :: intersect
real(kind=RP), intent(out) :: t