1 (* Copyright (C) 2005-2023 Free Software Foundation, Inc. *)
2 (* This file is part of Chisel.
4 Chisel is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 3, or (at your option) any later
9 Chisel is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License along
15 with gm2; see the file COPYING. If not, write to the Free Software
16 Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *)
17 DEFINITION MODULE Geometry ;
24 System : LOGITECH MODULA-2/86
25 Description: Defines some commonly used geometrical functions.
28 EXPORT QUALIFIED IsSubLine, IsSubRange, IsIntersectingRange,
29 IntersectionLength, IsPointOnLine,
34 IsSubLine - returns true if the range i1..i2 or j1..j2 are ranges
38 PROCEDURE IsSubLine (i1, i2, j1, j2: CARDINAL) : BOOLEAN ;
42 IsSubRange - returns true if i lies inbetween High and Low.
45 PROCEDURE IsSubRange (Low, High, i: CARDINAL) : BOOLEAN ;
49 IsIntersectingRange - returns true if the ranges i1..i2 j1..j2
53 PROCEDURE IsIntersectingRange (i1, i2, j1, j2: CARDINAL) : BOOLEAN ;
57 IntersectionLength - returns the intersection length
58 of the overlapping ranges i1..i2 j1..j2.
61 PROCEDURE IntersectionLength (i1, i2, j1, j2: CARDINAL) : CARDINAL ;
65 IsPointOnLine - returns true if point x, y is on line (x1, y1) , (x2, y2)
68 PROCEDURE IsPointOnLine (x, y: CARDINAL; x1, y1, x2, y2: CARDINAL) : BOOLEAN ;
72 Max - returns the largest cardinal number from i and j.
75 PROCEDURE Max (i, j: CARDINAL) : CARDINAL ;
79 Min - returns the smallest cardinal number from i and j.
82 PROCEDURE Min (i, j: CARDINAL) : CARDINAL ;
86 Abs - returns the difference between i and j.
89 PROCEDURE Abs (i, j: CARDINAL) : CARDINAL ;
93 Swap - swaps two cardinal numbers i and j.
96 PROCEDURE Swap (VAR i, j: CARDINAL) ;