private double getDPadValue(Event event) { double dPadValue = event.getValue(); double value = 0.0; if (MathTools.epsilonEquals(dPadValue, 0.25, 1e-3)) { value = 1.0; } if (MathTools.epsilonEquals(dPadValue, 0.75, 1e-3)) { value = -1.0; } return value; }
@Override public boolean currentlyMeetsGoal() { return MathTools.epsilonEquals(yoDouble.getDoubleValue(), goalValue, epsilon); }
@Override public boolean epsilonEquals(NormalOcTreeMessage other, double epsilon) { if (treeDepth != other.treeDepth) return false; if (!MathTools.epsilonEquals(resolution, other.resolution, epsilon)) return false; if (!root.epsilonEquals(other.root, epsilon)) return false; return true; } }
/** * Assert on a component basis is the {@code tuple} is equal to (0, 0, 0) given the tolerance {@code epsilon}. * * @param tuple the query. Not modified. * @param epsilon the tolerance. * @return {@code true} if the tuple's component are all equal to zero, {@code false} otherwise. */ public static boolean isZero(Tuple3DReadOnly tuple, double epsilon) { if (!MathTools.epsilonEquals(tuple.getX(), 0.0, epsilon)) return false; if (!MathTools.epsilonEquals(tuple.getY(), 0.0, epsilon)) return false; if (!MathTools.epsilonEquals(tuple.getZ(), 0.0, epsilon)) return false; return true; }
/** * Assert on a component basis is the {@code tuple} is equal to (0, 0) given the tolerance {@code epsilon}. * * @param tuple the query. Not modified. * @param epsilon the tolerance. * @return {@code true} if the tuple's component are all equal to zero, {@code false} otherwise. */ public static boolean isZero(Tuple2DReadOnly tuple, double epsilon) { if (!MathTools.epsilonEquals(tuple.getX(), 0.0, epsilon)) return false; if (!MathTools.epsilonEquals(tuple.getY(), 0.0, epsilon)) return false; return true; }
@Override public final boolean epsilonEquals(T other, double epsilon) { if (!MathTools.epsilonEquals(time, other.getTime(), epsilon)) return false; return waypointData.epsilonEquals(other.waypointData, epsilon); }
@Override public boolean epsilonEquals(T other, double epsilon) { if (!MathTools.epsilonEquals(time, other.getTime(), epsilon)) return false; if (!waypointData.epsilonEquals(other.waypointData, epsilon)) return false; return true; } }
@Override public boolean epsilonEquals(YoOneDoFWaypoint other, double epsilon) { if (!MathTools.epsilonEquals(getPosition(), other.getPosition(), epsilon)) return false; if (!MathTools.epsilonEquals(getVelocity(), other.getVelocity(), epsilon)) return false; return true; }
@Override public boolean epsilonEquals(OneDoFWaypoint other, double epsilon) { if (!MathTools.epsilonEquals(getPosition(), other.getPosition(), epsilon)) return false; if (!MathTools.epsilonEquals(getVelocity(), other.getVelocity(), epsilon)) return false; return true; }
@Override public boolean geometricallyEquals(T other, double epsilon) { if (!MathTools.epsilonEquals(time, other.getTime(), epsilon)) return false; return waypointData.geometricallyEquals(other.waypointData, epsilon); }
@Override public boolean currentlyMeetsGoal() { return MathTools.epsilonEquals(variableOne.getDoubleValue(), variableTwo.getDoubleValue(), epsilon); }
public boolean shouldVelocityBeZero(OneDoFTrajectoryPointInterface<?> firstTrajectoryPoint, OneDoFTrajectoryPointInterface<?> secondTrajectoryPoint) { double deltaPosition = Math.abs(secondTrajectoryPoint.getPosition() - firstTrajectoryPoint.getPosition()); double deltaTime = Math.abs(secondTrajectoryPoint.getTime() - firstTrajectoryPoint.getTime()); return MathTools.epsilonEquals(0.0, deltaPosition / deltaTime, 1.0e-7); }
@Override public boolean geometricallyEquals(Y other, double epsilon) { if (!MathTools.epsilonEquals(getTime(), other.getTime(), epsilon)) return false; return super.geometricallyEquals(other, epsilon); } }
@Override public final boolean epsilonEquals(Y other, double epsilon) { if (!MathTools.epsilonEquals(getTime(), other.getTime(), epsilon)) return false; return super.epsilonEquals(other, epsilon); }
@Override public boolean epsilonEquals(YoOneDoFTrajectoryPoint other, double epsilon) { if (!MathTools.epsilonEquals(getTime(), other.getTime(), epsilon)) return false; if (!waypoint1d.epsilonEquals(other.waypoint1d, epsilon)) return false; return true; }
@Override public boolean geometricallyEquals(YoOneDoFTrajectoryPoint other, double epsilon) { if (!MathTools.epsilonEquals(getTime(), other.getTime(), epsilon)) return false; if (!waypoint1d.geometricallyEquals(other.waypoint1d, epsilon)) return false; return true; }
private static void assertInequalityEquals(String prefix, ICPInequalityInput inequalityToTest, DenseMatrix64F variables) { DenseMatrix64F constraintValue = new DenseMatrix64F(inequalityToTest.getNumberOfConstraints(), 1); CommonOps.mult(inequalityToTest.Aineq, variables, constraintValue); boolean hasValueAtBound = false; for (int i = 0; i < constraintValue.numRows; i++) { if (MathTools.epsilonEquals(constraintValue.get(i), inequalityToTest.bineq.get(i), epsilon)) hasValueAtBound = true; } assertTrue(prefix, hasValueAtBound); }
private double computeStepLengthForEqualityConstraint(DenseMatrix64F solutionToPack, int equalityConstraintIndex) { // compute full step length: i.e., the minimum step in primal space s.t. the constraint becomes feasible double fullStepLength = 0.0; if (!MathTools.epsilonEquals(CommonOps.dot(stepDirectionInPrimalSpace, stepDirectionInPrimalSpace), 0.0, epsilon)) // i.e. z != 0 { fullStepLength = (-CommonOps.dot(violatedConstraintNormal, solutionToPack) - linearEqualityConstraintsBVector.get(equalityConstraintIndex)) / CommonOps .dot(stepDirectionInPrimalSpace, violatedConstraintNormal); } return fullStepLength; }
/** * Creates a calculator for the camera rotation. * @param up indicates which way is up. * @param forward indicates which is forward. * @throws RuntimeException if {@code up} and {@code forward} are not orthogonal. */ public CameraRotationCalculator(Vector3D up, Vector3D forward) { Vector3D left = new Vector3D(); left.cross(up, forward); if (!MathTools.epsilonEquals(left.length(), 1.0, Epsilons.ONE_HUNDRED_THOUSANDTH)) throw new RuntimeException("The vectors up and forward must be orthogonal. Received: up = " + up + ", forward = " + forward); this.up.set(up); this.forward.set(forward); down.setAndNegate(up); computeOffset(); }
@Override public boolean compare(SimulationConstructionSet scs1, SimulationConstructionSet scs2) { // compare variables YoVariable<?> var0 = getRootJoint(scs1).getQx(); YoVariable<?> var1 = getRootJoint(scs2).getQx(); return (MathTools.epsilonEquals(var0.getValueAsDouble(), var1.getValueAsDouble(), epsilon)); }