本文整理汇总了C++中SegmentTree::insert_equal方法的典型用法代码示例。如果您正苦于以下问题:C++ SegmentTree::insert_equal方法的具体用法?C++ SegmentTree::insert_equal怎么用?C++ SegmentTree::insert_equal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SegmentTree
的用法示例。
在下文中一共展示了SegmentTree::insert_equal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
edgeId = graph.addEdge(leftRecPtr->second, middleRecPtr->second, diff);
else
edgeId = graph.getEdgeId(leftRecPtr->second,middleRecPtr->second);
if (graph.getEdgeData(edgeId).userData_ > diff)
{
graph.getEdgeData(edgeId).userData_ = diff;
}
}
if (treeNodePtrVec[1])
{
printf("right:%d,%d,%d\n", treeNodePtrVec[1]->getStartCoord(), treeNodePtrVec[1]->getEndCoord(), treeNodePtrVec[1]->getRefCoord());
rightRecPtr = static_cast<PolygonLinkRec*>(treeNodePtrVec[1]->getId());
if ( invalidId == rightRecPtr->second )
rightRecPtr->second = graph.addNode(Gnode(rightRecPtr));
SegCoord diff = treeNodePtrVec[1]->getRefCoord() - segInfoVec[idx].seg_.head_.x_;
printf("diff:%d\n",diff);
GraphLib::IdType edgeId;
//My personal constraint: only one edge
if (graph.beginNodeIter(middleRecPtr->second) == graph.endNodeIter(middleRecPtr->second))
edgeId = graph.addEdge(middleRecPtr->second, rightRecPtr->second, diff);
else
edgeId = graph.getEdgeId(middleRecPtr->second, rightRecPtr->second);
if (graph.getEdgeData(edgeId).userData_ > diff)
{
graph.getEdgeData(edgeId).userData_ = diff;
graph.getEdgeData(edgeId).toId_ = rightRecPtr->second;
}
}
}
st.insert_equal( SegmentTreeNode(segInfoVec[idx].seg_.head_.y_,
segInfoVec[idx].seg_.tail_.y_,
segInfoVec[idx].seg_.head_.x_,
(void*)(segInfoVec[idx].linkRecPtr_)));
treeNodePtrVec.assign(2,static_cast<StNodePtrVec::value_type>(NULL));
}
printf("NodeCount:%d EdgeCount:%d\n", graph.nodeCount(),graph.edgeCount());
CnstrntGraph::EdgeIdGen edgeIdGenObj(graph);
while(edgeIdGenObj.hasNext())
{
CnstrntGraph::EdgeType& edge = graph.getEdgeData(edgeIdGenObj.getNext());
CnstrntGraph::NodeType& from = graph.getNodeData(edge.fromId_);
CnstrntGraph::NodeType& to = graph.getNodeData(edge.toId_);
printf("edge Value:%d shape1:size:%d x:%d, shape2:size:%d x:%d\n",
edge.userData_,
((Polygon*)(from.userData_.getLinkRecPtr()->first))->size(),
((Polygon*)(from.userData_.getLinkRecPtr()->first))->front().x_,
((Polygon*)(to.userData_.getLinkRecPtr()->first))->size(),
((Polygon*)(to.userData_.getLinkRecPtr()->first))->front().x_
);
}
#if 0
// this code snippet is testing that if all the posotion of polygons are all
// altered after the constraint grah is built, this solving system can get
// all the polygons back to where it is such that the constraints are
// satisfied.
int shift = 10;
for (PolygonList::iterator iter = ++plygnList.begin(); iter != plygnList.end(); ++iter)
{