Search code examples
simulationanylogicagent-based-modeling

Define distance between different areas in Anylogic


I have an Anylogic model where there are different storage areas (using Pallet racks) and waiting areas defined using rectangles. I want define distance between all these areas. Is there any way to do so in Analogic? Perhaps, by defining 1 small square in the model equals x meters or so.


Solution

  • if you want the distance in pixels between 2 areas you can do this:

    double distInPixels=node1.getCenter().distance(node2.getCenter());
    

    if you want the distance in meters, you can use the scale object as follows

    double distInMeters=scale.toLengthUnits(distInPixels,METER);
    

    Check the help documentation for distance units if you don't like meters.

    the scale allows you to change pixels to meters: enter image description here