Table of Contents

Class ViewSpacePose

Namespace
LansMap.Markers.World
Assembly
LansMap.Runtime.dll

Turns a ViewSpacePoint into a Unity world position on the map's marker plane.

public static class ViewSpacePose
Inheritance
object
ViewSpacePose

Remarks

Assumes a full-screen pixel rect (cam.aspect == Screen.width / Screen.height), a symmetric frustum, and no lens shift or custom projectionMatrix - the same camera shape MapViewTransform itself assumes throughout.

Methods

ToWorld(Camera, ViewSpacePoint, float)

World position for a projected view-space point, placed at the depth law markers already use (Depth(double, double)).

public static Vector3 ToWorld(Camera cam, ViewSpacePoint p, float planeDistance)

Parameters

cam Camera

Camera the point is posed against.

p ViewSpacePoint

Camera-frame point from ProjectToViewSpace(MercatorPoint, double).

planeDistance float

Distance from the camera the map plane sits at, in Unity world units.

Returns

Vector3

World position. On a perspective cam, finite for every p, including one behind the camera or past the far view-distance cap - nothing there divides by Depth. An orthographic camera has no "behind the camera" plane in that sense; at Depth <= 0 it falls back to the same finite perspective formula rather than the true (undefined there) parallel-projection answer - see remarks.

Remarks

Perspective: offsetPx * unityDepth - p.X * p.CameraDistance / p.Depth times planeDistance * p.Depth / p.CameraDistance

  • cancels Depth and CameraDistance entirely, so nothing divides by Depth. Orthographic's world-per-pixel scale does not depend on depth, so it has nothing to cancel offsetPx's own divide with - unavoidable, and undefined at Depth <= 0, hence the perspective fallback there.