Package org.djutils.draw
Class Direction3d
java.lang.Object
org.djutils.draw.Direction3d
Class encoding a direction in 3d space. It combines dirY (similar to tilt; measured as an angle from the positive
z-direction) and dirZ (similar to pan; measured as an angle from the positive x-direction).
Copyright (c) 2023-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubledirectionDifference(Direction3d otherDirection) Determine the angle between this Direction3d and another Direction3d.booleandoublegetDirY()Retrieve the dirY component of this Direction3d.doublegetDirZ()Retrieve the dirZ component of this Direction3d.inthashCode()toString()
-
Field Details
-
dirY
public final double dirYRotation around y-axis. -
dirZ
public final double dirZRotation around z-axis.
-
-
Constructor Details
-
Direction3d
public Direction3d(double dirY, double dirZ) Construct a Direction3d.- Parameters:
dirY- the dirY component for the new Direction3ddirZ- the dirZ component for the new Direction3d- Throws:
ArithmeticException- whendirY, ordirZisNaNIllegalArgumentException- whendirY, ordirZis infinite
-
-
Method Details
-
getDirY
public double getDirY()Retrieve the dirY component of this Direction3d.- Returns:
- the
dirYcomponent of thisDirection3d
-
getDirZ
public double getDirZ()Retrieve the dirZ component of this Direction3d.- Returns:
- the
dirZcomponent of thisDirection3d
-
directionDifference
Determine the angle between this Direction3d and another Direction3d. Liberally based on https://www.cuemath.com/geometry/angle-between-vectors/- Parameters:
otherDirection- the other Direction3d- Returns:
- double the angle in Radians
- Throws:
NullPointerException- whenotherDirectionisnull
-
hashCode
public int hashCode() -
equals
-
toString
-