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


C++ AxisAlignedBox::getMinimum方法代码示例

本文整理汇总了C++中AxisAlignedBox::getMinimum方法的典型用法代码示例。如果您正苦于以下问题:C++ AxisAlignedBox::getMinimum方法的具体用法?C++ AxisAlignedBox::getMinimum怎么用?C++ AxisAlignedBox::getMinimum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AxisAlignedBox的用法示例。


在下文中一共展示了AxisAlignedBox::getMinimum方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

    //-------------------------------------------------------------------------
    TerrainTile * OverhangTerrainPage::getTerrainTile( const Vector3 & pt )
    {
        /* Since we don't know if the terrain is square, or has holes, we use a line trace
        to find the containing tile...
        */

        TerrainTile * tile = tiles[ 0 ][ 0 ];

        while ( tile != 0 )
        {
            AxisAlignedBox b = tile -> getBoundingBox();

            if ( pt.x < b.getMinimum().x )
                tile = tile -> _getNeighbor( TerrainTile::WEST );
            else if ( pt.x > b.getMaximum().x )
                tile = tile -> _getNeighbor( TerrainTile::EAST );
            else if ( pt.z < b.getMinimum().z )
                tile = tile -> _getNeighbor( TerrainTile::NORTH );
            else if ( pt.z > b.getMaximum().z )
                tile = tile -> _getNeighbor( TerrainTile::SOUTH );
            else
                return tile;
        }

        return 0;
    }
开发者ID:nithins,项目名称:ogre-overhang-terrain,代码行数:27,代码来源:OverhangTerrainPage.cpp

示例2: _getChildIndexes

    /** It's assumed the the given box has already been proven to fit into
    * a child.  Since it's a loose octree, only the centers need to be
    * compared to find the appropriate node.
    */
    void Octree::_getChildIndexes( const AxisAlignedBox &box, int *x, int *y, int *z ) const
    {
        Vector3 max = mBox.getMaximum();
        Vector3 min = box.getMinimum();

        Vector3 center = mBox.getMaximum().midPoint( mBox.getMinimum() );

        Vector3 ncenter = box.getMaximum().midPoint( box.getMinimum() );

        if ( ncenter.x > center.x )
            * x = 1;
        else
            *x = 0;

        if ( ncenter.y > center.y )
            * y = 1;
        else
            *y = 0;

        if ( ncenter.z > center.z )
            * z = 1;
        else
            *z = 0;

    }
开发者ID:Strongc,项目名称:game-ui-solution,代码行数:29,代码来源:OgreOctreeZoneOctree.cpp

示例3:

//------------------------------------------------------------------------------
void SegmentedDynamicLightManager::LightData::setBounds(const AxisAlignedBox& i_Bounds)
{
	mMinX = i_Bounds.getMinimum().x;
	mMaxX = i_Bounds.getMaximum().x;
	mMinZ = i_Bounds.getMinimum().z;
	mMaxZ = i_Bounds.getMaximum().z;
}
开发者ID:sanyaade-teachings,项目名称:ogre,代码行数:8,代码来源:SegmentedDynamicLightManager.cpp

示例4: _isTwiceSize

/** Returns true is the box will fit in a child.
*/
bool Octree::_isTwiceSize( const AxisAlignedBox &box ) const
{
    return ( ( box.getMaximum().x - box.getMinimum().x ) <= ( mBox.getMaximum().x - mBox.getMinimum().x ) / 2 ) &&
           ( ( box.getMaximum().y - box.getMinimum().y ) <= ( mBox.getMaximum().y - mBox.getMinimum().y ) / 2 ) &&
           ( ( box.getMaximum().z - box.getMinimum().z ) <= ( mBox.getMaximum().z - mBox.getMinimum().z ) / 2 ) ;

}
开发者ID:brock7,项目名称:TianLong,代码行数:9,代码来源:OgreOctree.cpp

