/** * Computes the distance between {@code this} and {@code other} as the absolute difference in * angle:<br> * {@code distance = Math.abs(this.yaw - other.yaw)} * * @param other the other orientation 2D. Not modified. * @return the distance between {@code this} and {@code other} contained in [0, <i>pi</pi>]. */ default double distance(Orientation2DReadOnly other) { return Math.abs(difference(other)); }
/** * Compares {@code this} to {@code other} to determine if the two orientations are geometrically * similar, i.e. the difference in yaw of {@code this} and {@code other} is less than or equal to * {@code epsilon}. * * @param other the orientation to compare to. Not modified. * @param epsilon the tolerance of the comparison. * @return {@code true} if the two orientations represent the same geometry, {@code false} * otherwise. */ default boolean geometricallyEquals(Orientation2DReadOnly other, double epsilon) { return Math.abs(difference(other)) <= epsilon; }
/** * Computes and returns the difference between {@code this} and {@code other}:<br> * {@code distance = this.yaw - other.yaw} * * @param other the other orientation 2D. Not modified. * @return the difference between {@code this} and {@code other} contained in [-<i>pi</i>, * <i>pi</pi>]. * @throws ReferenceFrameMismatchException if {@code other} is not expressed in the same frame as * {@code this}. */ default double difference(FrameOrientation2DReadOnly other) { checkReferenceFrameMatch(other); return Orientation2DReadOnly.super.difference(other); }