MinPoint (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following code example illustrates how to use the MinPoint function to return the minimum of two TPointF or TPoint objects.

Code

...
var
  P1, P2, P3: TPoint;
...
begin
  P1.X := 15;
  P1.Y := 27;

  P2.X := 12;
  P2.Y := 27;

  P3 := MinPoint(P1, P2);
  //Returns the point that is closer to the origin((0,0) coordinates).
  writeln(P3.X,' ',P3.Y);
  //As seen above, the Y-coordinates of P1 and P2 are equal.
  //The program then compares the X-coordinates and returns the minimum point.
end.

Uses