/** * 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. */ @Override public boolean epsilonEquals(SpatialAcceleration other, double epsilon) { return SpatialAccelerationBasics.super.epsilonEquals(other, epsilon); }
/** * Tests if the given {@code object}'s class is the same as this, in which case the method * returns {@link #equals(SpatialVectorReadOnly)}, it returns {@code false} otherwise. * * @param object the object to compare against this. Not modified. * @return {@code true} if {@code object} and this are exactly equal, {@code false} otherwise. */ @Override public boolean equals(Object object) { if (object instanceof SpatialAccelerationReadOnly) return SpatialAccelerationBasics.super.equals((SpatialAccelerationReadOnly) object); else return false; }
/** * Tests if {@code this} and {@code other} represent the same spatial acceleration to an * {@code epsilon}. * <p> * It is likely that the implementation of this method will change in the future as the * definition of "geometrically-equal" for spatial accelerations might evolve. In the meantime, * the current assumption is that two spatial accelerations are geometrically equal if both their * 3D angular and 3D linear accelerations are independently geometrically equal, see * {@link Vector3DReadOnly#geometricallyEquals(Vector3DReadOnly, double)}. * </p> * <p> * Note that {@code this.geometricallyEquals(other, epsilon) == true} does not necessarily imply * {@code this.epsilonEquals(other, epsilon)} and vice versa. * </p> * * @param other the other spatial acceleration to compare against this. Not modified. * @param epsilon the tolerance to use for the comparison. * @return {@code true} if the two spatial accelerations represent the same physical quantity, * {@code false} otherwise. * @throws ReferenceFrameMismatchException if the reference frames of {@code other} do not * respectively match the reference frames of {@code this}. */ @Override public boolean geometricallyEquals(SpatialAcceleration other, double epsilon) { return SpatialAccelerationBasics.super.geometricallyEquals(other, epsilon); }
checkExpressedInFrameMatch(other.getReferenceFrame()); if (getBodyFrame() == other.getBaseFrame()) setBodyFrame(other.getBodyFrame()); else if (getBaseFrame() == other.getBodyFrame()) setBaseFrame(other.getBaseFrame()); else throw new ReferenceFrameMismatchException("This acceleration and other are incompatible for addition."); getAngularPart().add((Vector3DReadOnly) other.getAngularPart()); getLinearPart().add((Vector3DReadOnly) other.getLinearPart());
/** * Packs the spatial acceleration (the 3D angular and linear accelerations) of this joint's * {@code predecessor} with respect to this joint's {@code successor} resulting from the desired * acceleration of this joint. The reference frames of the resulting spatial acceleration are as * follows: * <ul> * <li>{@code bodyFrame} is {@code predecessorFrame = predecessor.getBodyFixedFrame()}. * <li>{@code baseFrame} is {@code successorFrame = successor.getBodyFixedFrame()}. * <li>{@code expressedInFrame} is {@code predecessorFrame}. * </ul> * * @param predecessorAccelerationToPack the object in which the acceleration of this joint's * {@code predecessor} resulting from this joint desired acceleration is stored. * Modified. */ default void getPredecessorAcceleration(SpatialAccelerationBasics predecessorAccelerationToPack) { predecessorAccelerationToPack.setIncludingFrame(getJointAcceleration()); ReferenceFrame predecessorFrame = getPredecessor().getBodyFixedFrame(); ReferenceFrame successorFrame = getSuccessor().getBodyFixedFrame(); predecessorAccelerationToPack.setBaseFrame(predecessorFrame); predecessorAccelerationToPack.setBodyFrame(successorFrame); predecessorAccelerationToPack.invert(); predecessorAccelerationToPack.changeFrame(predecessorFrame); }
if (getReferenceFrame() == desiredFrame) else if (getReferenceFrame() == getBaseFrame() && desiredFrame == getBodyFrame()) changeFrame(desiredFrame); else if (getReferenceFrame() == getBodyFrame() && desiredFrame == getBaseFrame()) changeFrame(desiredFrame); bodyTwist.checkBodyFrameMatch(getBodyFrame()); bodyTwist.checkBaseFrameMatch(getBaseFrame()); if (deltaTwist.getBodyFrame() == getReferenceFrame()) deltaTwist.checkBaseFrameMatch(getReferenceFrame()); flipCrossProducts = true; if (deltaTwist.getReferenceFrame() == getReferenceFrame()) addCrossToLinearPart(bodyTwist.getAngularPart(), deltaTwist.getLinearPart()); addCrossToLinearPart(bodyTwist.getLinearPart(), deltaTwist.getAngularPart()); addCrossToAngularPart(bodyTwist.getAngularPart(), deltaTwist.getAngularPart()); addCrossToLinearPart(deltaTwist.getLinearPart(), bodyTwist.getAngularPart()); addCrossToLinearPart(deltaTwist.getAngularPart(), bodyTwist.getLinearPart());
checkExpressedInFrameMatch(other.getReferenceFrame()); if (getBaseFrame() == other.getBaseFrame()) setBaseFrame(other.getBodyFrame()); else if (getBodyFrame() == other.getBodyFrame()) setBodyFrame(other.getBaseFrame()); else throw new ReferenceFrameMismatchException("This acceleration and other are incompatible for difference."); getAngularPart().sub((Vector3DReadOnly) other.getAngularPart()); getLinearPart().sub((Vector3DReadOnly) other.getLinearPart());
/** * Packs the spatial acceleration (the 3D angular and linear accelerations) of this joint's * {@code successor} with respect to this joint's {@code predecessor}. The reference frames of * the resulting spatial acceleration are as follows: * <ul> * <li>{@code bodyFrame} is {@code successorFrame = successor.getBodyFixedFrame()}. * <li>{@code baseFrame} is {@code predecessorFrame = predecessor.getBodyFixedFrame()}. * <li>{@code expressedInFrame} is {@code successorFrame}. * </ul> * * @param successorAccelerationToPack the object in which the acceleration of this joint's * {@code successor} is stored. Modified. */ default void getSuccessorAcceleration(SpatialAccelerationBasics successorAccelerationToPack) { successorAccelerationToPack.setIncludingFrame(getJointAcceleration()); ReferenceFrame predecessorFrame = getPredecessor().getBodyFixedFrame(); ReferenceFrame successorFrame = getSuccessor().getBodyFixedFrame(); successorAccelerationToPack.setBaseFrame(predecessorFrame); successorAccelerationToPack.setBodyFrame(successorFrame); successorAccelerationToPack.changeFrame(successorFrame); }