View Javadoc
1   package org.djutils.draw;
2   
3   /**
4    * Oriented is an interface to indicate an object has a direction.
5    * <p>
6    * Copyright (c) 2020-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
7    * BSD-style license. See <a href="https://djutils.org/docs/current/djutils/licenses.html">DJUTILS License</a>.
8    * </p>
9    * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
10   * @author <a href="https://www.tudelft.nl/pknoppers">Peter Knoppers</a>
11   * @param <O> The Oriented type (2d or 3d)
12   */
13  public interface Oriented<O extends Oriented<O>>
14  {
15      /**
16       * Return a new Oriented with negated coordinate values. Adds 180 degrees (pi radians) to the rotation(s).
17       * @return D; a new Oriented with negated coordinate values and a rotation in the opposite direction
18       */
19      O neg();
20  
21      /**
22       * Return the rotation around the z-axis in radians.
23       * @return double; the rotation around the z-axis in radians
24       */
25      double getDirZ();
26  
27      /**
28       * Compare this Oriented with another Oriented with specified tolerances in the coordinates and the angles.
29       * @param other O; the point to compare with
30       * @param epsilonCoordinate double; the upper bound of difference for one of the coordinates; use Double.POSITIVE_INFINITY
31       *            if you do not want to check the coordinates
32       * @param epsilonDirection double; the upper bound of difference for the direction(s); use Double.POSITIVE_INFINITY if you
33       *            do not want to check the angles
34       * @return boolean; true if x, y, and z are less than epsilonCoordinate apart, and rotX, rotY and rotZ are less than
35       *         epsilonRotation apart, otherwise false
36       * @throws NullPointerException when other is null
37       * @throws IllegalArgumentException epsilonCoordinate or epsilonRotation is NaN or negative
38       */
39      boolean epsilonEquals(O other, double epsilonCoordinate, double epsilonDirection)
40              throws NullPointerException, IllegalArgumentException;
41  
42  }