示例5: isBoundOkForMcGuire

    // ------------------------------------------------------------------------
    static bool isBoundOkForMcGuire(const AxisAlignedBox& lightCapBounds, const Ogre::Vector3& lightPosition)
    {
        // If light position is inside light cap bound then extrusion could be in opposite directions
        // and McGuire cap could intersect near clip plane of camera frustum without being noticed
        if(lightCapBounds.contains(lightPosition))
            return false;

        // If angular size of object is too high then extrusion could be in almost opposite directions,
        // interpolated points would be extruded by shorter distance, and strange geometry of McGuire cap
        // could be visible even for well tesselated meshes. As a heuristic we will avoid McGuire cap if
        // angular size is larger than 60 degrees - it guarantees that interpolated points would be
        // extruded by at least cos(60deg/2) ~ 86% of the original extrusion distance.
        if(lightCapBounds.getHalfSize().length() / (lightCapBounds.getCenter() - lightPosition).length() > 0.5) // if boundingSphereAngularSize > 60deg
        {
            // Calculate angular size one more time using edge corners angular distance comparision,
            // Determine lit sides of the bound, store in mask
            enum { L = 1, R = 2, B = 4, T = 8, F = 16, N = 32 }; // left, right, bottom, top, far, near
            unsigned lightSidesMask = 
                (lightPosition.x < lightCapBounds.getMinimum().x ? L : 0) | // left
                (lightPosition.x > lightCapBounds.getMaximum().x ? R : 0) | // right
                (lightPosition.y < lightCapBounds.getMinimum().y ? B : 0) | // bottom
                (lightPosition.y > lightCapBounds.getMaximum().y ? T : 0) | // top
                (lightPosition.z < lightCapBounds.getMinimum().z ? F : 0) | // far
                (lightPosition.z > lightCapBounds.getMaximum().z ? N : 0);  // near
            
            // find corners on lit/unlit edge (should not be more than 6 simultaneously, but better be safe than sorry)
            Ogre::Vector3 edgeCorners[8]; 
            unsigned edgeCornersCount = 0;
            std::pair<unsigned, AxisAlignedBox::CornerEnum> cornerMap[8] = {
                { F|L|B, AxisAlignedBox::FAR_LEFT_BOTTOM }, { F|R|B, AxisAlignedBox::FAR_RIGHT_BOTTOM },
                { F|L|T, AxisAlignedBox::FAR_LEFT_TOP },    { F|R|T, AxisAlignedBox::FAR_RIGHT_TOP },
                { N|L|B, AxisAlignedBox::NEAR_LEFT_BOTTOM },{ N|R|B, AxisAlignedBox::NEAR_RIGHT_BOTTOM },
                { N|L|T, AxisAlignedBox::NEAR_LEFT_TOP },   { N|R|T, AxisAlignedBox::NEAR_RIGHT_TOP }};
            for(auto& c : cornerMap)
                if((lightSidesMask & c.first) != 0 && (lightSidesMask & c.first) != c.first) // if adjacent sides not all lit or all unlit
                    edgeCorners[edgeCornersCount++] = lightCapBounds.getCorner(c.second);
            
            // find max angular size in range [0..pi] by finding min cos of angular size, range [1..-1]
            Real cosAngle = 1.0;
            for(unsigned i0 = 0; i0 + 1 < edgeCornersCount; ++i0)
                for(unsigned i1 = i0 + 1; i1 < edgeCornersCount; ++i1)
                {
                    // 4~6 edge corners, 6~15 angular distance calculations
                    Vector3 a = (edgeCorners[i0] - lightPosition).normalisedCopy();
                    Vector3 b = (edgeCorners[i1] - lightPosition).normalisedCopy();
                    Real cosAB = a.dotProduct(b);
                    if(cosAngle > cosAB)
                        cosAngle  = cosAB;
                }
            
            if(cosAngle < 0.5) // angularSize > 60 degrees
                return false;
        }

        return true;
    }
