diff --git a/noisemodelling-pathfinder/src/main/java/org/noise_planet/noisemodelling/pathfinder/PathFinder.java b/noisemodelling-pathfinder/src/main/java/org/noise_planet/noisemodelling/pathfinder/PathFinder.java index 82c6b71fc..1c3fc580f 100644 --- a/noisemodelling-pathfinder/src/main/java/org/noise_planet/noisemodelling/pathfinder/PathFinder.java +++ b/noisemodelling-pathfinder/src/main/java/org/noise_planet/noisemodelling/pathfinder/PathFinder.java @@ -1501,43 +1501,27 @@ public List computeReflexion(Coordinate rcvCoord, Coordinate srcCoo } points.addAll(lastPts.subList(1, lastPts.size())); double baseX = 0; - for(int i=0; i geom.getCoordinate().z - || points.get(i).coordinate.z <= data.profileBuilder.getZGround(points.get(i).coordinate)) { - points.clear(); - segments.clear(); - break; - } - } else { - LOGGER.warn("Invalid state, reflexion point on last point"); - points.clear(); - segments.clear(); - break; - } + // A diffraction point may have offset in height the reflection coordinate + final Coordinate p0 = points.get(i - 1).coordinate; + final Coordinate p1 = points.get(i).coordinate; + final Coordinate p2 = points.get(i + 1).coordinate; + // compute Y value (altitude) by interpolating the Y values of the two neighboring points + points.get(i).coordinate = new CoordinateXY(p1.x, (p1.x-p0.x)/(p2.x-p0.x)*(p2.y-p0.y)+p0.y); + //TODO check if ray is intersecting over the wall now } } - if (rayPath.size() > 0) { + if (!rayPath.isEmpty()) { List pts = new ArrayList<>(); pts.add(srcCoord); rayPath.forEach(mrr -> pts.add(mrr.getReceiverPos()));