Table of Contents

Class MapGestureMath

Namespace
LansMap.Core.Control

Pure gesture math shared by input controllers, testable without an editor.

public static class MapGestureMath
Inheritance
object
MapGestureMath

Methods

NormalizeDeg(double)

Wraps a bearing into [0, 360) degrees.

public static double NormalizeDeg(double degrees)

Parameters

degrees double

Bearing in degrees, any magnitude.

Returns

double

Equivalent bearing in [0, 360) degrees.

Remarks

Unbounded accumulation (rotate one direction indefinitely) drifts double precision over very large magnitudes; callers that accumulate rotation via repeated addition should wrap through this after every write.

TwistRotationDeltaDeg(double, double)

Shortest signed rotation from one finger angle to the next.

public static double TwistRotationDeltaDeg(double prevAngleDeg, double angleDeg)

Parameters

prevAngleDeg double

Previous finger angle in degrees.

angleDeg double

Current finger angle in degrees.

Returns

double

Signed sweep in (-180, 180] degrees.

Remarks

Wrap-safe. Fed by a y-up Atan2 finger angle, so a counter-clockwise twist yields a positive delta and map rotation follows the fingers.