/** * Checks if the body frame held by {@code this} matches the query {@code bodyFrame}. * * @param bodyFrame the query to compare against the body frame held by {@code this}. Not * modified. * @throws ReferenceFrameMismatchException if the two reference frames are not the same: * {@code this.getBodyFrame() != bodyFrame}. */ default void checkBodyFrameMatch(ReferenceFrame bodyFrame) { if (getBodyFrame() != bodyFrame) throw new ReferenceFrameMismatchException("bodyFrame mismatch: this.bodyFrame = " + getBodyFrame() + ", other bodyFrame = " + bodyFrame); }
/** * Tests on a per component basis if this vector is equal to the given {@code other} to an * {@code epsilon} and both vectors have the same frames. * * @param other the other motion vector to compare against this. Not modified. * @param epsilon the tolerance to use when comparing each component. * @return {@code true} if the two vectors are equal, {@code false} otherwise. */ default boolean epsilonEquals(SpatialMotionReadOnly other, double epsilon) { if (getBodyFrame() != other.getBodyFrame()) return false; if (getBaseFrame() != other.getBaseFrame()) return false; return SpatialVectorReadOnly.super.epsilonEquals(other, epsilon); }
/** * Tests on a per component basis, if this vector is exactly equal to {@code other} and have the * same reference frames. * * @param other the other vector to compare against this. Not modified. * @return {@code true} if the two vectors are exactly equal component-wise, {@code false} * otherwise. */ default boolean equals(SpatialMotionReadOnly other) { if (other == null) return false; if (getBodyFrame() != other.getBodyFrame()) return false; if (getBaseFrame() != other.getBaseFrame()) return false; return SpatialVectorReadOnly.super.equals(other); } }
/** * Checks that all frames, i.e. the body frame, base frame, and the "expressed in frame", are * identical between the two spatial motion vectors. * * @param other the other object holding onto the reference frames to compare against the * reference frames held by {@code this}. Not modified. * @throws ReferenceFrameMismatchException if the reference frames are not the same: * {@code this.getBodyFrame() != other.getBodyFrame()}, * {@code this.getBaseFrame() != other.getBaseFrame()}, or * {@code this.getReferenceFrame() != other.getReferenceFrame()}. */ default void checkReferenceFrameMatch(SpatialMotionReadOnly other) throws ReferenceFrameMismatchException { checkReferenceFrameMatch(other.getBodyFrame(), other.getBaseFrame(), other.getReferenceFrame()); }
/** * Sets this motion vector to {@code other}. * * @param other the other vector to copy. Not modified. * @throws ReferenceFrameMismatchException if any of the reference frames in {@code other} do not * match {@code this}. */ default void set(SpatialMotionReadOnly other) { set(other.getBodyFrame(), other.getBaseFrame(), other.getReferenceFrame(), other.getAngularPart(), other.getLinearPart()); }
/** * Sets this motion vector to {@code other} including the reference frames. * * @param other the other motion vector used to update {@code this}. Not modified. */ default void setIncludingFrame(SpatialMotionReadOnly other) { setIncludingFrame(other.getBodyFrame(), other.getBaseFrame(), other.getReferenceFrame(), other.getAngularPart(), other.getLinearPart()); }