float getProperty(BranchLineInfo branch, BranchPropertyType type) { switch (type) { case BranchPropertyType.Radius: return(1 - branch.RadiusPercentage); case BranchPropertyType.Elevation: return(branch.ElevationPercentage); case BranchPropertyType.Inclination: return(1 - branch.InclanationPercentage); case BranchPropertyType.Length: return(branch.LengthPercentage); case BranchPropertyType.DistanceToTip: return(1 - branch.DistanceToTipPercentage); case BranchPropertyType.Exposure: return(branch.branch.ExposurePercentage); default: break; } return(0); }
float getBranchType(BranchLineInfo branch) { switch (branch.branch.bType) { case BranchType.hidden: return(0); case BranchType.Undefined: return(0); case BranchType.exposed: return(0.2f); case BranchType.lateral: return(0.4f); case BranchType.deadTipLow: return(0.6f); case BranchType.deadLateralLow: return(0.6f); case BranchType.deadTipHigh: return(1f); case BranchType.deadLateralHigh: return(0.9f); default: break; } return(0); }
float getDesirability(BranchLineInfo branch, birdLandsingSites landingType) { switch (landingType) { case birdLandsingSites.huntingSite: // Preference dead sites high up. // sum the individual desirability and rescale to 0-1. // elevation >15m. higher better // radius >0.02 if (branch.branch.isDead && branch.elevation > 15 && branch.radius > 0.01) { return((branch.ElevationPercentage + branch.RadiusPercentage).Remap(0, 2, 0, 1)); } break; case birdLandsingSites.foragingSite: // preference horizontal sites break; case birdLandsingSites.nestingSite: // preference horizontal with thick branches break; case birdLandsingSites.territorySite: // preference hidden sites break; case birdLandsingSites.unspecified: return(getBranchType(branch)); default: break; } return(0); }