~ubuntu-branches/ubuntu/lucid/sawfish/lucid-updates

« back to all changes in this revision

Viewing changes to lisp/sawfish/wm/util/rects.jl

  • Committer: Bazaar Package Importer
  • Author(s): Christian Marillat
  • Date: 2005-02-23 16:16:46 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050223161646-4id6qyw4h9lkvb0v
Tags: 1:1.3+cvs20050222-1
* New cvs release.
* Add an emacs initialisation script to load sawfish.el (Closes: #295290)
* Updated sawfish.el to 1.32

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
;; rects.jl -- rectangle manipulation
2
 
;; $Id: rects.jl,v 1.14 2000/08/16 10:57:32 john Exp $
 
2
;; $Id: rects.jl,v 1.15 2002/04/24 06:57:05 jsh Exp $
3
3
 
4
4
;; Copyright (C) 1999 John Harper <john@dcs.warwick.ac.uk>
5
5
 
29
29
            rectangle-corners
30
30
            rectangle-center
31
31
            rectangle-center*
 
32
            rectangle-union
 
33
            rectangle-intersection
32
34
            rect-1d-overlap
33
35
            rect-2d-overlap
34
36
            rect-2d-overlap*
148
150
    (cons (+ (car point) (/ (car dims) 2))
149
151
          (+ (cdr point) (/ (cdr dims) 2))))
150
152
 
 
153
  (define (rectangle-union rect1 rect2)
 
154
    (list (min (nth 0 rect1) (nth 0 rect2))
 
155
          (min (nth 1 rect1) (nth 1 rect2))
 
156
          (max (nth 2 rect1) (nth 2 rect2))
 
157
          (max (nth 3 rect1) (nth 3 rect2))
 
158
          (nth 4 rect1)))
 
159
 
 
160
  (define (rectangle-intersection rect1 rect2)
 
161
    (let ((rect (list (max (nth 0 rect1) (nth 0 rect2))
 
162
                      (max (nth 1 rect1) (nth 1 rect2))
 
163
                      (min (nth 2 rect1) (nth 2 rect2))
 
164
                      (min (nth 3 rect1) (nth 3 rect2))
 
165
                      (nth 4 rect1))))
 
166
      (if (or (>= (nth 0 rect) (nth 2 rect))
 
167
              (>= (nth 1 rect) (nth 3 rect)))
 
168
          ;; empty
 
169
          nil
 
170
        rect)))
 
171
 
151
172
 
152
173
;;; overlap
153
174