本文整理汇总了C++中AABB3D::calculateHalfDims方法的典型用法代码示例。如果您正苦于以下问题:C++ AABB3D::calculateHalfDims方法的具体用法?C++ AABB3D::calculateHalfDims怎么用?C++ AABB3D::calculateHalfDims使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AABB3D
的用法示例。
在下文中一共展示了AABB3D::calculateHalfDims方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getAABB
AABB3D FormTriangle::getAABB() {
AABB3D aabb;
aabb._lowerBound = aabb._upperBound = _points[0];
aabb.expand(_points[1]);
aabb.expand(_points[2]);
aabb.calculateHalfDims();
aabb.calculateCenter();
return aabb;
}
示例2: newCenter
AABB3D AABB3D::getTransformedAABB(const Matrix4x4f &mat) const {
AABB3D transformedAABB;
Vec3f newCenter(mat * _center);
transformedAABB._lowerBound = newCenter;
transformedAABB._upperBound = newCenter;
// Loop through all corners, transform, and compare
for (int x = -1; x <= 1; x += 2)
for (int y = -1; y <= 1; y += 2)
for (int z = -1; z <= 1; z += 2) {
Vec3f corner(x * _halfDims.x + _center.x, y * _halfDims.y + _center.y, z * _halfDims.z + _center.z);
// Transform the corner
corner = mat * corner;
// Compare bounds
if (corner.x > transformedAABB._upperBound.x)
transformedAABB._upperBound.x = corner.x;
if (corner.y > transformedAABB._upperBound.y)
transformedAABB._upperBound.y = corner.y;
if (corner.z > transformedAABB._upperBound.z)
transformedAABB._upperBound.z = corner.z;
if (corner.x < transformedAABB._lowerBound.x)
transformedAABB._lowerBound.x = corner.x;
if (corner.y < transformedAABB._lowerBound.y)
transformedAABB._lowerBound.y = corner.y;
if (corner.z < transformedAABB._lowerBound.z)
transformedAABB._lowerBound.z = corner.z;
}
// Move from local into world space
transformedAABB.calculateHalfDims();
transformedAABB.calculateCenter();
return transformedAABB;
}