2 #include "MeshMinVertexDistanceVisitor.h"
7 namespace Visualization
11 void MeshMinVertexDistanceVisitor::FindMinVertex(osg::Geometry *osgGeom, osg::Vec3Array *aryVert)
16 int iLen = aryVert->size();
17 for(
int iP=0; iP<iLen; iP++)
18 for(
int iQ=0; iQ<iLen; iQ++)
21 osg::Vec3 vP = ((*aryVert)[iP]);
22 osg::Vec3 vQ = ((*aryVert)[iQ]);
26 if(fltDist > 0.05f && fltDist < m_fltMinVertDist || m_fltMinVertDist == -1)
28 m_fltMinVertDist = fltDist;
36 void MeshMinVertexDistanceVisitor::apply(osg::Node &node)
38 osg::Geode *osgGeode =
dynamic_cast<osg::Geode *
>(&node);
40 if(osgGeode && osgGeode->getNumDrawables() > 0)
42 int iDrawCount = osgGeode->getNumDrawables();
44 for(
int iDraw=0; iDraw<iDrawCount; iDraw++)
46 osg::Geometry *osgGeom =
dynamic_cast<osg::Geometry *
>(osgGeode->getDrawable(iDraw));
50 osg::ref_ptr<osg::Vec3Array> aryVert =
dynamic_cast<osg::Vec3Array*
>(osgGeom->getVertexArray());
51 FindMinVertex(osgGeom, aryVert.get());
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
double Std_CalculateDistance(CStdIPoint &ptA, CStdIPoint &ptB)
Calculates the distance between two points.