diff --git a/noisemodelling-jdbc/src/test/java/org/noise_planet/noisemodelling/jdbc/AttenuationCnossosTest.java b/noisemodelling-jdbc/src/test/java/org/noise_planet/noisemodelling/jdbc/AttenuationCnossosTest.java index 3b2336283..ba02f0d6e 100644 --- a/noisemodelling-jdbc/src/test/java/org/noise_planet/noisemodelling/jdbc/AttenuationCnossosTest.java +++ b/noisemodelling-jdbc/src/test/java/org/noise_planet/noisemodelling/jdbc/AttenuationCnossosTest.java @@ -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); } } } diff --git a/noisemodelling-pathfinder/src/main/java/org/noise_planet/noisemodelling/pathfinder/profilebuilder/CutProfile.java b/noisemodelling-pathfinder/src/main/java/org/noise_planet/noisemodelling/pathfinder/profilebuilder/CutProfile.java index 8dabf59e8..df8889419 100644 --- a/noisemodelling-pathfinder/src/main/java/org/noise_planet/noisemodelling/pathfinder/profilebuilder/CutProfile.java +++ b/noisemodelling-pathfinder/src/main/java/org/noise_planet/noisemodelling/pathfinder/profilebuilder/CutProfile.java @@ -96,9 +96,13 @@ public void addWallCutPt(Coordinate coord, int id, boolean corner, List * 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; } /** diff --git a/noisemodelling-pathfinder/src/main/java/org/noise_planet/noisemodelling/pathfinder/profilebuilder/ProfileBuilder.java b/noisemodelling-pathfinder/src/main/java/org/noise_planet/noisemodelling/pathfinder/profilebuilder/ProfileBuilder.java index 6f1addcb2..20dfb6d91 100644 --- a/noisemodelling-pathfinder/src/main/java/org/noise_planet/noisemodelling/pathfinder/profilebuilder/ProfileBuilder.java +++ b/noisemodelling-pathfinder/src/main/java/org/noise_planet/noisemodelling/pathfinder/profilebuilder/ProfileBuilder.java @@ -1295,6 +1295,8 @@ public int getTriangleIdByCoordinate(Coordinate pt) { public void addTopoCutPts(Coordinate p1, Coordinate p2, CutProfile profile, boolean stopAtObstacleOverSourceReceiver) { List 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 retainedCoordinates = new ArrayList<>(coordinates.size());