/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file Position.cpp14/// @author Daniel Krajzewicz15/// @author Jakob Erdmann16/// @author Axel Wegener17/// @author Michael Behrisch18/// @date Sept 200219///20// A position in the 2D- or 3D-world21/****************************************************************************/22#include <config.h>2324#include <limits>25#include "GeomHelper.h"26#include "Position.h"272829// ===========================================================================30// static member definitions31// ===========================================================================3233// Position 1Mio km below the surface should suffice for signaling invalidity inside the solar system34const Position Position::INVALID(35- 1024 * 1024 * 1024,36- 1024 * 1024 * 1024,37- 1024 * 1024 * 1024);383940Position41Position::rotateAround2D(double rad, const Position& origin) {42const double s = sin(rad);43const double c = cos(rad);44Position p = (*this) - origin;45return Position(46p.x() * c - p.y() * s,47p.x() * s + p.y() * c) + origin;4849}5051void52Position::round(int precision) {53// bankers rounding as in iostream54myX = roundDecimalToEven(myX, precision);55myY = roundDecimalToEven(myY, precision);56myZ = roundDecimalToEven(myZ, precision);57}585960