1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.rugged.raster;
18
19 import org.hipparchus.util.FastMath;
20 import org.orekit.bodies.GeodeticPoint;
21 import org.orekit.utils.Constants;
22
23 public class VolcanicConeElevationUpdater implements TileUpdater {
24
25 private GeodeticPoint summit;
26 private double slope;
27 private double base;
28 private double size;
29 private int n;
30
31 public VolcanicConeElevationUpdater(GeodeticPoint summit, double slope, double base,
32 double size, int n) {
33 this.summit = summit;
34 this.slope = slope;
35 this.base = base;
36 this.size = size;
37 this.n = n;
38 }
39
40 public void updateTile(double latitude, double longitude, UpdatableTile tile) {
41
42 double step = size / (n - 1);
43 double minLatitude = size * FastMath.floor(latitude / size);
44 double minLongitude = size * FastMath.floor(longitude / size);
45 double sinSlope = FastMath.sin(slope);
46 tile.setGeometry(minLatitude, minLongitude, step, step, n, n);
47 for (int i = 0; i < n; ++i) {
48 double cellLatitude = minLatitude + i * step;
49 for (int j = 0; j < n; ++j) {
50 double cellLongitude = minLongitude + j * step;
51 double distance = Constants.WGS84_EARTH_EQUATORIAL_RADIUS *
52 FastMath.hypot(cellLatitude - summit.getLatitude(),
53 cellLongitude - summit.getLongitude());
54 double altitude = FastMath.max(summit.getAltitude() - distance * sinSlope,
55 base);
56 tile.setElevation(i, j, altitude);
57 }
58 }
59 }
60 }