FUNCTION check_continuous_edges
(edges : LIST [0:?] OF UNIQUE edge_curve) : BOOLEAN;
LOCAL i : INTEGER; next_vertex : vertex; END_LOCAL;
-- first check whether there is only one edge IN the list: IN this -- CASE there is no connectivity TO be checked.
IF (SIZEOF(edges) = 1) THEN RETURN(TRUE); END_IF;
-- otherwise, establish the matching vertices OF edges 1 AND 2 IN -- the list, AND determine the vertex OF edge 2 TO which edge 3, -- must be connected, IF there are more than two edges IN the list.
IF ((edges[2].edge_start :=: edges[1].edge_end) XOR (edges[2].edge_start :=: edges[1].edge_start)) THEN next_vertex := edges[2].edge_end; ELSE IF ((edges[2].edge_end :=: edges[1].edge_end) XOR (edges[2].edge_end :=: edges[1].edge_start)) THEN next_vertex := edges[2].edge_start; ELSE RETURN(FALSE); -- no match between any vertices OF edges 1 AND 2 END_IF; END_IF;
-- exit IF there are only two edges AND they are connected
IF (SIZEOF(edges) = 2) THEN RETURN(TRUE); END_IF;
-- otherwise, check that any remaining edges are connected IN LIST order.
REPEAT i := 3 TO HIINDEX(edges); IF (edges[i].edge_start :=: next_vertex) THEN next_vertex := edges[i].edge_end; ELSE IF (edges[i].edge_end :=: next_vertex) THEN next_vertex := edges[i].edge_start; ELSE RETURN(FALSE); -- no match is found. END_IF; END_IF; END_REPEAT; RETURN(TRUE); END_FUNCTION; -- check_continuous_edges
|