ComputeRays { public PropagationPath computeHorizontalEdgeDiffraction(boolean obstructedSourceReceiver, Coordinate receiverCoord, Coordinate srcCoord, List<TriIdWithIntersection> allInterPoints) { List<PointPath> points = new ArrayList<PointPath>(); List<SegmentPath> segments = new ArrayList<SegmentPath>(); List<SegmentPath> srPath = new ArrayList<SegmentPath>(); boolean validDiffraction; DiffractionWithSoilEffetZone diffDataWithSoilEffet; if (!obstructedSourceReceiver) { diffDataWithSoilEffet = data.freeFieldFinder.getPathInverse(receiverCoord, srcCoord); validDiffraction = false; } else { diffDataWithSoilEffet = data.freeFieldFinder.getPath(receiverCoord, srcCoord, allInterPoints); validDiffraction = diffDataWithSoilEffet.getROZone() != null; } if (validDiffraction) { List<Coordinate> offsetPath = new ArrayList<>(diffDataWithSoilEffet.getPath()); for(int i = 1; i < offsetPath.size() - 1; i++) { Coordinate dest = offsetPath.get(i); Vector2D v = new Vector2D(offsetPath.get(0), dest).normalize().multiply(FastObstructionTest.epsilon); offsetPath.set(i, new Coordinate(dest.x - v.getX(), dest.y - v.getY(), dest.z)); } for (int j = offsetPath.size() - 1; j > 1; j--) { PropagationPath propagationPath1 = computeFreefield(offsetPath.get(j - 1), offsetPath.get(j), null); propagationPath1.getPointList().get(1).setType(PointPath.POINT_TYPE.DIFH); if (j == offsetPath.size() - 1) { propagationPath1.getPointList().get(0).setCoordinate(offsetPath.get(j)); points.add(propagationPath1.getPointList().get(0)); } points.add(propagationPath1.getPointList().get(1)); segments.addAll(propagationPath1.getSegmentList()); } PropagationPath propagationPath2 = computeFreefield(offsetPath.get(0), offsetPath.get(1),null); points.add(propagationPath2.getPointList().get(1)); segments.add(propagationPath2.getSegmentList().get(0)); } else { PropagationPath propagationPath = computeFreefield(receiverCoord, srcCoord,null); points.addAll(propagationPath.getPointList()); segments.addAll(propagationPath.getSegmentList()); srPath.addAll(propagationPath.getSRList()); } return new PropagationPath(true, points, segments, srPath); } ComputeRays(PropagationProcessData data); static double[] sumArrayWithPonderation(double[] array1, double[] array2, double p); static double[] sumDbArray(double[] array1, double[] array2); static double[] multArray(double[] array1, double[] array2); static double sumArray(int nbfreq, double energeticSum[]); static double sumArray(double energeticSum[]); static double[] sumArray(double array1[], double array2[]); int getThreadCount(); void setThreadCount(int threadCount); void makeSourceRelativeZToAbsolute(); void makeRelativeZToAbsolute(); void makeReceiverRelativeZToAbsolute(); static double dbaToW(double dBA); static double[] dbaToW(double[] dBA); static double wToDba(double w); static double[] wToDba(double[] w); static double splitLineStringIntoPoints(LineString geom, double segmentSizeConstraint,
                                             List<Coordinate> pts); void computeReflexionOverBuildings(Coordinate p0, Coordinate p1, List<PointPath> points, List<SegmentPath> segments, List<SegmentPath> srPath); static int[] asWallArray(MirrorReceiverResult res); List<PropagationPath> computeReflexion(Coordinate receiverCoord,
                                            Coordinate srcCoord, boolean favorable, List<FastObstructionTest.Wall> nearBuildingsWalls); PropagationPath computeFreefield(Coordinate receiverCoord,
                                            Coordinate srcCoord,List<TriIdWithIntersection> inters); PropagationPath computeHorizontalEdgeDiffraction(boolean obstructedSourceReceiver, Coordinate receiverCoord,
                                                            Coordinate srcCoord, List<TriIdWithIntersection> allInterPoints); static Plane ComputeZeroRadPlane(Coordinate p0, Coordinate p1); static org.apache.commons.math3.geometry.euclidean.threed.Vector3D CoordinateToVector(Coordinate p); static List<Coordinate> cutRoofPointsWithPlane(Plane plane, List<Coordinate> roofPts); List<Coordinate> computeSideHull(boolean left, Coordinate p1, Coordinate p2); void computeRaysAtPosition(Coordinate receiverCoord, int idReceiver, List<PropagationDebugInfo> debugInfo, IComputeRaysOut dataOut, ProgressVisitor progressVisitor); void initStructures(); void runDebug(IComputeRaysOut computeRaysOut, List<PropagationDebugInfo> debugInfo); void run(IComputeRaysOut computeRaysOut);  }
@Test public void TestComputeHorizontalEdgeDiffraction() throws LayerDelaunayError, ParseException { GeometryFactory factory = new GeometryFactory(); WKTReader wktReader = new WKTReader(factory); Envelope cellEnvelope = new Envelope(new Coordinate(316705, 6706347, 0.), new Coordinate(316828, 6706469, 0.)); MeshBuilder mesh = new MeshBuilder(); mesh.addGeometry(wktReader.read("POLYGON ((316759.81 6706397.4101739, 316759.81 6706403.99033324, 316765.7002829955 6706404.19000385, 316778.88539775345 6706404.489665548, 316777.49275745824 6706400.809116197, 316765.598667453 6706399.209910818, 316765.5966749492 6706399.209431015, 316765.594822107 6706399.208555082, 316765.59318675095 6706399.207319812, 316765.5918375706 6706399.205777088, 316765.59083123534 6706399.203991711, 316765.59021001414 6706399.202038671, 316765.58999999997 6706399.2, 316765.58999999997 6706397.509829072, 316759.81 6706397.4101739))"), 16.68046); mesh.addGeometry(wktReader.read("POLYGON ((316755.91050631634 6706412.408966506, 316756.3094447798 6706419.689593465, 316765.78984906914 6706419.290418547, 316765.6900012205 6706412.900156232, 316765.69 6706412.9, 316765.69 6706412.20970156, 316762.3996971088 6706412.109995412, 316762.39766060974 6706412.109722513, 316762.3957228751 6706412.109039148, 316762.3939657122 6706412.107974169, 316762.39246330503 6706412.106572536, 316762.3912790822 6706412.104893423, 316762.3904630394 6706412.10300772, 316762.3900496281 6706412.100995037, 316762.1910047661 6706410.110546417, 316758.81 6706410.30942905, 316758.81 6706412.1, 316758.8097809892 6706412.102081406, 316758.80913354986 6706412.104071641, 316758.8080860413 6706412.10588353, 316758.8066843467 6706412.107437708, 316758.8049898632 6706412.108666099, 316758.8030768129 6706412.109514894, 316758.8010289915 6706412.109946918, 316755.91050631634 6706412.408966506))"), 16.73458); cellEnvelope.expandBy(200); mesh.finishPolygonFeeding(cellEnvelope); FastObstructionTest manager = new FastObstructionTest(mesh.getPolygonWithHeight(), mesh.getTriangles(), mesh.getTriNeighbors(), mesh.getVertices()); DiffractionWithSoilEffetZone eff = manager.getPath(new Coordinate(316876.05185368325, 6706318.789634008, 22.089050196052437), new Coordinate(316747.10402055364, 6706422.950335046, 12.808121783800553), null); assertEquals(3, eff.getPath().size()); }