Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 70 lines (44 sloc) 1.387 kb
a97f625 @dharmatech Rename (box2d-lite feature-pair) to (box2d-lite edges)
authored
1
2 (library (box2d-lite edges)
3
4 (export make-edges
5
b163918 @dharmatech edges: formatting
authored
6 edges-in-edge-1 edges-in-edge-1-set!
7 edges-out-edge-1 edges-out-edge-1-set!
8 edges-in-edge-2 edges-in-edge-2-set!
9 edges-out-edge-2 edges-out-edge-2-set!
a97f625 @dharmatech Rename (box2d-lite feature-pair) to (box2d-lite edges)
authored
10
11 is-edges
12 import-edges
13
14 create-edges
15
16 edges-equal?
17
18 flip)
19
20 (import (rnrs)
21 (box2d-lite util define-record-type)
22 (box2d-lite edge-numbers))
23
24 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
25
26 (define-record-type++ edges
27 is-edges
28 import-edges
29 (fields (mutable in-edge-1)
30 (mutable out-edge-1)
31 (mutable in-edge-2)
32 (mutable out-edge-2))
33 (methods))
34
35 (define (create-edges)
36 (make-edges NO-EDGE NO-EDGE NO-EDGE NO-EDGE))
37
38 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
39
40 (define (edges-equal? a b)
41
42 (is-edges a)
43 (is-edges b)
44
45 (and (equal? a.in-edge-1 b.in-edge-1)
46 (equal? a.out-edge-1 b.out-edge-1)
47 (equal? a.in-edge-2 b.in-edge-2)
48 (equal? a.out-edge-2 b.out-edge-2)))
49
50 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
51
52 (define (flip e)
53
54 (is-edges e)
55
56 (let ((tmp e.in-edge-1))
57
58 (e.in-edge-1! e.in-edge-2)
59
60 (e.in-edge-2! tmp))
61
62 (let ((tmp e.out-edge-1))
63
64 (e.out-edge-1! e.out-edge-2)
65
66 (e.out-edge-2! tmp)))
67
68 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
69
70 )
Something went wrong with that request. Please try again.