Skip to content

Commit

Permalink
see #16472 - Fix coverity FB.FE_FLOATING_POINT_EQUALITY and FB.UG_SYN…
Browse files Browse the repository at this point in the history
…C_SET_UNSYNC_GET (patch by taylor.smock)

git-svn-id: https://josm.openstreetmap.de/svn/trunk@18255 0c6e7542-c601-0410-84e7-c038aed88b3b
  • Loading branch information
don-vip committed Oct 6, 2021
1 parent 294ba51 commit c659390
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public void setRotation(Vector3D vec) {
setRotation(vec.getPolarAngle(), vec.getAzimuthalAngle());
}

public Vector3D getRotation() {
public synchronized Vector3D getRotation() {
return this.rotation;
}

Expand Down
4 changes: 3 additions & 1 deletion src/org/openstreetmap/josm/gui/util/imagery/Vector3D.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.gui.util.imagery;

import org.openstreetmap.josm.tools.Utils;

/**
* A basic 3D vector class (immutable)
* @author Taylor Smock (documentation, spherical conversions)
Expand Down Expand Up @@ -236,7 +238,7 @@ public int hashCode() {
public boolean equals(Object o) {
if (o instanceof Vector3D) {
Vector3D other = (Vector3D) o;
return this.x == other.x && this.y == other.y && this.z == other.z;
return Utils.equalsEpsilon(this.x, other.x) && Utils.equalsEpsilon(this.y, other.y) && Utils.equalsEpsilon(this.z, other.z);
}
return false;
}
Expand Down

0 comments on commit c659390

Please sign in to comment.