开发者ID:yiliu1203,项目名称:OGRE,代码行数:57,代码来源:OgreShadowCaster.cpp

示例6: setExtents

  void TerrainInfo::setExtents(const AxisAlignedBox& extents)
  {
    if (mWidth == 0)
      OGRE_EXCEPT(Exception::ERR_INVALID_STATE, "You must set a heightmap first.", "TerrainInfo::setExtents");

    mOffset = extents.getMinimum();
    mScale = extents.getMaximum() - extents.getMinimum();
    mScale.x /= mWidth;
    mScale.z /= mHeight;
  }
开发者ID:oksangman,项目名称:Ant,代码行数:10,代码来源:ETTerrainInfo.cpp

示例7:

	/* Find the best (smallest) zone that contains a point
	*/
	PCZone * PCZSceneManager::findZoneForPoint(Vector3 & point)
	{
		PCZone * zone;
		PCZone * bestZone = mDefaultZone;
		Real bestVolume = Ogre::Math::POS_INFINITY;

		ZoneMap::iterator zit = mZones.begin();

		while ( zit != mZones.end() )
		{
			zone = zit->second;
			AxisAlignedBox aabb;
			zone->getAABB(aabb);
			SceneNode * enclosureNode = zone->getEnclosureNode();
			if (enclosureNode != 0)
			{
				// since this is the "local" AABB, add in world translation of the enclosure node
				aabb.setMinimum(aabb.getMinimum() + enclosureNode->_getDerivedPosition());
				aabb.setMaximum(aabb.getMaximum() + enclosureNode->_getDerivedPosition());
			}
			if (aabb.contains(point))
			{
				if (aabb.volume() < bestVolume)
				{
					// this zone is "smaller" than the current best zone, so make it
					// the new best zone
					bestZone = zone;
					bestVolume = aabb.volume();
				}
			}
			// proceed to next zone in the list
			++zit;
		}
		return bestZone;
	}
开发者ID:MrLobo,项目名称:El-Rayo-de-Zeus,代码行数:37,代码来源:OgrePCZSceneManager.cpp

示例8: fromJSAxisAlignedBox

    TEST_FIXTURE(ScriptingTestEnvironment, ConvertFiniteAxisAlignedBoxFromJavaScript)
    {
        HandleScope handle_scope;

        Handle<Value> result = pScriptingManager->execute("import_module('Athena.Math'); new Athena.Math.AxisAlignedBox(1, 2, 3, 4, 5, 6);");

        AxisAlignedBox aab = fromJSAxisAlignedBox(result);

        CHECK(aab.isFinite());
        CHECK_CLOSE(1.0f, aab.getMinimum().x, 1e-6f);
        CHECK_CLOSE(2.0f, aab.getMinimum().y, 1e-6f);
        CHECK_CLOSE(3.0f, aab.getMinimum().z, 1e-6f);
        CHECK_CLOSE(4.0f, aab.getMaximum().x, 1e-6f);
        CHECK_CLOSE(5.0f, aab.getMaximum().y, 1e-6f);
        CHECK_CLOSE(6.0f, aab.getMaximum().z, 1e-6f);
    }
开发者ID:Kanma,项目名称:Athena-Math,代码行数:16,代码来源:test_Conversions.cpp

示例9: intersects

    //-----------------------------------------------------------------------
    bool Math::intersects(const Sphere& sphere, const AxisAlignedBox& box)
    {
        if (box.isNull()) return false;
        if (box.isInfinite()) return true;

        // Use splitting planes
        const Vector3& center = sphere.getCenter();
        Real radius = sphere.getRadius();
        const Vector3& min = box.getMinimum();
        const Vector3& max = box.getMaximum();

        // Arvo's algorithm
        Real s, d = 0;
        for (int i = 0; i < 3; ++i)
        {
            if (center.ptr()[i] < min.ptr()[i])
            {
                s = center.ptr()[i] - min.ptr()[i];
                d += s * s; 
            }
            else if(center.ptr()[i] > max.ptr()[i])
            {
                s = center.ptr()[i] - max.ptr()[i];
                d += s * s; 
            }
        }
        return d <= radius * radius;

    }
