Skip to content

Instantly share code, notes, and snippets.

@quommit
Created January 21, 2013 20:51
Show Gist options
  • Save quommit/4589233 to your computer and use it in GitHub Desktop.
Save quommit/4589233 to your computer and use it in GitHub Desktop.
Pseudo-code for an access point calculation function from pairs of SIGUA enclosures.
function GetAccessPoint (polygon1, polygon2, useId1, useId2, useCategoryMatrix)
{
//Store the access type. Domain values are None, Exit or EvacuationOrigin
var accessType = useCategoryMatrix [useId1, useId2];
if ( accessType == None) {
return; //the pair of use category identifiers do not yield an access point
}
else if (polygon1.Touches (polygon2) == false) {
return; //the pair of polygons do not have an edge in common
}
else {
//Get shared segment
var segment = polygon1.Intersection (polygon2);
//Get access point location from segment midpoint
var coordinate = segment.MidPoint ();
//Return a new access point instance using location and access type
return new AccessPoint (coordinate, accessType);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment