当前位置: 首页>>代码示例>>C++>>正文


C++ BoundingSphere::GetRadius方法代码示例

本文整理汇总了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);
}
开发者ID:IcedLeon,项目名称:TSPhysicEngine,代码行数:11,代码来源:AxisAlignedBoundingBox.cpp

示例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();
}
开发者ID:anhnp82,项目名称:CutSharp,代码行数:15,代码来源:BoundingSphere.cpp

示例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());
}
开发者ID:jason-amju,项目名称:amju-scp,代码行数:16,代码来源:Frustum.cpp

示例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;
}
开发者ID:anhnp82,项目名称:CutSharp,代码行数:9,代码来源:BoundingSphere.cpp

示例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);
}
开发者ID:IAmYourSerperior,项目名称:3DEngineCpp,代码行数:19,代码来源:boundingSphere.cpp

示例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;
}
开发者ID:qloach,项目名称:GeometricToolsEngine1p0,代码行数:39,代码来源:GteCuller.cpp

示例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);
}
开发者ID:MrShedman,项目名称:GL-Dev,代码行数:24,代码来源:plane.cpp

示例8: SelectionTest

bool Drone::SelectionTest(GLVector3f w)
{
    float distance = (mPosition - w).length();
    BoundingSphere* bSphere = (BoundingSphere*) mBoundingShape.GetPtr();
    return (distance <= bSphere->GetRadius());
}
开发者ID:DominikWidomski,项目名称:Cpp,代码行数:6,代码来源:Drone.cpp


注:本文中的BoundingSphere::GetRadius方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。