本文整理汇总了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 );
}
示例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);
}
}
}