本文整理汇总了C++中sphere::getCenter方法的典型用法代码示例。如果您正苦于以下问题:C++ sphere::getCenter方法的具体用法?C++ sphere::getCenter怎么用?C++ sphere::getCenter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sphere
的用法示例。
在下文中一共展示了sphere::getCenter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: extendBy
//! Extend the boundaries of the sphere by the given sphere.
void extendBy(const sphere<Type>& sphere)
{
if (intersect(sphere))
return;
const vec3<Type> dir = (m_center - sphere.getCenter()).normalized();
const vec3<Type> p1 = m_center + m_radius * dir;
const vec3<Type> p2 = sphere.getCenter() - sphere.getRadius() * dir;
setPoles(p1, p2);
}
示例2: intersect
//! Intersect with a sphere, returning true if there is an intersection.
bool intersect(const sphere<Type>& s) const
{
const Type d1 = (s.getCenter() - m_center).sqrLength();
const Type d2 = m_radius + s.getRadius();
return (d1 < d2 * d2);
}
示例3: sphere
sphere sphere::operator +(const sphere& other) const
{
glm::vec4 center = (c + other.getCenter()) * 0.5f;
float radius = glm::distance(c, center) + glm::max(r, other.getRadius());
return sphere(center, radius);
}
示例4: isVisible
VkBool32 frustum::isVisible(const sphere& sphereWorld) const
{
float distance;
for (auto& currentSide : sidesWorld)
{
distance = currentSide.distance(sphereWorld.getCenter());
if (distance + sphereWorld.getRadius() < 0.0f)
{
return VK_FALSE;
}
}
return VK_TRUE;
}
示例5: distance
float sphere::distance(const sphere& sphere) const
{
return glm::abs(glm::distance(c, sphere.getCenter())) - r - sphere.getRadius();
}