Sign in Join
FPDoc Onlineexperiment

ComparePoints function

In unit LazUtilities

Gets the relative order for the specified points based on their X and Y members.

Declaration

pascal
function ComparePoints(p1: TPoint; p2: TPoint): Integer

Arguments

p1

TPoint instance compared in the routine.

p2

TPoint instance compared in the routine.

Function result

Relative order for the compared points. -1, 0, or 1.

Description

ComparePoints is an Integer function used to compare the coordinates in the specified TPoint instances to determine their relative order. The return value contains -1, 0, or 1 for the following conditions:

-1
p1.y is smaller than p2.y, or p1.x is smaller than p2.x.
0
p1 and p2 have the same x and y values.
1
p1.y is larger than p2.y, or p1.x is larger than p2.x.

ComparePoints is used in the implementation of the TCustomSynEdit / TSynEdit control.

Added in LCL version 4.3.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.