diff --git a/legal/templates/license-header-2024.txt b/legal/templates/license-header-2024.txt new file mode 100644 index 000000000..eb01365b3 --- /dev/null +++ b/legal/templates/license-header-2024.txt @@ -0,0 +1,12 @@ +Copyright (c) 2024 Fraunhofer FOKUS and others. All rights reserved. + +See the NOTICE file(s) distributed with this work for additional +information regarding copyright ownership. + +This program and the accompanying materials are made available under the +terms of the Eclipse Public License 2.0 which is available at +http://www.eclipse.org/legal/epl-2.0 + +SPDX-License-Identifier: EPL-2.0 + +Contact: mosaic@fokus.fraunhofer.de \ No newline at end of file diff --git a/lib/mosaic-utils/src/main/java/org/eclipse/mosaic/lib/util/VehicleReferenceUtils.java b/lib/mosaic-utils/src/main/java/org/eclipse/mosaic/lib/util/VehicleReferenceUtils.java new file mode 100644 index 000000000..5dcd977c7 --- /dev/null +++ b/lib/mosaic-utils/src/main/java/org/eclipse/mosaic/lib/util/VehicleReferenceUtils.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Fraunhofer FOKUS and others. All rights reserved. + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contact: mosaic@fokus.fraunhofer.de + */ + +package org.eclipse.mosaic.lib.util; + +import org.eclipse.mosaic.lib.geo.CartesianPoint; +import org.eclipse.mosaic.lib.geo.GeoPoint; +import org.eclipse.mosaic.lib.math.Vector3d; +import org.eclipse.mosaic.lib.math.VectorUtils; + +/** + * Utility class collecting methods to work with vehicle positions, such + * as converting the reference point from center to front bumper and vice versa. + */ +public class VehicleReferenceUtils { + + /** + * Moves the position reference of a vehicle from its center to the center of the front bumper. + */ + public static Vector3d fromCenterToFrontBumper(Vector3d pos, double heading, double length) { + return VectorUtils.getDirectionVectorFromHeading(heading, new Vector3d()).multiply(length / 2).add(pos); + } + + /** + * Moves the position reference of a vehicle from its center to the center of the front bumper. + */ + public static CartesianPoint fromCenterToFrontBumper(CartesianPoint pos, double heading, double length) { + return fromCenterToFrontBumper(pos.toVector3d(), heading, length).toCartesian(); + } + + /** + * Moves the position reference of a vehicle from its center to the center of the front bumper. + */ + public static GeoPoint fromCenterToFrontBumper(GeoPoint pos, double heading, double length) { + return fromCenterToFrontBumper(pos.toVector3d(), heading, length).toGeo(); + } + /** + * Moves the position reference of a vehicle from the center of the front bumper to its bounding box center. + */ + public static Vector3d fromFrontBumperToCenter(Vector3d pos, double heading, double length) { + return VectorUtils.getDirectionVectorFromHeading(heading, new Vector3d()).multiply(-length / 2).add(pos); + } + + /** + * Moves the position reference of a vehicle from the center of the front bumper to its bounding box center. + */ + public static CartesianPoint fromFrontBumperToCenter(CartesianPoint pos, double heading, double length) { + return fromFrontBumperToCenter(pos.toVector3d(), heading, length).toCartesian(); + } + + /** + * Moves the position reference of a vehicle from the center of the front bumper to its bounding box center. + */ + public static GeoPoint fromFrontBumperToCenter(GeoPoint pos, double heading, double length) { + return fromFrontBumperToCenter(pos.toVector3d(), heading, length).toGeo(); + } + +} diff --git a/pom.xml b/pom.xml index 2846a4f57..bcd4f8ca6 100644 --- a/pom.xml +++ b/pom.xml @@ -461,6 +461,7 @@
${parent.dir}/legal/templates/license-header-2021.txt
${parent.dir}/legal/templates/license-header-2022.txt
${parent.dir}/legal/templates/license-header-2023.txt
+
${parent.dir}/legal/templates/license-header-2024.txt
diff --git a/rti/mosaic-starter/src/main/java/org/eclipse/mosaic/starter/MosaicStarter.java b/rti/mosaic-starter/src/main/java/org/eclipse/mosaic/starter/MosaicStarter.java index 5874e245b..364c555cf 100644 --- a/rti/mosaic-starter/src/main/java/org/eclipse/mosaic/starter/MosaicStarter.java +++ b/rti/mosaic-starter/src/main/java/org/eclipse/mosaic/starter/MosaicStarter.java @@ -143,7 +143,7 @@ protected MosaicSimulation createSimulation() { protected void printVersionAndCopyrightInfo() { System.out.println("Eclipse MOSAIC [Version " + MosaicVersion.get().toString() + "]"); - System.out.println("Copyright (c) 2023 Fraunhofer FOKUS and others. All rights reserved."); + System.out.println("Copyright (c) 2024 Fraunhofer FOKUS and others. All rights reserved."); System.out.println("License EPL-2.0: Eclipse Public License Version 2 [https://eclipse.org/legal/epl-v20.html]."); System.out.println(); }