开发者ID:Gerviba,项目名称:MuOnline,代码行数:30,代码来源:OgreMath.cpp

示例10: resize

void OctreeSceneManager::resize( const AxisAlignedBox &box )
{
    list< SceneNode * >::type nodes;
    list< SceneNode * >::type ::iterator it;

    _findNodes( mOctree->mBox, nodes, 0, true, mOctree );

    OGRE_DELETE mOctree;

    mOctree = OGRE_NEW Octree( 0 );
    mOctree->mBox = box;

    const Vector3 &min = box.getMinimum();
    const Vector3 &max = box.getMaximum();
    mOctree->mHalfSize = ( max - min ) * 0.5f;

    it = nodes.begin();

    while ( it != nodes.end() )
    {
        OctreeNode * on = static_cast < OctreeNode * > ( *it );
        on -> setOctant( 0 );
        _updateOctreeNode( on );
        ++it;
    }

}
开发者ID:digimatic,项目名称:ogre,代码行数:27,代码来源:OgreOctreeSceneManager.cpp

示例11: _isIn

/** Since we are loose, only check the center.
*/
bool OctreeNode::_isIn( AxisAlignedBox &box )
{
	// Always fail if not in the scene graph or box is null
	if (!mIsInSceneGraph || box.isNull()) return false;

	// Always succeed if AABB is infinite
	if (box.isInfinite())
		return true;

    Vector3 center = mWorldAABB.getMaximum().midPoint( mWorldAABB.getMinimum() );

    Vector3 bmin = box.getMinimum();
    Vector3 bmax = box.getMaximum();

    bool centre = ( bmax > center && bmin < center );
	if (!centre)
		return false;

	// Even if covering the centre line, need to make sure this BB is not large
	// enough to require being moved up into parent. When added, bboxes would
	// end up in parent due to cascade but when updating need to deal with
	// bbox growing too large for this child
	Vector3 octreeSize = bmax - bmin;
	Vector3 nodeSize = mWorldAABB.getMaximum() - mWorldAABB.getMinimum();
	return nodeSize < octreeSize;

}
开发者ID:danyr,项目名称:gamekit,代码行数:29,代码来源:OgreOctreeNode.cpp

示例12: intersection

	ParaEngine::AxisAlignedBox AxisAlignedBox::intersection(const AxisAlignedBox& b2) const
	{
		if (this->isNull() || b2.isNull())
		{
			return AxisAlignedBox();
		}
		else if (this->isInfinite())
		{
			return b2;
		}
		else if (b2.isInfinite())
		{
			return *this;
		}

		Vector3 intMin = mMinimum;
		Vector3 intMax = mMaximum;

		intMin.makeCeil(b2.getMinimum());
		intMax.makeFloor(b2.getMaximum());

		// Check intersection isn't null
		if (intMin.x < intMax.x &&
			intMin.y < intMax.y &&
			intMin.z < intMax.z)
		{
			return AxisAlignedBox(intMin, intMax);
		}

		return AxisAlignedBox();
	}
开发者ID:LiXizhi,项目名称:NPLRuntime,代码行数:31,代码来源:ParaAxisAlignedBox.cpp

示例13: intersect

