1 
;;; * Mode: Lisp; Syntax: CommonLisp; Package: CLIMINTERNALS; *

2 
;;; 

3 
;;; Title: The coordinate Datatype

4 
;;; Created: 19981205 18:06

5 
;;; Author: Gilbert Baumann <unk6@rz.unikarlsruhe.de>

6 
;;; License: LGPL (See file COPYING for details).

7 
;;; $Id: coordinates.lisp,v 1.6 2003/05/31 18:18:43 gilbert Exp $

8 
;;; 

9 
;;; (c) copyright 1998,1999,2003 by Gilbert Baumann

10 

11 
;;; This library is free software; you can redistribute it and/or

12 
;;; modify it under the terms of the GNU Library General Public

13 
;;; License as published by the Free Software Foundation; either

14 
;;; version 2 of the License, or (at your option) any later version.

15 
;;;

16 
;;; This library is distributed in the hope that it will be useful,

17 
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of

18 
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU

19 
;;; Library General Public License for more details.

20 
;;;

21 
;;; You should have received a copy of the GNU Library General Public

22 
;;; License along with this library; if not, write to the

23 
;;; Free Software Foundation, Inc., 59 Temple Place  Suite 330,

24 
;;; Boston, MA 021111307 USA.

25 

26 
(inpackage :climinternals)

27 

28 
#

29 
(deftype coordinate () 'doublefloat)

30 

31 
(defun coordinate (n)

32 
"Coerces N to be a coordinate."

33 
(declare (type number n))

34 
(coerce n 'coordinate))

35 

36 
(defun coordinateepsilon ()

37 
;; tweak if you like

38 
(* #.(expt 2 10) doublefloatepsilon))

39 

40 
(defun coordinate= (x y)

41 
(< (abs ( x y)) (coordinateepsilon)))

42 

43 
(defun coordinate<= (x y)

44 
(<= ( x y) (coordinateepsilon)))

45 

46 
(defun coordinate/= (x y)

47 
(not (coordinate= x y)))

48 
#

49 

50 
(deftype coordinate () 'real)

51 

52 
(declaim (inline coordinate))

53 
(defun coordinate (n) n)

54 

55 
(declaim (inline coordinateepsilon))

56 
(defun coordinateepsilon ()

57 
0)

58 

59 
(declaim (inline coordinate=))

60 
(defun coordinate= (x y)

61 
(= x y))

62 

63 
(declaim (inline coordinate<=))

64 
(defun coordinate<= (x y)

65 
(<= x y))

66 

67 
(declaim (inline coordinate/=))

68 
(defun coordinate/= (x y)

69 
(/= x y))

70 

71 
;; $Log: coordinates.lisp,v $

72 
;; Revision 1.6 2003/05/31 18:18:43 gilbert

73 
;; Took the easy route: I switched COORDINATE to being just REAL in an

74 
;; attempt to keep McCLIM running using the latest CMUCL. This is however

75 
;; a questionable thing as it hides the real type errors.

76 
;;
