本文整理汇总了C++中AxisAlignedBoundingBox::center方法的典型用法代码示例。如果您正苦于以下问题:C++ AxisAlignedBoundingBox::center方法的具体用法?C++ AxisAlignedBoundingBox::center怎么用?C++ AxisAlignedBoundingBox::center使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AxisAlignedBoundingBox
的用法示例。
在下文中一共展示了AxisAlignedBoundingBox::center方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sceneChanged
// gets called at every program start and when a new file is opened in the viewer
void AbstractNavigation::sceneChanged(Group * scene)
{
AxisAlignedBoundingBox bb = scene->boundingBox();
m_BBRadius = bb.radius();
m_frontView = glm::lookAt(bb.center() + glm::vec3(0.f, 0.f, bb.radius()*2.5), bb.center(), glm::vec3(0.f, 1.f, 0.f));
setFromMatrix(topRightView());
updateCamera();
}
示例2: sceneChanged
void LightSourcePass::sceneChanged(Group * scene)
{
if(m_scene)
m_lightcam->remove(m_scene);
m_lightcam->append(scene);
AxisAlignedBoundingBox bb = scene->boundingBox();
m_lightcam->setView(glm::lookAt(glm::vec3(4.0f, 5.5f, 6.0f) + bb.center(),
bb.center(), glm::vec3(0.0f,1.0f,0.0f)));
m_scene = scene;
}
示例3: plane_aabb
IntersectionTest::Result IntersectionTest::plane_aabb(const Vec4f &plane, const AxisAlignedBoundingBox &aabb)
{
Vec3f center = aabb.center();
Vec3f extents = aabb.extents();
float e = extents.x * std::abs(plane.x) + extents.y * std::abs(plane.y) + extents.z * std::abs(plane.z);
float s = center.x * plane.x + center.y * plane.y + center.z * plane.z + plane.w;
if (s - e > 0)
return inside;
else if (s + e < 0)
return outside;
else
return intersecting;
}
示例4: ray_aabb
IntersectionTest::OverlapResult IntersectionTest::ray_aabb(const Vec3f &ray_start, const Vec3f &ray_end, const AxisAlignedBoundingBox &aabb)
{
Vec3f c = (ray_start + ray_end) * 0.5f;
Vec3f w = ray_end - c;
Vec3f h = aabb.extents();
c -= aabb.center();
Vec3f v(std::abs(w.x), std::abs(w.y), std::abs(w.z));
if (std::abs(c.x) > v.x + h.x || std::abs(c.y) > v.y + h.y || std::abs(c.z) > v.z + h.z)
return disjoint;
if (std::abs(c.y * w.z - c.z * w.y) > h.y * v.z + h.z * v.y ||
std::abs(c.x * w.z - c.z * w.x) > h.x * v.z + h.z * v.x ||
std::abs(c.x * w.y - c.y * w.x) > h.x * v.y + h.y * v.x)
return disjoint;
return overlap;
}
示例5: DrawAxisAlignedBoundingBox
void TextEngineRenderer::DrawAxisAlignedBoundingBox(AxisAlignedBoundingBox aabb) {
DrawRectangle(aabb.center(), aabb.extent());
}