/** Checks how the box intersects with the sphere.
*/
Intersection intersect( const Sphere &one, const AxisAlignedBox &two )
{
    OctreeSceneManager::intersect_call++;
    // Null box?
    if (two.isNull()) return OUTSIDE;
    if (two.isInfinite()) return INTERSECT;

    float sradius = one.getRadius();

    sradius *= sradius;

    Vector3 scenter = one.getCenter();

    const Vector3& twoMin = two.getMinimum();
    const Vector3& twoMax = two.getMaximum();

    float s, d = 0;

    Vector3 mndistance = ( twoMin - scenter );
    Vector3 mxdistance = ( twoMax - scenter );

    if ( mndistance.squaredLength() < sradius &&
            mxdistance.squaredLength() < sradius )
    {
        return INSIDE;
    }

    //find the square of the distance
    //from the sphere to the box
    for ( int i = 0 ; i < 3 ; i++ )
    {
        if ( scenter[ i ] < twoMin[ i ] )
        {
            s = scenter[ i ] - twoMin[ i ];
            d += s * s;
        }

        else if ( scenter[ i ] > twoMax[ i ] )
        {
            s = scenter[ i ] - twoMax[ i ];
            d += s * s;
        }

    }

    bool partial = ( d <= sradius );

    if ( !partial )
    {
        return OUTSIDE;
    }

    else
    {
        return INTERSECT;
    }


}
开发者ID:digimatic,项目名称:ogre,代码行数:61,代码来源:OgreOctreeSceneManager.cpp

示例14: axisAlignedBoxToString

	String StringConv::axisAlignedBoxToString(const AxisAlignedBox& _val, size_t _precision)
	{
		String r;
		r += toString(_val.getMinimum(), _precision);
		r += " ";
		r += toString(_val.getMaximum(), _precision);
		return r;
	}
开发者ID:raduetsya,项目名称:GothOgre,代码行数:8,代码来源:___GothOgre_StringConv.cpp

示例15: extrudeBounds

    // ------------------------------------------------------------------------
    void ShadowCaster::extrudeBounds(AxisAlignedBox& box, const Vector4& light, Real extrudeDist) const
    {
        Vector3 extrusionDir;

        if (light.w == 0)
        {
            // Parallel projection guarantees min/max relationship remains the same
            extrusionDir.x = -light.x;
            extrusionDir.y = -light.y;
            extrusionDir.z = -light.z;
            extrusionDir.normalise();
            extrusionDir *= extrudeDist;
            box.setExtents(box.getMinimum() + extrusionDir, 
                box.getMaximum() + extrusionDir);
        }
        else
        {
            Vector3 vmin, vmax;
            Vector3 corner, tmp;

#define __EXTRUDE_POINT()                               \
            {                                           \
                extrusionDir.x = corner.x - light.x;    \
                extrusionDir.y = corner.y - light.y;    \
                extrusionDir.z = corner.z - light.z;    \
                extrusionDir.normalise();               \
                extrusionDir *= extrudeDist;            \
                tmp = corner + extrusionDir;            \
            }
            corner = box.getMinimum(); __EXTRUDE_POINT(); vmin = vmax = tmp;
            corner.x = box.getMaximum().x; __EXTRUDE_POINT(); vmin.makeFloor(tmp); vmax.makeCeil(tmp);
            corner.y = box.getMaximum().y; __EXTRUDE_POINT(); vmin.makeFloor(tmp); vmax.makeCeil(tmp);
            corner.x = box.getMinimum().x; __EXTRUDE_POINT(); vmin.makeFloor(tmp); vmax.makeCeil(tmp);
            corner.z = box.getMaximum().z; __EXTRUDE_POINT(); vmin.makeFloor(tmp); vmax.makeCeil(tmp);
            corner.x = box.getMaximum().x; __EXTRUDE_POINT(); vmin.makeFloor(tmp); vmax.makeCeil(tmp);
            corner.y = box.getMinimum().y; __EXTRUDE_POINT(); vmin.makeFloor(tmp); vmax.makeCeil(tmp);
            corner.x = box.getMinimum().x; __EXTRUDE_POINT(); vmin.makeFloor(tmp); vmax.makeCeil(tmp);
#undef __EXTRUDE_POINT


            box.setExtents(vmin, vmax);

        }

    }
开发者ID:brock7,项目名称:TianLong,代码行数:46,代码来源:OgreShadowCaster.cpp


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