Package org.opentrafficsim.core.math
Class Acceleration3d
java.lang.Object
org.opentrafficsim.core.math.Acceleration3d
- All Implemented Interfaces:
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:
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.
Copyright (c) 2013-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAcceleration3d(double x, double y, double z, AccelerationUnit unit) Construct a new Acceleration3d from three double Cartesian coordinates and a acceleration unit.Construct a new Acceleration3d from three strongly typed Cartesian coordinates.Acceleration3d(Acceleration acceleration, Direction theta, Direction phi) Construct a new Acceleration3d from a strongly typed acceleration and polar coordinates.Acceleration3d(AccelerationVector acceleration) Construct a new Acceleration3d from vector of strongly typed Cartesian coordinates. -
Method Summary
Modifier and TypeMethodDescriptionfinal AccelerationRetrieve the norm of this Acceleration3d.final DirectiongetPhi()Retrieve the phi of this Acceleration3d.final DirectiongetTheta()Retrieve the theta of this Acceleration3d.final AccelerationgetX()Retrieve the x-component of this Acceleration3d.final AccelerationgetY()Retrieve the y-component of this Acceleration3d.final AccelerationgetZ()Retrieve the z-component of this Acceleration3d.final StringtoString()
-
Constructor Details
-
Acceleration3d
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
Construct a new Acceleration3d from three strongly typed Cartesian coordinates.- Parameters:
x- Acceleration; the acceleration in the x-directiony- Acceleration; the acceleration in the y-directionz- 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-directiony- double; the acceleration in the y-directionz- double; the acceleration in the z-directionunit- 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 vectortheta- Direction; the angle from the z directionphi- 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
Retrieve the x-component of this Acceleration3d.- Returns:
- the acceleration in the x-direction.
-
getY
Retrieve the y-component of this Acceleration3d.- Returns:
- the acceleration in the y-direction.
-
getZ
Retrieve the z-component of this Acceleration3d.- Returns:
- the acceleration in the z-direction.
-
getTheta
Retrieve the theta of this Acceleration3d.- Returns:
- the angle of direction perpendicular to the xy-plane
-
getPhi
Retrieve the phi of this Acceleration3d.- Returns:
- the projected angle of direction in the xy-plane
-
getAcceleration
Retrieve the norm of this Acceleration3d.- Returns:
- the combined acceleration in the direction of the angle
-
toString
-