AnimatLab  2
Test
OsgMeshMinVertexDistanceVisitor.h
1 
2 #pragma once
3 
4 namespace OsgAnimatSim
5 {
6  namespace Visualization
7  {
8 
9 // Visitor to return the world coordinates of a node.
10 // It traverses from the starting node to the parent.
11 // The first time it reaches a root node, it stores the world coordinates of
12 // the node it started from. The world coordinates are found by concatenating all
13 // the matrix transforms found on the path from the start node to the root node.
14 
15 class ANIMAT_OSG_PORT OsgMeshMinVertexDistanceVisitor : public osg::NodeVisitor
16 {
17 public:
19  osg::NodeVisitor(NodeVisitor::TRAVERSE_ALL_CHILDREN)
20  {
21  m_fltMinVertDist = -1;
22  m_iP = -1;
23  m_iQ = -1;
24  m_lpGeom = NULL;
25  }
26  virtual void apply(osg::Node &node);
27 
28  float MinVertexDistance()
29  {
30  return m_fltMinVertDist;
31  }
32 protected:
33  void FindMinVertex(osg::Geometry *osgGeom, osg::Vec3Array *aryVert);
34 
35  float m_fltMinVertDist;
36  osg::Vec3 m_vP;
37  osg::Vec3 m_vQ;
38  int m_iP;
39  int m_iQ;
40  osg::Geometry *m_lpGeom;
41 };
42 
43  }// end Visualization
44 }//end OsgAnimatSim
45 
46 
Classes for implementing the cm-labs vortex physics engine for AnimatLab.