From 120366a9d9e18d1c40c36afdf766a0223bc318b4 Mon Sep 17 00:00:00 2001 From: nicolas-f <1382241+nicolas-f@users.noreply.github.com> Date: Tue, 30 Jul 2024 15:15:00 +0200 Subject: [PATCH] work in progress, interpolate Y instead of Z on diffraction of rays --- .../noisemodelling/pathfinder/PathFinder.java | 44 ++++++------------- 1 file changed, 14 insertions(+), 30 deletions(-) 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()));