本文整理汇总了C++中BoundingSphere::GetRadius方法的典型用法代码示例。如果您正苦于以下问题:C++ BoundingSphere::GetRadius方法的具体用法?C++ BoundingSphere::GetRadius怎么用?C++ BoundingSphere::GetRadius使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoundingSphere
的用法示例。
在下文中一共展示了BoundingSphere::GetRadius方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Enclose
bool AxisAlignedBoundingBox::Enclose(const BoundingSphere& a_oBoundingShere) const
{
return (a_oBoundingShere.GetCenter().x + a_oBoundingShere.GetRadius() <= m_vCenter.x + m_fHalfWidth) &&
(a_oBoundingShere.GetCenter().x - a_oBoundingShere.GetRadius() >= m_vCenter.x - m_fHalfWidth) &&
(a_oBoundingShere.GetCenter().y + a_oBoundingShere.GetRadius() <= m_vCenter.y + m_fHalfHeight) &&
(a_oBoundingShere.GetCenter().y - a_oBoundingShere.GetRadius() >= m_vCenter.y - m_fHalfHeight) &&
(a_oBoundingShere.GetCenter().z + a_oBoundingShere.GetRadius() <= m_vCenter.z + m_fHalfDepth) &&
(a_oBoundingShere.GetCenter().z - a_oBoundingShere.GetRadius() >= m_vCenter.z - m_fHalfDepth);
}
示例2: ContainsOther
bool BoundingSphere::ContainsOther(const BoundingSphere & self, const BoundingSphere & other, Vector3 & toOther, Vector3 & otherFarEnd)
{
if (self.getCenter() == other.getCenter())
{
return other.GetRadius() < self.GetRadius();
}
toOther = other.getCenter() - self.getCenter();
toOther.Normalize();
otherFarEnd = other.getCenter() + toOther*other.GetRadius();
Vector3 toOtherFarEnd = otherFarEnd - self.getCenter();
return toOtherFarEnd.Length2() < self.GetSquaredRadius();
}
示例3: Contains
bool Frustum::Contains(const BoundingSphere& bs) const
{
#ifdef GEKKO
return true; // TODO Wii culling too much - fix this properly
#endif
if (bs.GetRadius() == 0)
{
//Engine::Instance()->ReportError("Bad Sphere radius.");
return true;
}
return SphereInFrustum(bs.GetCentre().x,
bs.GetCentre().y,
bs.GetCentre().z,
bs.GetRadius());
}
示例4: Contains
bool BoundingSphere::Contains(const BoundingSphere &other, Vector3 & toOther, Vector3 & otherFarEnd)
{
toOther = other.getCenter() - m_Center;
toOther.Normalize();
otherFarEnd = other.getCenter() + toOther*other.GetRadius();
Vector3 toOtherFarEnd = otherFarEnd - m_Center;
return toOtherFarEnd.Length2() < m_SquareRadius;
}
示例5: IntersectBoundingSphere
IntersectData BoundingSphere::IntersectBoundingSphere(const BoundingSphere& other) const
{
//The radius is the distance from any point on the sphere to the center.
//
//Therefore, by adding the radius of two spheres together, the result is
//the distance between the centers of the spheres when they are touching.
float radiusDistance = m_radius + other.GetRadius();
float centerDistance = (other.GetCenter() - m_center).Length();
//Since the radiusDistance is the distance bwteen the centers of the
//spheres are when they're touching, you can subtract that from the
//distance between the centers of the spheres to get the actual distance
//between the two spheres.
float distance = centerDistance - radiusDistance;
//Spheres can only be intersecting if the distance between them is less
//than 0.
return IntersectData(distance < 0, distance);
}
示例6: IsVisible
//----------------------------------------------------------------------------
bool Culler::IsVisible (BoundingSphere const& sphere)
{
if (sphere.GetRadius() == 0.0f)
{
// The node is a dummy node and cannot be visible.
return false;
}
// Start with the last pushed plane, which is potentially the most
// restrictive plane.
int index = mPlaneQuantity - 1;
unsigned int mask = (1u << index);
for (int i = 0; i < mPlaneQuantity; ++i, --index, mask >>= 1)
{
if (mPlaneState & mask)
{
int side = sphere.WhichSide(mPlane[index]);
if (side < 0)
{
// The object is on the negative side of the plane, so
// cull it.
return false;
}
if (side > 0)
{
// The object is on the positive side of plane. There is
// no need to compare subobjects against this plane, so
// mark it as inactive.
mPlaneState &= ~mask;
}
}
}
return true;
}
示例7: IntersectSphere
IntersectData Plane::IntersectSphere(const BoundingSphere& other) const
{
//Calculating the dot product between the Plane's normal and the Sphere's
//center gets how far the sphere's center is along the Plane's normal.
//
//Adding the distance adjusts this value based on how far the Plane itself
//is along the normal.
//
//The end result of this is how far the Sphere's center is from the Plane.
//The absolute value is taken so that this result is always positive.
float distanceFromSphereCenter =
(float)fabs(m_normal.Dot(other.GetCenter()) + m_distance);
//As long as the distanceFromSphereCenter is valid and positive, then
//the distance from the sphere can be calculated simply by subtracting
//it's radius.
float distanceFromSphere = distanceFromSphereCenter - other.GetRadius();
//The only time the plane can be intersecting the sphere is if the sphere
//has less than 0 distance from the plane. Otherwise, if there is distance
//between the plane and sphere, then there must be a gap between the
//plane and sphere, and they cannot be intersecting.
return IntersectData(distanceFromSphere < 0, m_normal * distanceFromSphere);
}
示例8: SelectionTest
bool Drone::SelectionTest(GLVector3f w)
{
float distance = (mPosition - w).length();
BoundingSphere* bSphere = (BoundingSphere*) mBoundingShape.GetPtr();
return (distance <= bSphere->GetRadius());
}