コード例 #1
0
void GlobalMapView::UpdateEdgeFromMap(const ReferenceFrameId& a,
                                      const ReferenceFrameId& b) {
  Sophus::SE3t t_parent_child;
  SlamEdgePtr edge = map_->GetEdgePtr(a, b);
  if (edge && edge->transform(a, b, t_parent_child)) {
    UpdateEdge(edge->id(), a, b, t_parent_child);
  }
}
コード例 #2
0
ファイル: TradeGraph.cpp プロジェクト: kumzugloom/s25client
/// Creates a new complete graph
void TradeGraph::Create()
{
    for(MapPoint pt(0, 0); pt.y < size.y; ++pt.y)
        for(pt.x = 0; pt.x < size.x; ++pt.x)
            FindMainPoint(pt);

    for(MapPoint pt(0, 0); pt.y < size.y; ++pt.y)
        for(pt.x = 0; pt.x < size.x; ++pt.x)
        {
            for(unsigned d = 0; d < 8; ++d)
                UpdateEdge(pt, d, NULL);
        }
}
コード例 #3
0
ファイル: EdgeJunctionClosure.cpp プロジェクト: kanbang/TIDS
void LinkedGEJunctionClosure_Helper( const AcGePoint3d& junctionPt )
{
    //acutPrintf(_T("\n闭合点:(%.3f, %.3f)"), junctionPt.x, junctionPt.y);
    AcDbObjectIdArray objIds;
    FindLinesByPoint( junctionPt, objIds );

    int len = objIds.length();
    //acutPrintf(_T("\n找到要处理闭合的分支个数:%d"), len);
    if( len < 1 ) return;

    EdgeInfo ges;
    BuildJunctionEdgeInfo( objIds, junctionPt, ges );          // 查找junctionPt坐标处的关联分支类图元
    if( ges.size() > 0 )
    {
        SortJunctionEdge( ges );                          // 调整顺序,按角度大小逆时针排列
        EdgeJunctionClosureImpl( junctionPt, ges );            // 处理并修改相邻巷道的参数
    }
    UpdateEdge( objIds );                                          // 更新实体
}
コード例 #4
0
ファイル: TradeGraph.cpp プロジェクト: kumzugloom/s25client
/// Creates the graph at the beginning of the game using the data of the graph of another player
void TradeGraph::CreateWithHelpOfAnotherPlayer(const TradeGraph& helper, const GameClientPlayerList& players)
{
    for(MapPoint pt(0, 0); pt.y < size.y; ++pt.y)
        for(pt.x = 0; pt.x < size.x; ++pt.x)
        {
            MapPoint p(pt);
            // Player hqs far away from this point?
            unsigned nearest_hq = std::numeric_limits<unsigned>::max();
            for(unsigned i = 0; i < players.getCount(); ++i)
            {
                unsigned new_distance = gwg->CalcDistance(helper.GetNode(p).main_pos, players[i].hqPos);

                if(new_distance < nearest_hq)
                    nearest_hq = new_distance;
            }

            if(nearest_hq >= TGN_SIZE * 2)
                GetNode(p) = helper.GetNode(p);
            else
                FindMainPoint(p);
        }
    for(MapPoint pt(0, 0); pt.y < size.y; ++pt.y)
        for(pt.x = 0; pt.x < size.x; ++pt.x)
        {
            MapPoint p(pt);
            // Player hqs far away from this point?
            unsigned nearest_hq = std::numeric_limits<unsigned>::max();
            for(unsigned i = 0; i < players.getCount(); ++i)
            {
                unsigned new_distance = gwg->CalcDistance(helper.GetNode(p).main_pos, players[i].hqPos);

                if(new_distance < nearest_hq)
                    nearest_hq = new_distance;
            }

            if(nearest_hq < TGN_SIZE * 2)
                for(unsigned d = 0; d < 8; ++d)
                    UpdateEdge(pt, d, &helper);
        }
}