void RRG::_rewire_near_nodes(RRGNode* p_node_new, std::list<RRGNode*> near_nodes) { for( std::list<RRGNode*>::iterator it=near_nodes.begin(); it!=near_nodes.end(); it++ ) { RRGNode * p_near_node = (*it); if(p_near_node->m_pos ==p_node_new->m_pos || p_near_node->m_pos==_p_root->m_pos || p_node_new->mp_parent->m_pos==p_near_node->m_pos) { continue; } if( true == _is_obstacle_free( p_node_new->m_pos, p_near_node->m_pos ) ) { double temp_delta_cost = _calculate_cost( p_node_new->m_pos, p_near_node->m_pos ); double temp_cost_from_new_node = p_node_new->m_cost + temp_delta_cost; if( temp_cost_from_new_node < p_near_node->m_cost ) { double min_delta_cost = p_near_node->m_cost - temp_cost_from_new_node; RRGNode * p_parent_node = p_near_node->mp_parent; bool removed = _remove_edge(p_parent_node, p_near_node); if(removed) { bool added = _add_edge(p_node_new, p_near_node); if( added ) { p_near_node->m_cost = temp_cost_from_new_node; _update_cost_to_children(p_near_node, min_delta_cost); } } else { std::cout << " Failed in removing " << std::endl; } } } } }
void dmz::QtPluginCanvasLink::unlink_objects ( const Handle LinkHandle, const Handle AttributeHandle, const UUID &SuperIdentity, const Handle SuperHandle, const UUID &SubIdentity, const Handle SubHandle) { LinkStruct *ls (_linkTable.remove (LinkHandle)); if (ls && (ls->AttrHandle == AttributeHandle)) { _remove_edge (SuperHandle, ls->item); _remove_edge (SubHandle, ls->item); if (_canvasModule) { _canvasModule->remove_item (LinkHandle); } delete ls; ls = 0; } }
/* polygon: * Draws a filled polygon with an arbitrary number of corners. Pass the * number of vertices, then an array containing a series of x, y points * (a total of vertices*2 values). */ void _soft_polygon(BITMAP *bmp, int vertices, AL_CONST int *points, int color) { int c; int top = INT_MAX; int bottom = INT_MIN; AL_CONST int *i1, *i2; POLYGON_EDGE *edge, *next_edge; POLYGON_EDGE *active_edges = NULL; POLYGON_EDGE *inactive_edges = NULL; ASSERT(bmp); /* allocate some space and fill the edge table */ _grow_scratch_mem(sizeof(POLYGON_EDGE) * vertices); edge = (POLYGON_EDGE *)_scratch_mem; i1 = points; i2 = points + (vertices-1) * 2; for (c=0; c<vertices; c++) { fill_edge_structure(edge, i1, i2); if (edge->bottom >= edge->top) { if (edge->top < top) top = edge->top; if (edge->bottom > bottom) bottom = edge->bottom; inactive_edges = _add_edge(inactive_edges, edge, FALSE); edge++; } i2 = i1; i1 += 2; } if (bottom >= bmp->cb) bottom = bmp->cb-1; acquire_bitmap(bmp); /* for each scanline in the polygon... */ for (c=top; c<=bottom; c++) { int hid = 0; int b1 = 0; int e1 = 0; int up = 0; int draw = 0; int e; /* check for newly active edges */ edge = inactive_edges; while ((edge) && (edge->top == c)) { next_edge = edge->next; inactive_edges = _remove_edge(inactive_edges, edge); active_edges = _add_edge(active_edges, edge, TRUE); edge = next_edge; } /* draw horizontal line segments */ edge = active_edges; while (edge) { e = edge->w; if (edge->bottom != c) { up = 1 - up; } else { e = edge->w >> 1; } if (edge->top == c) { e = edge->w >> 1; } if ((draw < 1) && (up >= 1)) { b1 = (edge->x + e) >> POLYGON_FIX_SHIFT; } else if (draw >= 1) {