/** * Tests on a per component basis if this vector is equal to the given {@code other} to an * {@code epsilon} and both vectors are expressed in the same reference frame. * * @param other the other 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(SpatialForce other, double epsilon) { return SpatialForceBasics.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 SpatialForceReadOnly) return SpatialForceBasics.super.equals((SpatialVectorReadOnly) object); else return false; }
/** * Tests if {@code this} and {@code other} represent the same spatial force 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 forces might evolve. In the meantime, the * current assumption is that two spatial forces are geometrically equal if both their 3D torque * and 3D force 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 vector to compare against this. Not modified. * @param epsilon the tolerance to use for the comparison. * @return {@code true} if the two spatial forces 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(SpatialForce other, double epsilon) { return SpatialForceBasics.super.geometricallyEquals(other, epsilon); }
/** * Sets this spatial force given a 3D moment and 3D force that are exerted at * {@code pointOfApplication} and updates this vector reference frame. * <p> * Effectively, this spatial force is updated as follow: * * <pre> * τ<sub>this</sub> = τ<sub>new</sub> + P × f<sub>new</sub> * f<sub>this</sub> = f<sub>new</sub> * </pre> * * where τ and f are the angular and linear parts respectively, and P is the * {@code pointOfApplication}. * </p> * <p> * When the given {@code angularPart} is {@code null}, it is assumed to be zero. * </p> * * @param expressedInFrame the reference frame in which the arguments are expressed. * @param angularPart the 3D moment that is applied. Can be {@code null}. Not modified. * @param linearPart the 3D force that is applied. Not modified. * @param pointOfApplication the location where the force is exerted. Not modified. */ default void setIncludingFrame(ReferenceFrame expressedInFrame, Vector3DReadOnly angularPart, Vector3DReadOnly linearPart, Point3DReadOnly pointOfApplication) { setReferenceFrame(expressedInFrame); set(angularPart, linearPart, pointOfApplication); }
/** * Computes and packs the rate of change of momentum for the given joint accelerations. * <p> * The given matrix is expected to have been configured using the same * {@link JointMatrixIndexProvider} that was used to configure this calculator. * </p> * * @param jointAccelerationMatrix the matrix containing the joint accelerations to use. Not * modified. * @param momentumRateToPack the vector used to stored the computed rate of change of momentum. * Modified. */ public void getMomentumRate(DenseMatrix64F jointAccelerationMatrix, SpatialForceBasics momentumRateToPack) { CommonOps.mult(getCentroidalMomentumMatrix(), jointAccelerationMatrix, momentumMatrix); CommonOps.addEquals(momentumMatrix, getBiasSpatialForceMatrix()); momentumRateToPack.setIncludingFrame(matrixFrame, momentumMatrix); }
/** {@inheritDoc} */ @Override public void set(SpatialForce other) { SpatialForceBasics.super.set(other); }
linearPart.checkReferenceFrameMatch(angularPart); linearPart.checkReferenceFrameMatch(pointOfApplication); setIncludingFrame(linearPart.getReferenceFrame(), angularPart, linearPart, pointOfApplication);