#include <Windows.h>
#include <osgDB/ReadFile>
#include <osgDB/FileUtils>
#include <osg/Group>
#include <osg/ShapeDrawable>
#include <osg/PolygonMode>
#include <osg/LineWidth>
#include <osg/MatrixTransform>
#include <osg/ComputeBoundsVisitor>
#include <osgViewer/Viewer>
osg::ref_ptr<osg::Node> cretateBoundingBox(osg::Node * node)
{
osg::ref_ptr<osg::Geode> geode = new osg::Geode();
osg::ComputeBoundsVisitor boundVisitor;
node->accept(boundVisitor);
osg::BoundingBox boundingBox = boundVisitor.getBoundingBox();
//输出XYZ范围及中心点坐标
osg::notify(osg::ALWAYS)
osg获取模型包围盒
于 2022-07-06 21:34:30 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)