Search code examples
anylogicagent-based-modeling

How I can get the shortest distance from a line to an attractor in anylogic?


I want to get the shortest distance from a line to an attractor/point node in Anylogic. In all the available references, I found the function to calculate point to point distance. Is there any function/suggested way to calculate a line to point distance in Anylogic? (Please let me know if my question is not clear enough)


Solution

  • Best use a Path element from the "Space Markup" library, not a Line.

    This allows you to call getNearestPoint as below:

    enter image description here