public double heightAndNormalAt(double x, double y, double z, Vector3d normalToPack) { Double heightAt = Double.NEGATIVE_INFINITY; normalToPack.set(0.0, 0.0, 1.0); for (int i = 0; i < heightMaps.size(); i++) { HeightMapWithNormals heightMap = heightMaps.get(i); if (heightMap.getBoundingBox().isXYInside(x, y)) { double localHeightAt = heightMap.heightAt(x, y, z); if (localHeightAt > heightAt) { heightAt = localHeightAt; heightMap.heightAndNormalAt(x, y, z, normalToPack); } } } return heightAt; }
@Override public double heightAndNormalAt(double x, double y, double z, Vector3D normalToPack) { double heightAt = Double.NEGATIVE_INFINITY; for (int i = 0; i < terrainObjects.size(); i++) { TerrainObject3D terrainObject = terrainObjects.get(i); if (terrainObject.isClose(x, y, z)) { HeightMapWithNormals heightMap = terrainObject.getHeightMapIfAvailable(); if (heightMap != null) { double localHeightAt = heightMap.heightAt(x, y, z); if (localHeightAt > heightAt) { heightAt = heightMap.heightAndNormalAt(x, y, z, normalToPack); } } } } return heightAt; }
public ArrayList<Point3D> createAListOfPointsFromAGroundProfile(GroundProfile3D groundProfile, double minX, double minY, double maxX, double maxY, double resolution) { ArrayList<Point3D> points = new ArrayList<Point3D>(); for (double x = minX; x < maxX; x = x + resolution) { for (double y = minY; y < maxY; y = y + resolution) { double z = groundProfile.getHeightMapIfAvailable().heightAt(x, y, 0.0); points.add(new Point3D(x, y, z)); } } return points; }
terrainObject3D.getHeightMapIfAvailable().heightAndNormalAt(translation.getX(), translation.getY(), translation.getZ(), normal); surfaceNormal.set(normal);
public void addHeightMap(HeightMapWithNormals heightMap) { this.heightMaps.add(heightMap); if (boundingBox == null) boundingBox = heightMap.getBoundingBox(); else boundingBox = BoundingBox3d.union(boundingBox, heightMap.getBoundingBox()); }
double height = heightMap.heightAndNormalAt(x, y, 0.0, surfaceNormal); assertEquals(1.0, surfaceNormal.length(), 1e-7); queryPoint.add(excursionVector); double heightAtQueryPoint = heightMap.heightAt(queryPoint.getX(), queryPoint.getY(), queryPoint.getZ()); double heightDifferenceFromLinearModel = queryPoint.getZ() - heightAtQueryPoint;
public ArrayList<Point3D> createAListOfPointsFromAGroundProfile(GroundProfile3D groundProfile, double minX, double minY, double maxX, double maxY, double resolution) { ArrayList<Point3D> points = new ArrayList<Point3D>(); for (double x = minX; x < maxX; x = x + resolution) { for (double y = minY; y < maxY; y = y + resolution) { double z = groundProfile.getHeightMapIfAvailable().heightAt(x, y, 0.0); points.add(new Point3D(x, y, z)); } } return points; }
public void addHeightMap(HeightMapWithNormals heightMap) { this.heightMaps.add(heightMap); if (boundingBox == null) boundingBox = heightMap.getBoundingBox(); else boundingBox = BoundingBox3D.union(boundingBox, heightMap.getBoundingBox()); }
public double heightAndNormalAt(double x, double y, double z, Vector3D normalToPack) { Double heightAt = Double.NEGATIVE_INFINITY; normalToPack.set(0.0, 0.0, 1.0); for (int i = 0; i < heightMaps.size(); i++) { HeightMapWithNormals heightMap = heightMaps.get(i); if (heightMap.getBoundingBox().isXYInsideInclusive(x, y)) { double localHeightAt = heightMap.heightAt(x, y, z); if (localHeightAt > heightAt) { heightAt = localHeightAt; heightMap.heightAndNormalAt(x, y, z, normalToPack); } } } return heightAt; }