Skip to content

Commit

Permalink
fix topo Z
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-f committed Oct 18, 2024
1 parent f3b20e5 commit 64ac142
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,7 @@ private static void assertDoubleArrayEquals(String valueName, double[] expected,
assertEquals(valueName + ": Different array length;", expected.length, actual.length);
for(int i=0; i< expected.length; i++) {
if(!Double.isNaN(expected[i])){
double deltaOff = 1;
/*if(expected[i]!=0) {
while (Math.abs(expected[i]/deltaOff) < 1) {
deltaOff /= 10;
}
}*/
assertEquals(valueName + ": Arrays first differed at element ["+i+"];", expected[i], actual[i], delta*deltaOff);
assertEquals(valueName + ": Arrays first differed at element ["+i+"];", expected[i], actual[i], delta);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,13 @@ public void addWallCutPt(Coordinate coord, int id, boolean corner, List<Double>
* Add a topographic cutting point.
* @param coord Coordinate of the cutting point.
* @param id Id of the cut topography.
* @return Added cut point instance
*/
public void addTopoCutPt(Coordinate coord, int id) {
pts.add(new CutPoint(coord, TOPOGRAPHY, id));
public CutPoint addTopoCutPt(Coordinate coord, int id) {
CutPoint topoCutPoint = new CutPoint(coord, TOPOGRAPHY, id);
topoCutPoint.setZGround(coord.z);
pts.add(topoCutPoint);
return topoCutPoint;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,8 @@ public int getTriangleIdByCoordinate(Coordinate pt) {
public void addTopoCutPts(Coordinate p1, Coordinate p2, CutProfile profile, boolean stopAtObstacleOverSourceReceiver) {
List<Coordinate> coordinates = new ArrayList<>();
boolean freeField = fetchTopographicProfile(coordinates, p1, p2, stopAtObstacleOverSourceReceiver);
profile.getSource().zGround = coordinates.get(0).z;
profile.getReceiver().zGround = coordinates.get(coordinates.size() - 1).z;
profile.hasTopographyIntersection = !freeField;
// Remove unnecessary points
ArrayList<Coordinate> retainedCoordinates = new ArrayList<>(coordinates.size());
Expand Down

0 comments on commit 64ac142

Please sign in to comment.