Skip to content

Commit

Permalink
Altered tolerance value used to determine perpendicularity between ve…
Browse files Browse the repository at this point in the history
…ctors to better match expected precision with doubles.
  • Loading branch information
shawnhatch committed Nov 20, 2024
1 parent ee8c255 commit ae6fa03
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ public void zero() {
y = 0;
}

public final static double PERPENDICULAR_ANGLE_TOLERANCE = 1E-13;
public final static double PERPENDICULAR_ANGLE_TOLERANCE = 1E-8;

/**
* Returns true if and only if this {@link MutableVector2D} is perpendicular to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ public void zero() {
assign(0, 0, 0);
}

public final static double PERPENDICULAR_ANGLE_TOLERANCE = 1E-13;
public final static double PERPENDICULAR_ANGLE_TOLERANCE = 1E-8;

/**
* Returns true if and only if this {@link MutableVector3D} is perpendicular to
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gov/hhs/aspr/ms/util/vector/Vector2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public String toString() {
return "Vector2D [x=" + x + ", y=" + y + "]";
}

public final static double PERPENDICULAR_ANGLE_TOLERANCE = 1E-13;
public final static double PERPENDICULAR_ANGLE_TOLERANCE = 1E-8;

/**
* Returns true if and only if this {@link Vector2D} is perpendicular to the
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gov/hhs/aspr/ms/util/vector/Vector3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public final class Vector3D {

public final static double NORMAL_LENGTH_TOLERANCE = 1E-13;

public final static double PERPENDICULAR_ANGLE_TOLERANCE = 1E-13;
public final static double PERPENDICULAR_ANGLE_TOLERANCE = 1E-8;

/*
* A function that returns the value if the value is in the interval [-1,1].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void testNormalLengthTolerance() {
@Test
@UnitTestField(target = MutableVector2D.class, name = "PERPENDICULAR_ANGLE_TOLERANCE")
public void testPerpendicularAngleTolerance() {
assertEquals(1E-13, MutableVector2D.PERPENDICULAR_ANGLE_TOLERANCE, 0);
assertEquals(1E-8, MutableVector2D.PERPENDICULAR_ANGLE_TOLERANCE, 0);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void testNormalLengthTolerance() {
@Test
@UnitTestField(target = MutableVector3D.class, name = "PERPENDICULAR_ANGLE_TOLERANCE")
public void testPerpendicularAngleTolerance() {
assertEquals(1E-13, MutableVector2D.PERPENDICULAR_ANGLE_TOLERANCE, 0);
assertEquals(1E-8, MutableVector2D.PERPENDICULAR_ANGLE_TOLERANCE, 0);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/gov/hhs/aspr/ms/util/vector/AT_Vector2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void testNormalLengthTolerance() {
@Test
@UnitTestField(target = Vector2D.class, name = "PERPENDICULAR_ANGLE_TOLERANCE")
public void testPerpendicularAngleTolerance() {
assertEquals(1E-13, MutableVector2D.PERPENDICULAR_ANGLE_TOLERANCE, 0);
assertEquals(1E-8, MutableVector2D.PERPENDICULAR_ANGLE_TOLERANCE, 0);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/gov/hhs/aspr/ms/util/vector/AT_Vector3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void testNormalLengthTolerance() {
@Test
@UnitTestField(target = Vector3D.class, name = "PERPENDICULAR_ANGLE_TOLERANCE")
public void testPerpendicularAngleTolerance() {
assertEquals(1E-13, MutableVector2D.PERPENDICULAR_ANGLE_TOLERANCE, 0);
assertEquals(1E-8, MutableVector2D.PERPENDICULAR_ANGLE_TOLERANCE, 0);
}

/**
Expand Down

0 comments on commit ae6fa03

Please sign in to comment.