Math

Math functions


Distance

function Distance(X1, Y1, X2, Y2: Double; Algo: EDistanceAlgo = EDistanceAlgo.Euclidean): Double;

Calculates the distance between X1,Y1 and X2,Y2. If not provided the Algo parameter defaults to Euclidean. But can be any of these:

  • EDistanceAlgo.Euclidean

  • EDistanceAlgo.EuclideanSq

  • EDistanceAlgo.Manhattan

  • EDistanceAlgo.Chebyshev


Distance

function Distance(P1, P2: TPoint; Algo: EDistanceAlgo = EDistanceAlgo.Euclidean): Double;

Calculates the distance between two points. If not provided the Algo parameter defaults to Euclidean. But can be any of these:

  • EDistanceAlgo.Euclidean

  • EDistanceAlgo.EuclideanSq

  • EDistanceAlgo.Manhattan

  • EDistanceAlgo.Chebyshev


LogN

function LogN(base, x: Double): Double;

Sar

function Sar(x: Integer; Shift: Byte): Integer;

Ror

function Ror(x: UInt32; Shift: Byte): UInt32;

Rol

function Rol(x: UInt32; Shift: Byte): UInt32;

DegToRad

function DegToRad(Deg: Double): Double;

RadToDeg

function RadToDeg(Rad: Double): Double;

RadNormalize

function RadNormalize(Rad: Double): Double;

DegNormalize

function DegNormalize(Deg: Double): Double;

Log2

function Log2(x: Double): Double;

Log10

function Log10(x: Double): Double;

NextPower2

function NextPower2(n: Integer): Integer;

Modulo

function Modulo(X, Y: Integer): Integer;

Modulo

function Modulo(X, Y: Double): Double;

DeltaAngle

function DeltaAngle(DegreesA, DegreesB: Double; R: Double = 360): Double;

CrossProduct

function CrossProduct(r, p, q: TPoint): Int64;

CrossProduct

function CrossProduct(rx,ry, px,py, qx,qy: Double): Double;

LinesIntersect

function LinesIntersect(P1, P2, Q1, Q2: TPoint): Boolean;

LinesIntersect

function LinesIntersect(P1, P2, Q1, Q2: TPoint; out Where: TPoint): Boolean;

DistToLine

function DistToLine(P, P1, P2: TPoint; out Nearest: TPoint): Double;

DistToLine

function DistToLine(P, P1, P2: TPoint): Double;

IsNumber

function IsNumber(Value: Single): Boolean;

IsNumber

function IsNumber(const Value: Double): Boolean;