maspack.geometry

Interface Boundable

• Method Summary

All Methods
Modifier and Type Method and Description
void computeCentroid(Vector3d centroid)
Computed the centroid of this element.
double computeCovariance(Matrix3d C)
Computes the covariance of the element, assuming a uniform density of one.
Point3d getPoint(int idx)
Returns the idx-th point associated with this element.
int numPoints()
Returns the number of points associated with this element, if any, or zero otherwise.
void updateBounds(Vector3d min, Vector3d max)
Updates the axis-aligned bounds of this element.
• Method Detail

• numPoints

int numPoints()
Returns the number of points associated with this element, if any, or zero otherwise. If the element has points, then it's spatial extent is assumed to be enclosed within their convex hull. At present, elements that do not have points cannot be enclosed within oriented bounding box (OBB) trees.
Returns:
number of points associated with this element
• getPoint

Point3d getPoint(int idx)
Returns the idx-th point associated with this element.
Parameters:
idx - index of the point (must be on the range 0 to numPoints()).
Returns:
idx-th point associated with this element. Must not be modified.
• computeCentroid

void computeCentroid(Vector3d centroid)
Computed the centroid of this element.
Parameters:
centroid - returns the computed centroid value.
• updateBounds

void updateBounds(Vector3d min,
Vector3d max)
Updates the axis-aligned bounds of this element. The value in min and max should be decreased or increased, respectively, so that all spatial points associated with this element lie within the axis-aligned box defined by min and max.
Parameters:
min - minimum values to be updated
max - maximum values to be updated
• computeCovariance

double computeCovariance(Matrix3d C)
Computes the covariance of the element, assuming a uniform density of one. The covariance is defined as
int_V \rho x x^T dV,

where \rho is the density, x is any spatial point within the element, and the integral is evaluated over the element's spatial extent. The method returns the element's spatial size, which for elements of dimension 3, 2, 1, or 0 will be a volume, area, length, or discrete value.

Implementation of this method is optional, with non-implementation indicated by having the method return -1. Non-implementation may prevent the element from being enclosed within certain types of oriented bounding box (OBB) constructions.

Parameters:
C - returns the covariance
Returns:
spatial size of the element, or -1 if this method is not implemented.