本文整理汇总了C++中BoxVolume::getBounds方法的典型用法代码示例。如果您正苦于以下问题:C++ BoxVolume::getBounds方法的具体用法?C++ BoxVolume::getBounds怎么用?C++ BoxVolume::getBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoxVolume
的用法示例。
在下文中一共展示了BoxVolume::getBounds方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawVolume
/*! \ingroup GrpSystemDrawablesGeometryFunctions
Draw the given BoxVolume using direct OpenGL calls.
*/
OSG_SYSTEMLIB_DLLMAPPING
void OSG::drawVolume(const BoxVolume &volume)
{
Pnt3f min,max;
volume.getBounds(min, max);
glBegin(GL_LINE_LOOP);
glVertex3f(min[0], min[1], min[2]);
glVertex3f(max[0], min[1], min[2]);
glVertex3f(max[0], max[1], min[2]);
glVertex3f(min[0], max[1], min[2]);
glVertex3f(min[0], min[1], min[2]);
glVertex3f(min[0], min[1], max[2]);
glVertex3f(max[0], min[1], max[2]);
glVertex3f(max[0], max[1], max[2]);
glVertex3f(min[0], max[1], max[2]);
glVertex3f(min[0], min[1], max[2]);
glEnd();
glBegin(GL_LINES);
glVertex3f(min[0], max[1], min[2]);
glVertex3f(min[0], max[1], max[2]);
glVertex3f(max[0], max[1], min[2]);
glVertex3f(max[0], max[1], max[2]);
glVertex3f(max[0], min[1], min[2]);
glVertex3f(max[0], min[1], max[2]);
glEnd();
return;
}
示例2: draw
Action::ResultE draw(DrawEnv *)
{
BoxVolume vol;
_node->getWorldVolume(vol);
Pnt3f Min,Max;
vol.getBounds(Min,Max);
Real32 Length(1.05f * (Max-Min).maxValue());
drawPhysicsBodyCoordinateSystem(_body, Length);
drawPhysicsBodyLinearVelocity(_body, Length);
drawPhysicsBodyAngularVelocity(_body, Length);
// self-destruct
delete this;
return Action::Continue;
}
示例3: intersect
OSG_BASE_DLLMAPPING
bool intersect(const BoxVolume &box, const FrustumVolume &frustum)
{
Pnt3f min, max;
box.getBounds(min, max);
const Plane *frust = frustum.getPlanes();
// check each point of the box to the 6 planes
for(Int32 i = 0; i < 6; i++)
{
if(frust[i].isOutHalfSpace(min, max))
return false;
}
return true;
}
示例4: extend
OSG_BASE_DLLMAPPING
void extend(SphereVolume &srcVol, const BoxVolume &vol)
{
Pnt3f min, max, min1, max1, c;
Real32 r;
BoxVolume vol1;
vol.getBounds(min, max);
if((!srcVol.isValid () && !srcVol.isEmpty()) ||
srcVol.isInfinite() ||
srcVol.isStatic () )
{
return;
}
if(!vol.isValid())
return;
if(srcVol.isEmpty())
{
if(vol.isEmpty())
{
return;
}
else
{
c = Pnt3f((min.x() + max.x()) * 0.5f,
(min.y() + max.y()) * 0.5f,
(min.z() + max.z()) * 0.5f);
r = ((max - min).length()) / 2;
srcVol.setValue(c, r);
return;
}
}
else if(vol.isEmpty())
{
return;
}
srcVol.getBounds(min1, max1);
vol1.setBounds(osgMin(min.x(), min1.x()), osgMin(min.y(), min1.y()),
osgMin(min.z(), min1.z()), osgMax(max.x(), max1.x()),
osgMax(max.y(), max1.y()), osgMax(max.z(), max1.z()));
vol1.getBounds(min, max);
c = Pnt3f((min.x() + max.x()) * 0.5f,
(min.y() + max.y()) * 0.5f,
(min.z() + max.z()) * 0.5f);
r = ((max - min).length()) / 2;
srcVol.setValue(c, r);
return;
}
示例5: selectedNodeChanged
void selectedNodeChanged(void)
{
mgr->setHighlight(SelectedNode);
//Update Details Panel
if(SelectedNode == NULL)
{
NodeNameValueLabel->setText("");
NodeCoreTypeValueLabel->setText("");
NodeMinValueLabel->setText("");
NodeMaxValueLabel->setText("");
NodeCenterValueLabel->setText("");
NodeTriCountValueLabel->setText("");
NodeTravMaskValueLabel->setText("");
NodeOcclusionMaskValueLabel->setText("");
NodeActiveValueLabel->setText("");
}
else
{
const Char8 *NodeName = getName(SelectedNode);
if(NodeName == NULL)
{
NodeNameValueLabel->setText("Unnamed Node");
}
else
{
NodeNameValueLabel->setText(NodeName);
}
NodeCoreTypeValueLabel->setText(SelectedNode->getCore()->getType().getCName());
BoxVolume DyVol;
SelectedNode->getWorldVolume(DyVol);
Pnt3f Min,Max,Center;
DyVol.getBounds(Min,Max);
DyVol.getCenter(Center);
std::string TempText("");
TempText = boost::lexical_cast<std::string>(Min.x()) + ", " +boost::lexical_cast<std::string>(Min.x()) + ", " + boost::lexical_cast<std::string>(Min.x());
NodeMinValueLabel->setText(TempText);
TempText = boost::lexical_cast<std::string>(Max.x()) + ", " +boost::lexical_cast<std::string>(Max.x()) + ", " + boost::lexical_cast<std::string>(Max.x());
NodeMaxValueLabel->setText(TempText);
TempText = boost::lexical_cast<std::string>(Center.x()) + ", " +boost::lexical_cast<std::string>(Center.x()) + ", " + boost::lexical_cast<std::string>(Center.x());
NodeCenterValueLabel->setText(TempText);
//GeometryPrimitivesCounter PrimCounter;
//PrimCounter(SelectedNode);
//NodeTriCountValueLabel->setText(boost::lexical_cast<std::string>(PrimCounter.getTriCount()));
//NodeTravMaskValueLabel->setText(boost::lexical_cast<std::string>(SelectedNode->getTravMask()));
//NodeOcclusionMaskValueLabel->setText(boost::lexical_cast<std::string>(SelectedNode->getOcclusionMask()));
//NodeActiveValueLabel->setText(boost::lexical_cast<std::string>(SelectedNode->getActive()));
}
}
示例6: collectDrawables
void SortLastWindow::collectDrawables(Node * const node,
DrawableListT &drawables)
{
Material *mat = NULL;
NodeCore *core = node->getCore();
if(core != NULL)
{
// handle material groups
MaterialGroup *matGrp = dynamic_cast<MaterialGroup *>(core);
if(matGrp != NULL)
{
mat = matGrp->getMaterial();
// ignore transparent material groups
if(mat != NULL && mat->isTransparent())
return;
}
// handle geometries
Geometry *geo = dynamic_cast<Geometry *>(core);
if(geo != NULL)
{
mat = geo->getMaterial();
// ignore transparent materials
if(mat == NULL || mat->isTransparent() == false)
{
DrawableInfo drawableInfo;
drawableInfo.node = node;
// get transformed volume
node->updateVolume();
BoxVolume volume;
node->getWorldVolume(volume);
// get min,max
volume.getBounds(drawableInfo.bMin, drawableInfo.bMax);
// num of indices
drawableInfo.load = 0;
GeoIntegralProperty *indicesPtr =
geo->getIndex(Geometry::PositionsIndex);
if(indicesPtr != NULL)
drawableInfo.load = indicesPtr->size();
// put to list
drawables.push_back(drawableInfo);
}
}
// handle poxy groups
ProxyGroup *proxy = dynamic_cast<ProxyGroup *>(core);
if(proxy != NULL)
{
DrawableInfo drawableInfo;
drawableInfo.node = node;
// get transformed volume
node->updateVolume();
BoxVolume volume;
node->getWorldVolume(volume);
// get min,max
volume.getBounds(drawableInfo.bMin, drawableInfo.bMax);
// num of indices
drawableInfo.load = proxy->getIndices();
// put to list
drawables.push_back(drawableInfo);
}
}
MFUnrecChildNodePtr::const_iterator nI;
for( nI = node->getMFChildren()->begin();
nI != node->getMFChildren()->end();
++nI)
{
collectDrawables(*nI, drawables);
}
}
示例7: selectedNodeChanged
void selectedNodeChanged(void)
{
_mgr->setHighlight(_SelectedNode);
//Update Details Panel
if(_SelectedNode == NULL)
{
_NodeNameValueLabel->setText("");
_NodeCoreTypeValueLabel->setText("");
_NodeMinValueLabel->setText("");
_NodeMaxValueLabel->setText("");
_NodeCenterValueLabel->setText("");
_NodeTriCountValueLabel->setText("");
_NodeTravMaskValueLabel->setText("");
}
else
{
const Char8 *NodeName = getName(_SelectedNode);
if(NodeName == NULL)
{
_NodeNameValueLabel->setText("Unnamed Node");
}
else
{
_NodeNameValueLabel->setText(NodeName);
}
_NodeCoreTypeValueLabel->setText(_SelectedNode->getCore()->getType().getCName());
BoxVolume DyVol;
_SelectedNode->getWorldVolume(DyVol);
Pnt3f Min,Max,Center;
DyVol.getBounds(Min,Max);
DyVol.getCenter(Center);
std::string TempText("");
TempText = boost::lexical_cast<std::string>(Min.x())
+ ", " +boost::lexical_cast<std::string>(Min.x())
+ ", " + boost::lexical_cast<std::string>(Min.x());
_NodeMinValueLabel->setText(TempText);
TempText = boost::lexical_cast<std::string>(Max.x())
+ ", " +boost::lexical_cast<std::string>(Max.x())
+ ", " + boost::lexical_cast<std::string>(Max.x());
_NodeMaxValueLabel->setText(TempText);
TempText = boost::lexical_cast<std::string>(Center.x())
+ ", " +boost::lexical_cast<std::string>(Center.x())
+ ", " + boost::lexical_cast<std::string>(Center.x());
_NodeCenterValueLabel->setText(TempText);
_NodeTravMaskValueLabel->setText(boost::lexical_cast<std::string>(_SelectedNode->getTravMask()));
//Tri Cound
TriCountGraphOpRefPtr TheTriGraphOp = TriCountGraphOp::create();
TheTriGraphOp->traverse(_SelectedNode);
_NodeTriCountValueLabel->setText(boost::lexical_cast<std::string>(TheTriGraphOp->getNumTri()));
}
}
示例8: intersect
bool Line::intersect(const BoxVolume &box,
Real &enter,
Real &exit ) const
{
Pnt3r low;
Pnt3r high;
box.getBounds(low, high);
Real r;
Real te;
Real tl;
Real in = 0.f;
Real out = Inf;
if(_dir[0] > TypeTraits<Real>::getDefaultEps())
{
r = 1.f / _dir[0];
te = (low [0] - _pos[0]) * r;
tl = (high[0] - _pos[0]) * r;
if(tl < out)
out = tl;
if(te > in)
in = te;
}
else if(_dir[0] < -TypeTraits<Real>::getDefaultEps())
{
r = 1.f / _dir[0];
te = (high[0] - _pos[0]) * r;
tl = (low [0] - _pos[0]) * r;
if(tl < out)
out = tl;
if(te > in)
in = te;
}
else if(_pos[0] < low[0] || _pos[0] > high[0])
{
return false;
}
if(_dir[1] > TypeTraits<Real>::getDefaultEps())
{
r = 1.f / _dir[1];
te = (low [1] - _pos[1]) * r;
tl = (high[1] - _pos[1]) * r;
if(tl < out)
out = tl;
if(te > in)
in = te;
if(in-out >= TypeTraits<Real>::getDefaultEps())
return false;
}
else if(_dir[1] < -TypeTraits<Real>::getDefaultEps())
{
r = 1.f / _dir[1];
te = (high[1] - _pos[1]) * r;
tl = (low [1] - _pos[1]) * r;
if(tl < out)
out = tl;
if(te > in)
in = te;
if(in-out >= TypeTraits<Real>::getDefaultEps())
return false;
}
else if(_pos[1] < low[1] || _pos[1] > high[1])
{
return false;
}
if(_dir[2] > TypeTraits<Real>::getDefaultEps())
{
r = 1.f / _dir[2];
te = (low [2] - _pos[2]) * r;
tl = (high[2] - _pos[2]) * r;
if(tl < out)
out = tl;
if(te > in)
in = te;
}
else if(_dir[2] < -TypeTraits<Real>::getDefaultEps())
{
r = 1.f / _dir[2];
//.........这里部分代码省略.........