SpatialZoom

Zooming the spatial map into the geography. The table keeps its size; the circle it shows gets smaller around a center, and the terrain is rebuilt for it. Zoom 1 is the whole mesh.

Types

Link copied to clipboard
data class Fit(val zoom: Double, val center: LatLon?)

A zoom and the center it zooms on, null for the whole mesh.

Link copied to clipboard
class Preview(val scale: Float, val translation: Vec2)

While a zoom is waiting for its terrain, the built terrain is shown scaled and shifted toward what the new circle will show. offset is the new center's position on the current disk and scale how much bigger the new circle draws the ground, both in model units. The scale is held between 0.2 and the size where the terrain's edge reaches maxRadius, and the shift is cut so no part of the terrain goes past maxRadius (under the bezel).

Properties

Link copied to clipboard
const val FOCUS_ZOOM: Double = 4.0

How far Center on the card and Show in 3D zoom in on a node.

Link copied to clipboard

The zoomed circle never gets smaller than this radius in meters.

Functions

Link copied to clipboard
fun circle(full: SpatialCircle, zoom: Double, center: LatLon?): SpatialCircle

The circle shown at a zoom around a center (the full circle's center when null). The center is pulled in so the zoomed circle stays inside the full one, so zooming out ends on the whole mesh and the map never shows ground beyond it.

Link copied to clipboard
fun clamp(zoom: Double, fullRadiusMeters: Double): Double
Link copied to clipboard
fun clampToDisk(point: Vec3, diskRadius: Float): Vec3

A point pulled in flat to the disk's rim when it lies past it, keeping its height.

Link copied to clipboard
fun fit(coordinates: List<LatLon>, full: SpatialCircle, padding: Double = 0.15): SpatialZoom.Fit?

The zoom and center that fit the coordinates on the disk with padding of their reach to spare. One place (or several on top of each other) gets FOCUS_ZOOM, as centering on a node does. Coordinates too spread out for any zoom get the whole mesh, zoom 1. Null when empty.

Link copied to clipboard
fun isOnDisk(x: Float, z: Float, diskRadius: Float): Boolean

Whether a point in model units lies on the disk, measured flat from its middle.

Link copied to clipboard
fun isShown(coordinate: LatLon, circle: SpatialCircle): Boolean

Whether a node is drawn: only inside the circle shown, so nothing stands past the rim.

Link copied to clipboard
fun maximumZoom(fullRadiusMeters: Double): Double

The most the map can zoom in on a full circle: down to a 1 km radius, and never below 1.