1. /* check slope to determine if two points should connect - assumes anything more than 45 degrees is impassable */
  2. member IsSteep(float FromX, float FromY, float FromZ, float ToX, float ToY, float ToZ)
  3. {
  4. /* determine horizontal distance and vertical distance between points */
  5. variable float slope = 0
  6. variable float maxslope = 0.8
  7. variable float horizontal = ${Math.Distance[${FromX}, ${FromY}, ${ToZ},${ToX}, ${ToY},${ToZ}]}
  8. variable float vertical = ${Math.Distance[${ToX}, ${ToY}, ${FromZ}, ${ToX}, ${ToY}, ${ToZ}]}
  9.  
  10. /* did we move? */
  11. if ${horizontal} < 1.5
  12. {
  13. return FALSE
  14. }
  15.  
  16. /* adjust for greater distance */
  17. if ${horizontal} > 5
  18. {
  19. maxslope:Set[1.15]
  20. }
  21.  
  22. /* calculate slope by dividing vertical distance by horizontal */
  23. slope:Set[${vertical}/${horizontal}]
  24.  
  25. /* if slope is greater than 1, the slope is greater than a 45 degree angle - lets not map it */
  26. if ${slope} > ${maxslope}
  27. {
  28. return TRUE
  29. }
  30. return FALSE
  31. }
  32. }