Table of Contents

Struct ScreenPoint

Namespace
LansMap.Core.Geo

A position in screen pixels, origin at the top-left with Y increasing downward.

public readonly struct ScreenPoint
Inherited Members

Remarks

This is the graphics convention, not Unity's input convention: Unity reports mouse and touch positions with the origin at the bottom-left and Y increasing upward. The public MonoBehaviour surface flips between the two, so callers working in Unity screen space should use ScreenMapView.ScreenToLatLon and LatLonToScreen rather than building a ScreenPoint by hand.

Constructors

ScreenPoint(double, double)

Creates a screen position, top-left origin.

public ScreenPoint(double x, double y)

Parameters

x double

Horizontal position in screen px from the left edge.

y double

Vertical position in screen px from the top edge.

Properties

Magnitude

Magnitude of the vector, in screen px.

public double Magnitude { get; }

Property Value

double

SqrMagnitude

Squared magnitude of the vector, in screen px squared (avoids sqrt).

public double SqrMagnitude { get; }

Property Value

double

X

Horizontal position in screen px from the left edge.

public double X { get; }

Property Value

double

Y

Vertical position in screen px from the top edge.

public double Y { get; }

Property Value

double

Operators

operator +(ScreenPoint, ScreenPoint)

Add two screen positions component-wise.

public static ScreenPoint operator +(ScreenPoint a, ScreenPoint b)

Parameters

a ScreenPoint
b ScreenPoint

Returns

ScreenPoint

operator *(ScreenPoint, double)

Scale a screen position by a scalar value.

public static ScreenPoint operator *(ScreenPoint a, double scalar)

Parameters

a ScreenPoint
scalar double

Returns

ScreenPoint

operator *(double, ScreenPoint)

Scale a screen position by a scalar value.

public static ScreenPoint operator *(double scalar, ScreenPoint a)

Parameters

scalar double
a ScreenPoint

Returns

ScreenPoint

operator -(ScreenPoint, ScreenPoint)

Subtract two screen positions component-wise, returning a delta vector.

public static ScreenPoint operator -(ScreenPoint a, ScreenPoint b)

Parameters

a ScreenPoint
b ScreenPoint

Returns

ScreenPoint