Class Acceleration3D

java.lang.Object
org.opentrafficsim.core.math.Acceleration3D
All Implemented Interfaces:
java.io.Serializable

public class Acceleration3D
extends java.lang.Object
implements java.io.Serializable
A 3D acceleration vector, decomposed in X, Y, and Z-acceleration with easy conversion from and to a spherical coordinate system.
Physicists and mathematicians do not agree on the meaning of theta and phi. In this class the convention in the physics domain is used:
  • theta is the angle from the z direction.
  • phi is the projected angle in the xy-plane from the x direction.
N.B. In the geography domain yet another convention is used.

Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

$LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, initial version Dec 10, 2015
Author:
Alexander Verbraeck, Peter Knoppers
See Also:
Serialized Form
  • Constructor Details

    • Acceleration3D

      public Acceleration3D​(AccelerationVector acceleration) throws ValueRuntimeException
      Construct a new Acceleration3D from vector of strongly typed Cartesian coordinates.
      Parameters:
      acceleration - AccelerationVector; the accelerations in 3D (YPR coded)
      Throws:
      ValueRuntimeException - in case the vector does not have exactly three elements
    • Acceleration3D

      public Acceleration3D​(Acceleration x, Acceleration y, Acceleration z) throws ValueRuntimeException
      Construct a new Acceleration3D from three strongly typed Cartesian coordinates.
      Parameters:
      x - Acceleration; the acceleration in the x-direction
      y - Acceleration; the acceleration in the y-direction
      z - Acceleration; the acceleration in the z-direction
      Throws:
      ValueRuntimeException - in case the units are incorrect
    • Acceleration3D

      public Acceleration3D​(double x, double y, double z, AccelerationUnit unit) throws ValueRuntimeException
      Construct a new Acceleration3D from three double Cartesian coordinates and a acceleration unit.
      Parameters:
      x - double; the acceleration in the x-direction
      y - double; the acceleration in the y-direction
      z - double; the acceleration in the z-direction
      unit - AccelerationUnit; the unit of the xyz parameters
      Throws:
      ValueRuntimeException - in case the units are incorrect
    • Acceleration3D

      public Acceleration3D​(Acceleration acceleration, Direction theta, Direction phi) throws ValueRuntimeException
      Construct a new Acceleration3D from a strongly typed acceleration and polar coordinates.
      Parameters:
      acceleration - Acceleration; the acceleration in the direction of the angle along the vector
      theta - Direction; the angle from the z direction
      phi - Direction; the projected angle in the xy-plane from the x direction
      Throws:
      ValueRuntimeException - in case the vector does not have exactly three elements
  • Method Details

    • getX

      public final Acceleration getX()
      Retrieve the x-component of this Acceleration3D.
      Returns:
      the acceleration in the x-direction.
    • getY

      public final Acceleration getY()
      Retrieve the y-component of this Acceleration3D.
      Returns:
      the acceleration in the y-direction.
    • getZ

      public final Acceleration getZ()
      Retrieve the z-component of this Acceleration3D.
      Returns:
      the acceleration in the z-direction.
    • getTheta

      public final Direction getTheta()
      Retrieve the theta of this Acceleration3D.
      Returns:
      the angle of direction perpendicular to the xy-plane
    • getPhi

      public final Direction getPhi()
      Retrieve the phi of this Acceleration3D.
      Returns:
      the projected angle of direction in the xy-plane
    • getAcceleration

      public final Acceleration getAcceleration()
      Retrieve the norm of this Acceleration3D.
      Returns:
      the combined acceleration in the direction of the angle
    • toString

      public final java.lang.String toString()
      Overrides:
      toString in class java.lang.Object