Disabled external gits
This commit is contained in:
66
Alpano/tests/ch/epfl/alpano/DrawPanoramaNew.java
Normal file
66
Alpano/tests/ch/epfl/alpano/DrawPanoramaNew.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package ch.epfl.alpano;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import ch.epfl.alpano.dem.ContinuousElevationModel;
|
||||
import ch.epfl.alpano.dem.DiscreteElevationModel;
|
||||
import ch.epfl.alpano.dem.HgtDiscreteElevationModel;
|
||||
import ch.epfl.alpano.gui.ChannelPainter;
|
||||
import ch.epfl.alpano.gui.ImagePainter;
|
||||
import ch.epfl.alpano.gui.PanoramaRenderer;
|
||||
import javafx.embed.swing.SwingFXUtils;
|
||||
import javafx.scene.image.Image;
|
||||
import static java.lang.Math.toRadians;
|
||||
|
||||
final class DrawPanoramaNew {
|
||||
final static File HGT_FILE = new File("HGT"+File.separatorChar+"N46E007.hgt");
|
||||
|
||||
final static int IMAGE_WIDTH = 2_500;
|
||||
final static int IMAGE_HEIGHT = 800;
|
||||
|
||||
final static double ORIGIN_LON = toRadians(7.65);
|
||||
final static double ORIGIN_LAT = toRadians(46.73);
|
||||
final static int ELEVATION = 600;
|
||||
final static double CENTER_AZIMUTH = toRadians(180);
|
||||
final static double HORIZONTAL_FOV = toRadians(110);
|
||||
final static int MAX_DISTANCE = 100_000;
|
||||
|
||||
final static PanoramaParameters PARAMS =
|
||||
new PanoramaParameters(new GeoPoint(ORIGIN_LON,
|
||||
ORIGIN_LAT),
|
||||
ELEVATION,
|
||||
CENTER_AZIMUTH,
|
||||
HORIZONTAL_FOV,
|
||||
MAX_DISTANCE,
|
||||
IMAGE_WIDTH,
|
||||
IMAGE_HEIGHT);
|
||||
|
||||
public static void main(String[] as) throws Exception {
|
||||
try (DiscreteElevationModel dDEM =
|
||||
new HgtDiscreteElevationModel(HGT_FILE)) {
|
||||
ContinuousElevationModel cDEM =
|
||||
new ContinuousElevationModel(dDEM);
|
||||
Panorama p = new PanoramaComputer(cDEM)
|
||||
.computePanorama(PARAMS);
|
||||
|
||||
ChannelPainter d = p::distanceAt;
|
||||
ChannelPainter sl = p::slopeAt;
|
||||
ChannelPainter h = d.div(100000).cycling().mul(360);
|
||||
ChannelPainter s = d.div(200000).clamped().inverted();
|
||||
ChannelPainter b = sl.mul(2).div(Math.PI).inverted().mul(0.7).add(0.3);
|
||||
ChannelPainter o =
|
||||
d.map(dist -> dist == Float.POSITIVE_INFINITY ? 0 : 1);
|
||||
|
||||
ImagePainter l = ImagePainter.hsb(h, s, b, o);
|
||||
|
||||
Image i = PanoramaRenderer.renderPanorama(p, l);
|
||||
ImageIO.write(SwingFXUtils.fromFXImage(i, null),
|
||||
"png",
|
||||
new File("tests/ch/epfl/alpano/niesen-profile.png"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user