Created
January 21, 2013 20:51
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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