/* -*-c++-*- OpenSceneGraph Cookbook
* Chapter 2 Recipe 3
* Author: Wang Rui <wangray84 at gmail dot com>
*/
#include <osg/ComputeBoundsVisitor>
#include <osg/ShapeDrawable>
#include <osg/AnimationPath>
#include <osg/MatrixTransform>
#include <osg/PolygonMode>
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <osg/StateSet>
#include <osg/LineWidth>
osg::ref_ptr<osg::Geode> createboundingbox(osg::Node* node)
{
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
osg::ComputeBoundsVisitor boundvisitor ;
node->accept(boundvisitor);
osg::BoundingBox bb = boundvisitor.getBoundingBox();
float lengthx = bb.xMax()-bb.xMin();
float lengthy = bb.yMax()-bb.yMin();
float lengthz = bb.zMax()-bb.zMin();
osg::Vec3 center= osg::Vec3((bb.xMax()+bb.xMin())/2,(bb.yMax()+bb.yMin())/2,(bb.zMax()+bb.zMin())/2);
osg::ref_ptr<osg::S
绘制模型最小包围盒轮廓
最新推荐文章于 2024-04-27 20:09:33 发布