Bounding
Box tool
Description
This script creates a Bounding box that encloses an entity.
Supported types of Bounding boxes include Axis Aligned, Oriented and Sphere.
NOTE : Although this tool has now undergone significant usage
and testing you may still encounter issues while applying for Faces, edges and
points.
Tool Usage
1.
Invoke the tool from the Geometry and FEM Utilities group of the
Apex Utilities Geometry and FEM tool palette.
2.
Select a target (solid or
surface or face) to apply the bounding box. After selecting the target, the
tool will display the bounding box options from drop down in the order of Axis
aligned, Oriented and Sphere.
3.
After selecting bounding box
type from the drop down, a bounding box of the chosen type will appear around
the selected target.
Figure
1
– Axis Aligned Bounding Box -
field shown Axis aligned bounding box around the solid
Figure 2 – Oriented Bounding
Box - field shown Oriented Bounding box around a solid
Figure 3 – Bounding
Sphere- field shown Bounding Sphere around a solid
Supported Target types
The tool currently supports solids, surfaces, curves, faces, and
edges with “Visibility picking and Inclusive and exclusive picking toggle”.
Bounding Box
algorithms
Three Bounding Box algorithms are currently supported. They are:
Axis Aligned Bounding Box
Axis Aligned Bounding Box is implemented from the Apex API
“getAxisAlignedBoundingBox()”. The API provide two points
P
min
=
[x
min
y
min
z
min
]
and
P
max
=
[x
max
y
max
z
max
]
and
these
points are used to create a bounding box using “createBoxByLocationOrientation”.
Axis-aligned bounding boxes are a convenient bounding volume, as they
require only six floating-point values to store and fit many shapes well.
Oriented Bounding Box
Oriented Bounding Box is created using vtkOBBTree from
vtkmodules. getTessellation() AIP is used to get the tessellation of the solid
and these points from the tessellation are passed for the vtkOBBTree module.
The vtkOBBTree uses a recursive, top-down process to build the Oriented
Bounding Box. First, the root OBB is constructed by finding the mean and
covariance matrix of the cells (and their points) that define the dataset. The
eigenvectors of the covariance matrix are extracted, giving a set of three
orthogonal vectors that define the tightest-fitting OBB. To create the two
children OBB's, a split plane is found that (approximately) divides the number
cells in half. These are then assigned to the children OBB's. This process then
continues until the MaxLevel ivar limits the recursion, or no split plane can
be found. By using the vtk module, origin, max, mid, min can be retrieved, and
these points are used to create a bounding box using
“createBoxByLocationOrientation”.
Bounding Sphere
The vtk module creates a bounding sphere by taking a
one-dimensional array of 3D locations and returns the origin and radius of the
minimum bounding sphere that encloses the points. These points are supplied by
getTessellation() API of Apex. The set of points is defined by an array of
doubles, in the order of x-y-z. The vtk module uses vtkSphere.ComputeBoundingSphere()
to get the center and radius.
This algorithm is the least well tested of the three algorithms
provided and is currently provides a bounding sphere around the selected
target. Additional controls to minimize bounding sphere will be exposed in a
future release of this tool.
- Log in to post comments