Similar to Is the Intersection Operation Commutative? . Spoiler for that one: Intersection is commutative.
I've created an algorithm (in PostGIS but the theory would work in other languages) that takes an array of polygons as an argument and performs the following: if the polygons overlap, take their intersection. If they do not overlap, union them instead.
i integer;
tmpGeom geometry;
begin
tmpGeom := geoms[1];
FOR i IN 1..array_length(geoms,1) LOOP
IF ST_CROSSES(tmpGeom,geoms[i]) THEN
tmpGeom:= ST_Intersection(tmpGeom,geoms[i]);
ELSE
tmpGeom:= ST_UNION(tmpGeom,geoms[i]);
END IF;
END LOOP;
return tmpGeom;
end;
My question is, does the order of the operation matter? I can test that by randomizing the order for an input of a set of polygons, but I'm looking for some resources to prove it.
Aucun commentaire:
Enregistrer un commentaire