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 5869bd9cf..85ba97155 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 @@ -1206,7 +1206,6 @@ public List computeReflexion(Coordinate rcvCoord, Coordinate srcCoo for (MirrorReceiver receiverReflection : mirrorResults) { Wall seg = receiverReflection.getWall(); List rayPath = new ArrayList<>(); - boolean validReflection = false; MirrorReceiver receiverReflectionCursor = receiverReflection; // Test whether intersection point is on the wall // segment or not @@ -1240,175 +1239,200 @@ public List computeReflexion(Coordinate rcvCoord, Coordinate srcCoo // Compute Z interpolation reflectionPt.setOrdinate(Coordinate.Z, Vertex.interpolateZ(linters.getIntersection(0), receiverReflectionCursor.getReceiverPos(), destinationPt)); - - // Test if there is no obstacles between the - // reflection point and old reflection pt (or source position) - validReflection = isNaN(receiverReflectionCursor.getReceiverPos().z) || - isNaN(reflectionPt.z) || isNaN(destinationPt.z) /*|| seg.getOriginId() == 0*/ - || ( - (seg.getType().equals(BUILDING) && reflectionPt.z < data.profileBuilder.getBuilding(seg.getOriginId()).getGeometry().getCoordinate().z || - seg.getType().equals(WALL) && reflectionPt.z < data.profileBuilder.getWall(seg.getOriginId()).getLine().getCoordinate().z) - && reflectionPt.z > data.profileBuilder.getZGround(reflectionPt) - && destinationPt.z > data.profileBuilder.getZGround(destinationPt)); - if (validReflection) // Source point can see receiver image - { - MirrorReceiver reflResult = new MirrorReceiver(receiverReflectionCursor); - reflResult.setReflectionPosition(reflectionPt); - rayPath.add(reflResult); - if (receiverReflectionCursor - .getParentMirror() == null) { // Direct to the receiver - break; // That was the last reflection - } else { - // There is another reflection - destinationPt.setCoordinate(reflectionPt); - // Move reflection information cursor to a - // reflection closer - receiverReflectionCursor = receiverReflectionCursor.getParentMirror(); - // Update intersection data - seg = receiverReflectionCursor.getWall(); - linters.computeIntersection(seg.p0, seg.p1, - receiverReflectionCursor - .getReceiverPos(), - destinationPt - ); - validReflection = false; - } + MirrorReceiver reflResult = new MirrorReceiver(receiverReflectionCursor); + reflResult.setReflectionPosition(reflectionPt); + rayPath.add(reflResult); + if (receiverReflectionCursor + .getParentMirror() == null) { // Direct to the receiver + break; // That was the last reflection } else { - break; + // There is another reflection + destinationPt.setCoordinate(reflectionPt); + // Move reflection information cursor to a + // reflection closer + receiverReflectionCursor = receiverReflectionCursor.getParentMirror(); + // Update intersection data + seg = receiverReflectionCursor.getWall(); + linters.computeIntersection(seg.p0, seg.p1, + receiverReflectionCursor + .getReceiverPos(), + destinationPt + ); } } - if (validReflection) { - // A valid propagation path as been found (without looking at occlusion) - List points = new ArrayList<>(); - List segments = new ArrayList<>(); - List reflIdx = new ArrayList<>(); - CnossosPath pathParameters = new CnossosPath(); - pathParameters.setFavorable(favorable); - pathParameters.setPointList(points); - pathParameters.setSegmentList(segments); - pathParameters.angle = Angle.angle(rcvCoord, srcCoord); - pathParameters.refPoints = reflIdx; - CutProfile mainProfile = new CutProfile(); - // Compute direct path between source and first reflection point, add profile to the data - computeReflexionOverBuildings(srcCoord, rayPath.get(0).getReflectionPosition(), points, segments, data, - orientation, pathParameters.difHPoints, pathParameters.difVPoints, mainProfile); - if (points.isEmpty()) { - // (maybe there is a blocking building, and we disabled diffraction) - continue; - } - mainProfile.setSource(mainProfile.getCutPoints().get(0)); - CutPoint reflectionCutPoint = mainProfile.getCutPoints().get(mainProfile.getCutPoints().size() - 1); - pushReflectionCutPointSequence(mainProfile, reflectionCutPoint, rayPath.get(0)); - PointPath reflPoint = points.get(points.size() - 1); - reflIdx.add(points.size() - 1); - updateReflectionPathAttributes(reflPoint, rayPath.get(0), - mainProfile.getCutPoints().get(mainProfile.getCutPoints().size() - 1)); - // Add intermediate reflections - for (int idPt = 0; idPt < rayPath.size() - 1; idPt++) { - MirrorReceiver firstPoint = rayPath.get(idPt); - MirrorReceiver secondPoint = rayPath.get(idPt + 1); - int previousPointSize = points.size(); - int previousCutPointsSize = mainProfile.getCutPoints().size(); - computeReflexionOverBuildings(firstPoint.getReflectionPosition(), secondPoint.getReflectionPosition(), - points, segments, data, orientation, pathParameters.difHPoints, pathParameters.difVPoints, - mainProfile); - if (points.size() == previousPointSize) { // no visibility between the two reflection coordinates - // (maybe there is a blocking building, and we disabled diffraction) - continue; - } - mainProfile.getCutPoints().remove(previousCutPointsSize); - points.remove(previousPointSize); // remove duplicate point - reflIdx.add(points.size() - 1); - // computeReflexionOverBuildings is making X relative to the "receiver" coordinate - // so we have to add the X value of the last path - for (PointPath p : points.subList(previousPointSize, points.size())) { - p.coordinate.x += points.get(previousPointSize - 1).coordinate.x; - } - PointPath lastReflexionPoint = points.get(points.size() - 1); - updateReflectionPathAttributes(lastReflexionPoint, secondPoint, mainProfile.getCutPoints().get(mainProfile.getCutPoints().size() - 1)); + // A valid propagation path as been found (without looking at occlusion) + List points = new ArrayList<>(); + List segments = new ArrayList<>(); + List reflIdx = new ArrayList<>(); + CnossosPath pathParameters = new CnossosPath(); + pathParameters.setFavorable(favorable); + pathParameters.setPointList(points); + pathParameters.setSegmentList(segments); + pathParameters.angle = Angle.angle(rayPath.get(0).getReflectionPosition(), srcCoord); + pathParameters.refPoints = reflIdx; + CutProfile mainProfile = new CutProfile(); + // Compute direct path between source and first reflection point, add profile to the data + CutProfile cutProfile = data.profileBuilder.getProfile(srcCoord, rayPath.get(0).getReflectionPosition(), + data.gS, !data.computeVerticalDiffraction); + if(!cutProfile.isFreeField() && !data.computeVerticalDiffraction) { + // (maybe there is a blocking building/dem, and we disabled diffraction) + continue; + } + // Add points to the main profile, remove the last point, or it will be duplicated later + mainProfile.addCutPoints(cutProfile.getCutPoints().subList(0, cutProfile.getCutPoints().size() - 1)); + /** + computeReflexionOverBuildings(srcCoord, rayPath.get(0).getReflectionPosition(), points, segments, data, + orientation, pathParameters.difHPoints, pathParameters.difVPoints, mainProfile); + if (points.isEmpty()) { + // (maybe there is a blocking building, and we disabled diffraction) + continue; + } + mainProfile.setSource(mainProfile.getCutPoints().get(0)); + CutPoint reflectionCutPoint = mainProfile.getCutPoints().get(mainProfile.getCutPoints().size() - 1); + pushReflectionCutPointSequence(mainProfile, reflectionCutPoint, rayPath.get(0)); + PointPath reflPoint = points.get(points.size() - 1); + reflIdx.add(points.size() - 1); + updateReflectionPathAttributes(reflPoint, rayPath.get(0), + mainProfile.getCutPoints().get(mainProfile.getCutPoints().size() - 1)); + **/ + // Add intermediate reflections + boolean validReflection = true; + for (int idPt = 0; idPt < rayPath.size() - 1; idPt++) { + MirrorReceiver firstPoint = rayPath.get(idPt); + MirrorReceiver secondPoint = rayPath.get(idPt + 1); + cutProfile = data.profileBuilder.getProfile(firstPoint.getReflectionPosition(), + secondPoint.getReflectionPosition(), data.gS, true); + cutProfile.getCutPoints().get(0).setType(REFLECTION); + cutProfile.getCutPoints().get(0).setMirrorReceiver(firstPoint); + if(!cutProfile.isFreeField() && !data.computeVerticalDiffraction) { + // (maybe there is a blocking building/dem, and we disabled diffraction) + validReflection = false; + break; } - // Compute direct path between receiver and last reflection point, add profile to the data + // Add points to the main profile, remove the last point, or it will be duplicated later + mainProfile.addCutPoints(cutProfile.getCutPoints().subList(0, cutProfile.getCutPoints().size() - 1)); + /* int previousPointSize = points.size(); int previousCutPointsSize = mainProfile.getCutPoints().size(); - computeReflexionOverBuildings(rayPath.get(rayPath.size() - 1).getReflectionPosition(), rcvCoord, points, - segments, data, orientation, pathParameters.difHPoints, pathParameters.difVPoints, mainProfile); - if (points.size() == previousPointSize) { // no visibility between the last reflection coordinate and the receiver + computeReflexionOverBuildings(firstPoint.getReflectionPosition(), secondPoint.getReflectionPosition(), + points, segments, data, orientation, pathParameters.difHPoints, pathParameters.difVPoints, + mainProfile); + if (points.size() == previousPointSize) { // no visibility between the two reflection coordinates // (maybe there is a blocking building, and we disabled diffraction) continue; } - // remove last duplicate reflexion coordinate mainProfile.getCutPoints().remove(previousCutPointsSize); - mainProfile.setReceiver(mainProfile.getCutPoints().get(mainProfile.getCutPoints().size() - 1)); - points.remove(previousPointSize); // remove duplicate point (last reflexion coordinate) + points.remove(previousPointSize); // remove duplicate point + reflIdx.add(points.size() - 1); // computeReflexionOverBuildings is making X relative to the "receiver" coordinate // so we have to add the X value of the last path for (PointPath p : points.subList(previousPointSize, points.size())) { p.coordinate.x += points.get(previousPointSize - 1).coordinate.x; } - for (int i = 1; i < points.size(); i++) { - final PointPath currentPoint = points.get(i); - if (currentPoint.type == REFL) { - if (i < points.size() - 1) { - // A diffraction point may have offset in height the reflection coordinate - final Coordinate p0 = points.get(i - 1).coordinate; - final Coordinate p1 = currentPoint.coordinate; - final Coordinate p2 = points.get(i + 1).coordinate; - // compute Y value (altitude) by interpolating the Y values of the two neighboring points - currentPoint.coordinate = new CoordinateXY(p1.x, (p1.x - p0.x) / (p2.x - p0.x) * (p2.y - p0.y) + p0.y); - //check if new reflection point altitude is higher than the wall - if (currentPoint.coordinate.y > currentPoint.obstacleZ - epsilon) { - // can't reflect higher than the wall - points.clear(); - segments.clear(); - rayPath.clear(); - break; - } - } else { - LOGGER.warn("Invalid state, reflexion point on last point"); - points.clear(); - segments.clear(); + PointPath lastReflexionPoint = points.get(points.size() - 1); + updateReflectionPathAttributes(lastReflexionPoint, secondPoint, mainProfile.getCutPoints().get(mainProfile.getCutPoints().size() - 1)); + **/ + } + if(!validReflection) { + continue; + } + // Compute direct path between receiver and last reflection point, add profile to the data + cutProfile = data.profileBuilder.getProfile(rayPath.get(rayPath.size() - 1).getReflectionPosition(), + rcvCoord, data.gS, true); + if(!cutProfile.isFreeField() && !data.computeVerticalDiffraction) { + // (maybe there is a blocking building/dem, and we disabled diffraction) + continue; + } + cutProfile.getCutPoints().get(0).setType(REFLECTION); + cutProfile.getCutPoints().get(0).setMirrorReceiver(rayPath.get(rayPath.size() - 1)); + // Add points to the main profile, remove the last point, or it will be duplicated later + mainProfile.addCutPoints(cutProfile.getCutPoints()); + mainProfile.setSource(mainProfile.getCutPoints().get(0)); + mainProfile.setReceiver(mainProfile.getCutPoints().get(mainProfile.getCutPoints().size() - 1)); + + // Compute Ray path from vertical cut + CnossosPath cnossosPath = computeHEdgeDiffraction(mainProfile, data.isBodyBarrier()); + /* + int previousPointSize = points.size(); + int previousCutPointsSize = mainProfile.getCutPoints().size(); + computeReflexionOverBuildings(rayPath.get(rayPath.size() - 1).getReflectionPosition(), rcvCoord, points, + segments, data, orientation, pathParameters.difHPoints, pathParameters.difVPoints, mainProfile); + if (points.size() == previousPointSize) { // no visibility between the last reflection coordinate and the receiver + // (maybe there is a blocking building, and we disabled diffraction) + continue; + } + // remove last duplicate reflexion coordinate + mainProfile.getCutPoints().remove(previousCutPointsSize); + mainProfile.setReceiver(mainProfile.getCutPoints().get(mainProfile.getCutPoints().size() - 1)); + points.remove(previousPointSize); // remove duplicate point (last reflexion coordinate) + // computeReflexionOverBuildings is making X relative to the "receiver" coordinate + // so we have to add the X value of the last path + for (PointPath p : points.subList(previousPointSize, points.size())) { + p.coordinate.x += points.get(previousPointSize - 1).coordinate.x; + } + + */ + for (int i = 1; i < points.size(); i++) { + final PointPath currentPoint = points.get(i); + if (currentPoint.type == REFL) { + if (i < points.size() - 1) { + // A diffraction point may have offset in height the reflection coordinate + final Coordinate p0 = points.get(i - 1).coordinate; + final Coordinate p1 = currentPoint.coordinate; + final Coordinate p2 = points.get(i + 1).coordinate; + // compute Y value (altitude) by interpolating the Y values of the two neighboring points + currentPoint.coordinate = new CoordinateXY(p1.x, (p1.x - p0.x) / (p2.x - p0.x) * (p2.y - p0.y) + p0.y); + //check if new reflection point altitude is higher than the wall + if (currentPoint.coordinate.y > currentPoint.obstacleZ - epsilon) { + // can't reflect higher than the wall + validReflection = false; break; } + } else { + LOGGER.warn("Invalid state, reflexion point on last point"); + validReflection = false; + break; } } - - double gPath = mainProfile.getGPath(); - pathParameters.setCutProfile(mainProfile); - List groundPts = mainProfile.computePts2DGround(); - double[] meanPlan = JTSUtility.getMeanPlaneCoefficients(groundPts.toArray(new Coordinate[0])); - SegmentPath srSegment = computeSegment(groundPts.get(0), srcCoord.z, groundPts.get(groundPts.size() - 1), rcvCoord.z, - meanPlan, gPath, data.gS); - pathParameters.setSRSegment(srSegment); - if (!pathParameters.difHPoints.isEmpty()) { - // Use source to first diffraction as segment 1 (SO¹) - // then last diffraction to receiver (OⁿR) - List reflectionSegments = new ArrayList<>(); - CutProfile soProfile = new CutProfile(); - soProfile.setCutPoints(mainProfile.getCutPoints().subList(0, pathParameters.difHPoints.get(0)+1)); - soProfile.setSource(soProfile.getCutPoints().get(0)); - soProfile.setReceiver(soProfile.getCutPoints().get(soProfile.getCutPoints().size() - 1)); - groundPts = soProfile.computePts2DGround(); - meanPlan = JTSUtility.getMeanPlaneCoefficients(groundPts.toArray(new Coordinate[0])); - SegmentPath soSegment = computeSegment(groundPts.get(0), srcCoord.z, - groundPts.get(groundPts.size() - 1), soProfile.getReceiver().getCoordinate().z, - meanPlan, soProfile.getGPath(), data.gS); - reflectionSegments.add(soSegment); - // compute OR profile - CutProfile orProfile = new CutProfile(); - int indexLastDiffraction = pathParameters.difHPoints.get(pathParameters.difHPoints.size() - 1); - orProfile.setCutPoints(mainProfile.getCutPoints().subList(indexLastDiffraction, - mainProfile.getCutPoints().size())); - orProfile.setSource(orProfile.getCutPoints().get(0)); - orProfile.setReceiver(orProfile.getCutPoints().get(orProfile.getCutPoints().size() - 1)); - groundPts = orProfile.computePts2DGround(); - meanPlan = JTSUtility.getMeanPlaneCoefficients(groundPts.toArray(new Coordinate[0])); - SegmentPath orSegment = computeSegment(groundPts.get(0), orProfile.getSource().getCoordinate().z, - groundPts.get(groundPts.size() - 1), orProfile.getReceiver().getCoordinate().z, - meanPlan, orProfile.getGPath(), orProfile.getSource().getGroundCoef()); - reflectionSegments.add(orSegment); - pathParameters.setSegmentList(reflectionSegments); - } - reflexionPathParameters.add(pathParameters); + } + if(!validReflection) { + continue; + } + double gPath = mainProfile.getGPath(); + pathParameters.setCutProfile(mainProfile); + List groundPts = mainProfile.computePts2DGround(); + double[] meanPlan = JTSUtility.getMeanPlaneCoefficients(groundPts.toArray(new Coordinate[0])); + SegmentPath srSegment = computeSegment(groundPts.get(0), srcCoord.z, groundPts.get(groundPts.size() - 1), rcvCoord.z, + meanPlan, gPath, data.gS); + pathParameters.setSRSegment(srSegment); + if (!pathParameters.difHPoints.isEmpty()) { + // Use source to first diffraction as segment 1 (SO¹) + // then last diffraction to receiver (OⁿR) + List reflectionSegments = new ArrayList<>(); + CutProfile soProfile = new CutProfile(); + soProfile.setCutPoints(mainProfile.getCutPoints().subList(0, pathParameters.difHPoints.get(0)+1)); + soProfile.setSource(soProfile.getCutPoints().get(0)); + soProfile.setReceiver(soProfile.getCutPoints().get(soProfile.getCutPoints().size() - 1)); + groundPts = soProfile.computePts2DGround(); + meanPlan = JTSUtility.getMeanPlaneCoefficients(groundPts.toArray(new Coordinate[0])); + SegmentPath soSegment = computeSegment(groundPts.get(0), srcCoord.z, + groundPts.get(groundPts.size() - 1), soProfile.getReceiver().getCoordinate().z, + meanPlan, soProfile.getGPath(), data.gS); + reflectionSegments.add(soSegment); + // compute OR profile + CutProfile orProfile = new CutProfile(); + int indexLastDiffraction = pathParameters.difHPoints.get(pathParameters.difHPoints.size() - 1); + orProfile.setCutPoints(mainProfile.getCutPoints().subList(indexLastDiffraction, + mainProfile.getCutPoints().size())); + orProfile.setSource(orProfile.getCutPoints().get(0)); + orProfile.setReceiver(orProfile.getCutPoints().get(orProfile.getCutPoints().size() - 1)); + groundPts = orProfile.computePts2DGround(); + meanPlan = JTSUtility.getMeanPlaneCoefficients(groundPts.toArray(new Coordinate[0])); + SegmentPath orSegment = computeSegment(groundPts.get(0), orProfile.getSource().getCoordinate().z, + groundPts.get(groundPts.size() - 1), orProfile.getReceiver().getCoordinate().z, + meanPlan, orProfile.getGPath(), orProfile.getSource().getGroundCoef()); + reflectionSegments.add(orSegment); + pathParameters.setSegmentList(reflectionSegments); } } return reflexionPathParameters; diff --git a/noisemodelling-pathfinder/src/main/java/org/noise_planet/noisemodelling/pathfinder/profilebuilder/CutPoint.java b/noisemodelling-pathfinder/src/main/java/org/noise_planet/noisemodelling/pathfinder/profilebuilder/CutPoint.java index dab03b836..f370a9742 100644 --- a/noisemodelling-pathfinder/src/main/java/org/noise_planet/noisemodelling/pathfinder/profilebuilder/CutPoint.java +++ b/noisemodelling-pathfinder/src/main/java/org/noise_planet/noisemodelling/pathfinder/profilebuilder/CutPoint.java @@ -10,6 +10,7 @@ package org.noise_planet.noisemodelling.pathfinder.profilebuilder; import org.locationtech.jts.geom.Coordinate; +import org.noise_planet.noisemodelling.pathfinder.path.MirrorReceiver; import java.util.ArrayList; import java.util.Collections; @@ -33,7 +34,9 @@ public class CutPoint implements Comparable { double groundCoef = Double.NaN; /** Wall alpha. NaN if there is no coefficient. */ List wallAlpha = Collections.emptyList(); - boolean corner = false; //todo with horizontal plane diffraction rework: remove, replace with intersection type-> DIFFRACTION_POINT + + /** On reflection intersection type this object contain the associated reflection data */ + private MirrorReceiver mirrorReceiver; /** * Constructor using a {@link Coordinate}. @@ -41,14 +44,10 @@ public class CutPoint implements Comparable { * @param type Intersection type. * @param id Identifier of the cut element. */ - public CutPoint(Coordinate coord, ProfileBuilder.IntersectionType type, int id, boolean corner) { + public CutPoint(Coordinate coord, ProfileBuilder.IntersectionType type, int id) { this.coordinate = new Coordinate(coord); this.type = type; this.id = id; - this.corner = corner; - } - public CutPoint(Coordinate coord, ProfileBuilder.IntersectionType type, int id) { - this(coord, type, id, false); } public CutPoint() { @@ -67,7 +66,20 @@ public CutPoint(CutPoint cut) { this.groundCoef = cut.groundCoef; this.wallAlpha = new ArrayList<>(cut.wallAlpha); this.zGround = cut.zGround; - this.corner = cut.corner; + } + + /** + * @return On reflection intersection type this object contain the associated reflection data + */ + public MirrorReceiver getMirrorReceiver() { + return mirrorReceiver; + } + + /** + * @param mirrorReceiver On reflection intersection type this object contain the associated reflection data + */ + public void setMirrorReceiver(MirrorReceiver mirrorReceiver) { + this.mirrorReceiver = mirrorReceiver; } public void setType(ProfileBuilder.IntersectionType type) { @@ -195,7 +207,6 @@ public String toString() { ", zGround=" + zGround + ", groundCoef=" + groundCoef + ", wallAlpha=" + wallAlpha + - ", corner=" + corner + '}'; } @@ -209,7 +220,4 @@ public int compareTo(CutPoint cutPoint) { return this.coordinate.compareTo(cutPoint.coordinate); } - public boolean isCorner(){ - return corner; - } } \ No newline at end of file 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 67a50a586..1a8f6f440 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 @@ -70,8 +70,8 @@ public void setSource(CutPoint source) { * @param coord Coordinate of the cutting point. * @param buildingId Id of the cut building. */ - public CutPoint addBuildingCutPt(Coordinate coord, int buildingId, int wallId, boolean corner) { - CutPoint cut = new CutPoint(coord, ProfileBuilder.IntersectionType.BUILDING, buildingId, corner); + public CutPoint addBuildingCutPt(Coordinate coord, int buildingId, int wallId) { + CutPoint cut = new CutPoint(coord, ProfileBuilder.IntersectionType.BUILDING, buildingId); cut.buildingId = buildingId; cut.wallId = wallId; pts.add(cut); @@ -83,8 +83,8 @@ public CutPoint addBuildingCutPt(Coordinate coord, int buildingId, int wallId, b * @param coord Coordinate of the cutting point. * @param id Id of the cut building. */ - public CutPoint addWallCutPt(Coordinate coord, int id, boolean corner) { - CutPoint wallPoint = new CutPoint(coord, ProfileBuilder.IntersectionType.WALL, id, corner); + public CutPoint addWallCutPt(Coordinate coord, int id) { + CutPoint wallPoint = new CutPoint(coord, ProfileBuilder.IntersectionType.WALL, id); wallPoint.wallId = id; pts.add(wallPoint); return wallPoint; @@ -95,8 +95,8 @@ public CutPoint addWallCutPt(Coordinate coord, int id, boolean corner) { * @param coord Coordinate of the cutting point. * @param id Id of the cut building. */ - public void addWallCutPt(Coordinate coord, int id, boolean corner, List alphas) { - pts.add(new CutPoint(coord, ProfileBuilder.IntersectionType.WALL, id, corner)); + public void addWallCutPt(Coordinate coord, int id, List alphas) { + pts.add(new CutPoint(coord, ProfileBuilder.IntersectionType.WALL, id)); pts.get(pts.size()-1).wallId = id; pts.get(pts.size()-1).setWallAlpha(alphas); } 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 5ec42265f..10759dd32 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 @@ -1121,7 +1121,7 @@ private void addGroundBuildingCutPts(LineSegment fullLine, CutProfile profile, b } } if (facetLine.type == IntersectionType.BUILDING) { - CutPoint pt = profile.addBuildingCutPt(intersection, facetLine.originId, i, false); + CutPoint pt = profile.addBuildingCutPt(intersection, facetLine.originId, i); pt.setGroundCoef(Scene.DEFAULT_G_BUILDING); pt.setWallAlpha(buildings.get(facetLine.getOriginId()).alphas); // add a point at the bottom of the building on the exterior side of the building @@ -1130,7 +1130,7 @@ private void addGroundBuildingCutPts(LineSegment fullLine, CutProfile profile, b // it works also with polygon holes as interiors are CCW Vector2D exteriorVector = facetVector.rotate(LEFT_SIDE).normalize().multiply(MILLIMETER); Coordinate exteriorPoint = exteriorVector.add(Vector2D.create(intersection)).toCoordinate(); - CutPoint exteriorPointCutPoint = profile.addBuildingCutPt(exteriorPoint, facetLine.originId, i, false); + CutPoint exteriorPointCutPoint = profile.addBuildingCutPt(exteriorPoint, facetLine.originId, i); exteriorPointCutPoint.coordinate.setZ(NaN); double zRayReceiverSource = Vertex.interpolateZ(intersection,fullLine.p0, fullLine.p1); if(zRayReceiverSource <= intersection.z) { @@ -1138,10 +1138,10 @@ private void addGroundBuildingCutPts(LineSegment fullLine, CutProfile profile, b } } else if (facetLine.type == IntersectionType.WALL) { profile.addWallCutPt(Vector2D.create(intersection).add(directionBefore).toCoordinate(), - facetLine.originId, false, facetLine.alphas); - profile.addWallCutPt(intersection, facetLine.originId, false, facetLine.alphas); + facetLine.originId, facetLine.alphas); + profile.addWallCutPt(intersection, facetLine.originId, facetLine.alphas); profile.addWallCutPt(Vector2D.create(intersection).add(directionAfter).toCoordinate(), - facetLine.originId, false, facetLine.alphas); + facetLine.originId, facetLine.alphas); double zRayReceiverSource = Vertex.interpolateZ(intersection,fullLine.p0, fullLine.p1); if(zRayReceiverSource <= intersection.z) { profile.hasBuildingIntersection = true;