MCPcopy Create free account
hub / github.com/SimHacker/micropolis / getDistance

Method getDistance

MicropolisCore/src/MicropolisEngine/src/sprite.cpp:520–523  ·  view source on GitHub ↗

* Compute Manhattan distance between two points. * @param x1 X coordinate first point. * @param y1 Y coordinate first point. * @param x2 X coordinate second point. * @param y2 Y coordinate second point. * @return Manhattan distance between both points. */

Source from the content-addressed store, hash-verified

518 * @return Manhattan distance between both points.
519 */
520int Micropolis::getDistance(int x1, int y1, int x2, int y2)
521{
522 return absoluteValue(x1 - x2) + absoluteValue(y1 - y2);
523}
524
525
526/**

Callers

nothing calls this directly

Calls 1

absoluteValueFunction · 0.85

Tested by

no test coverage detected