本文整理汇总了C++中NodeIterator::end方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeIterator::end方法的具体用法?C++ NodeIterator::end怎么用?C++ NodeIterator::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeIterator
的用法示例。
在下文中一共展示了NodeIterator::end方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Node *FEMesh::closestNode(const double x, const double y, const double z=0)
#endif
{
double min=1.; // (initial value provided to suppress compiler warnings)
Node *node, *thenode=0;
for(NodeIterator ni = node_iterator(); !ni.end(); ++ni) {
node = ni.node();
double dx = node->position()(0) - x;
double dy = node->position()(1) - y;
#if DIM==2
double dist = dx*dx + dy*dy;
#elif DIM==3
double dz = node->position()(2) - z;
double dist = dx*dx + dy*dy + dz*dz;
#endif
if (ni.begin()) {
min = dist;
thenode = node;
}
else {
if (dist <= min) {
min = dist;
thenode = node;
}
}
}
return thenode;
}
示例2: Add
bool Scene::Add( freyja::Node* node )
{
bool ret = false;
if ( node )
{
mstl::String key = node->GetType();
SceneResource* resource = mResourceDict.find( key );
if ( resource )
{
bool found = false;
for ( NodeIterator it = resource->GetIterator(), end = it.end(); it != end; it++ )
{
if ( *it == node )
{
found = true;
break;
}
}
if ( !found )
{
// FIXME: Check for name collision!
node->SetScene( this );
resource->GetList().push_back( node );
key = node->GetName();
resource->GetDictionary().insert( key, node );
}
ret = true;
}
}
return ret;
}