当前位置: 首页>>代码示例>>C++>>正文


C++ TwoDScene::getNumEdges方法代码示例

本文整理汇总了C++中TwoDScene::getNumEdges方法的典型用法代码示例。如果您正苦于以下问题:C++ TwoDScene::getNumEdges方法的具体用法?C++ TwoDScene::getNumEdges怎么用?C++ TwoDScene::getNumEdges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TwoDScene的用法示例。


在下文中一共展示了TwoDScene::getNumEdges方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: loadSceneFromXML

void TwoDSceneXMLParser::loadSceneFromXML( const std::string& filename, TwoDScene& twodscene, SceneStepper** scenestepper, scalar& dt, scalar& max_t, scalar& maxfreq, std::vector<renderingutils::Color>& particle_colors, std::vector<renderingutils::Color>& edge_colors, std::vector<renderingutils::ParticlePath>& particle_paths, renderingutils::Color& bgcolor, std::string& description, std::string& scenetag, TwoDimensionalDisplayController& display)
{
  assert( *scenestepper == NULL );
  //std::cout << "Loading scene: " << filename << std::endl;
  
  // Load the xml document
  std::vector<char> xmlchars;
  rapidxml::xml_document<> doc;
  loadXMLFile( filename, xmlchars, doc );

  // Attempt to locate the root node
  rapidxml::xml_node<>* node = doc.first_node("scene");
  if( node == NULL ) 
  {
    std::cerr << "\033[31;1mERROR IN XMLSCENEPARSER:\033[m Failed to parse xml scene file. Failed to locate root <scene> node. Exiting." << std::endl;
    exit(1);
  }    
  
  // TODO: Clear old state

  // Camera
  loadCameraLocation(node, display);

  // Scene
  loadParticles( node, twodscene );
  loadEdges( node, twodscene );
  loadSceneTag( node, scenetag );
  // Forces
  loadSpringForces( node, twodscene );
  loadSimpleGravityForces( node, twodscene );
  loadGravitationalForces( node, twodscene );
  loadDragDampingForces( node, twodscene );
  loadVorexForces( node, twodscene );
  // Integrator/solver
  loadIntegrator( node, scenestepper, dt );
  loadMaxTime( node, max_t );
  // UI
  loadMaxSimFrequency( node, maxfreq );  
  // Rendering state
  particle_colors.resize(twodscene.getNumParticles(),renderingutils::Color(0.650980392156863,0.294117647058824,0.0));
  loadParticleColors( node, particle_colors );
  edge_colors.resize(twodscene.getNumEdges(),renderingutils::Color(0.0,0.388235294117647,0.388235294117647));
  loadEdgeColors( node, edge_colors );
  loadBackgroundColor( node, bgcolor );
  loadParticlePaths( node, dt, particle_paths );
  
  std::string description_string;
  loadSceneDescriptionString( node, description );
}
开发者ID:B-Rich,项目名称:sim3d,代码行数:49,代码来源:TwoDSceneXMLParser.cpp

示例2: performCollisionDetection

void AllPairsDetector::performCollisionDetection(const TwoDScene &scene, const VectorXs &qs, const VectorXs &qe, DetectionCallback &dc)
{
  for(int i=0; i<(int)scene.getNumParticles(); i++)
  {
    for(int j=i+1; j<(int)scene.getNumParticles(); j++)
    {
      dc.ParticleParticleCallback(i,j);
    }

    for(int e=0; e<(int)scene.getNumEdges(); e++)
    {
      if(scene.getEdge(e).first != i && scene.getEdge(e).second != i)
        dc.ParticleEdgeCallback(i,e);
    }
      
    for(int h=0; h<(int)scene.getNumHalfplanes(); h++)
    {
      dc.ParticleHalfplaneCallback(i,h);
    }
  }
}
开发者ID:js4768,项目名称:4167T3M2,代码行数:21,代码来源:AllPairsDetector.cpp


注:本文中的TwoDScene::getNumEdges方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。