View Javadoc
1   package org.djutils.draw;
2   
3   /**
4    * Directed is the interface to specify a Direction (a vector pointing in a direction without a length).
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 <D> the Directed type
12   */
13  public interface Directed<D extends Directed<D>>
14  {
15      /**
16       * Return a new O with negated coordinate values. Adds 180 degrees (pi radians) to the rotation(s).
17       * @return D; a new D with negated coordinate values and a rotation in the opposite direction
18       */
19      D neg();
20  
21      /**
22       * Compare this Directed with another Directed with specified tolerances in the coordinates and the angles.
23       * @param other D; the point to compare with
24       * @param epsilonCoordinate double; the upper bound of difference for one of the coordinates; use Double.POSITIVE_INFINITY
25       *            if you do not want to check the coordinates
26       * @param epsilonDirection double; the upper bound of difference for the direction(s); use Double.POSITIVE_INFINITY if you
27       *            do not want to check the angles
28       * @return boolean; true if x, y, and z are less than epsilonCoordinate apart, and rotX, rotY and rotZ are less than
29       *         epsilonRotation apart, otherwise false
30       * @throws NullPointerException when point is null
31       * @throws IllegalArgumentException epsilonCoordinate or epsilonRotation is NaN or negative
32       */
33      boolean epsilonEquals(D other, double epsilonCoordinate, double epsilonDirection)
34              throws NullPointerException, IllegalArgumentException;
35  
36  }