Table of Contents

Struct VanWijkPath

Namespace
LansMap.Core.Control

Van Wijk and Nuij smooth zoom-and-pan path from one view to another.

public readonly struct VanWijkPath
Inherited Members

Remarks

Long jumps zoom out, translate, and zoom back in along the optimal arc. A jump with no translation is a pure exponential zoom. Longitude uses the wrap-aware shortest delta, so a path never crosses the long way around the world. Rho 1.42 and 1.2 screenfuls/s keep the scale change gradual.

Fields

Rho

Path curvature, dimensionless.

public const double Rho = 1.42

Field Value

double

SpeedScreenfullsPerSecond

Path speed in screenfuls per second.

public const double SpeedScreenfullsPerSecond = 1.2

Field Value

double

Properties

DurationSeconds

Duration of the path in seconds, at least 0.001.

public double DurationSeconds { get; }

Property Value

double

PanScreenfulls

Pan distance from start to target, in screenfuls (screen's larger dimension) at the start zoom. Zero for a pure zoom.

public double PanScreenfulls { get; }

Property Value

double

Methods

Create(LatLon, double, LatLon, double, ScreenSize, int)

Builds a path between two WGS84 centers and zoom levels.

public static VanWijkPath Create(LatLon fromLl, double fromZoom, LatLon toLl, double toZoom, ScreenSize screen, int tileSizePx)

Parameters

fromLl LatLon

Start center in degrees WGS84.

fromZoom double

Start fractional Web Mercator zoom.

toLl LatLon

Target center in degrees WGS84.

toZoom double

Target fractional Web Mercator zoom.

screen ScreenSize

Viewport size in pixels.

tileSizePx int

Tile size in pixels, used to convert mercator distance to screen px at fromZoom.

Returns

VanWijkPath

A path to sample from t=0 to t=1 over DurationSeconds.

Sample(double)

Samples center and zoom along the optimal path.

public (LatLon Center, double Zoom) Sample(double t)

Parameters

t double

Normalized time, 0 to 1; values outside are clamped.

Returns

(LatLon Center, double Zoom)

WGS84 center in degrees and fractional Web Mercator zoom.