本文整理汇总了C++中RegionNode::getRandomEdge方法的典型用法代码示例。如果您正苦于以下问题:C++ RegionNode::getRandomEdge方法的具体用法?C++ RegionNode::getRandomEdge怎么用?C++ RegionNode::getRandomEdge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RegionNode
的用法示例。
在下文中一共展示了RegionNode::getRandomEdge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: expand
void expand(std::vector<RegionNode*> ®ions, ProbabilityDensityFunction<RegionNode> &pdf, std::vector<Edge*> &tree, KDTree &kdtree, const State &goal) {
RegionNode *randomNode = pdf.sample();
Edge *randomEdge = randomNode->getRandomEdge(zeroToOne);
for(unsigned int i = 0; i < howManySamplePoints; ++i) {
State sample = (zeroToOne(GlobalRandomGenerator) < goalBias) ? goal : agent.getRandomStateNearState(randomEdge->end, samplePointRadius);
#ifdef WITHGRAPHICS
samples.push_back(sample);
#endif
samplesGenerated++;
unsigned int cellId = discretization.getCellId(sample);
if(zeroToOne(GlobalRandomGenerator) < regions[cellId]->getWeight()) {
if(workspace.safeState(agent, sample)) {
samplesAdded++;
Edge newEdge = agent.steer(randomEdge->end, sample, std::numeric_limits<double>::infinity());
edgesGenerated++;
newEdge.updateParent(randomEdge);
if(newEdge.gCost() >= gBound) {
continue;
}
if(workspace.safeEdge(agent, newEdge, collisionCheckDT)) {
edgesAdded++;
Edge *newEdgePointer = pool.construct(newEdge);
#ifdef WITHGRAPHICS
treeEdges.push_back(newEdgePointer);
#endif
cellId = discretization.getCellId(newEdgePointer->end);
regions[cellId]->addEdge(newEdgePointer);
tree.push_back(newEdgePointer);
kdtree.insertPoint(newEdgePointer);
if(regions[cellId]->inPDF) {
pdf.update(regions[cellId]->pdfId, regions[cellId]->getWeight());
} else {
typename ProbabilityDensityFunction<RegionNode>::Element *pdfElem = pdf.add(regions[cellId], regions[cellId]->getWeight()); discretization.setInPDF(cellId);
regions[cellId]->setInPDF(true, pdfElem->getId());
}
}
}
}
}
}