From 2112ad9730324e612ee3dfb52a21c17cd74a01c2 Mon Sep 17 00:00:00 2001 From: Luc Maisonobe <luc@orekit.org> Date: Tue, 25 Mar 2014 08:23:06 +0100 Subject: [PATCH] First working version of BasicScanAlgorithm. The case where the line-of-sight enters the Digital Elevation Model in one tile on top and exit it in another tile on bottom is not tested yet. --- .../java/org/orekit/rugged/core/BasicScanAlgorithm.java | 8 ++++---- .../org/orekit/rugged/core/BasicScanAlgorithmTest.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rugged-core/src/main/java/org/orekit/rugged/core/BasicScanAlgorithm.java b/rugged-core/src/main/java/org/orekit/rugged/core/BasicScanAlgorithm.java index 6260474d..49351cbd 100644 --- a/rugged-core/src/main/java/org/orekit/rugged/core/BasicScanAlgorithm.java +++ b/rugged-core/src/main/java/org/orekit/rugged/core/BasicScanAlgorithm.java @@ -81,12 +81,12 @@ public class BasicScanAlgorithm implements IntersectionAlgorithm { scannedTiles.clear(); // compute entry and exit points - entryPoint = ellipsoid.transform(ellipsoid.pointAtAltitude(position, los, Double.isInfinite(hMin) ? 0.0 : hMin), + entryPoint = ellipsoid.transform(ellipsoid.pointAtAltitude(position, los, Double.isInfinite(hMax) ? 0.0 : hMax), ellipsoid.getBodyFrame(), null); final SimpleTile entryTile = cache.getTile(entryPoint.getLatitude(), entryPoint.getLongitude()); addIfNotPresent(scannedTiles, entryTile); - exitPoint = ellipsoid.transform(ellipsoid.pointAtAltitude(position, los, Double.isInfinite(hMax) ? 0.0 : hMax), + exitPoint = ellipsoid.transform(ellipsoid.pointAtAltitude(position, los, Double.isInfinite(hMin) ? 0.0 : hMin), ellipsoid.getBodyFrame(), null); final SimpleTile exitTile = cache.getTile(exitPoint.getLatitude(), exitPoint.getLongitude()); addIfNotPresent(scannedTiles, entryTile); @@ -116,8 +116,8 @@ public class BasicScanAlgorithm implements IntersectionAlgorithm { GeodeticPoint intersectionGP = null; double intersectionDot = Double.POSITIVE_INFINITY; for (final SimpleTile tile : scannedTiles) { - for (int i = latitudeIndex(tile, minLatitude); i < latitudeIndex(tile, maxLatitude); ++i) { - for (int j = longitudeIndex(tile, minLongitude); j < longitudeIndex(tile, maxLongitude); ++j) { + for (int i = latitudeIndex(tile, minLatitude); i <= latitudeIndex(tile, maxLatitude); ++i) { + for (int j = longitudeIndex(tile, minLongitude); j <= longitudeIndex(tile, maxLongitude); ++j) { GeodeticPoint gp = tile.pixelIntersection(entryPoint, exitPoint, i, j); if (gp != null) { final Vector3D point = ellipsoid.transform(gp); diff --git a/rugged-core/src/test/java/org/orekit/rugged/core/BasicScanAlgorithmTest.java b/rugged-core/src/test/java/org/orekit/rugged/core/BasicScanAlgorithmTest.java index af14dd47..dbf7e3f3 100644 --- a/rugged-core/src/test/java/org/orekit/rugged/core/BasicScanAlgorithmTest.java +++ b/rugged-core/src/test/java/org/orekit/rugged/core/BasicScanAlgorithmTest.java @@ -214,7 +214,7 @@ public class BasicScanAlgorithmTest { Vector3D position = state.getPVCoordinates(earth.getBodyFrame()).getPosition(); Vector3D los = groundP.subtract(position); GeodeticPoint result = basicScan.intersection(earth, position, los); - Assert.assertEquals(0.0, groundP.distance(earth.transform(result)), 0.03); + Assert.assertEquals(0.0, groundP.distance(earth.transform(result)), 1.0e-10); } -- GitLab