File: nonrenderer.rkt

package info (click to toggle)
racket 6.1-4~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 91,948 kB
  • sloc: ansic: 265,507; sh: 32,501; asm: 12,747; lisp: 6,958; cpp: 2,906; makefile: 2,284; pascal: 2,134; exp: 484; python: 366; xml: 11
file content (46 lines) | stat: -rw-r--r-- 2,180 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#lang racket/base

(require racket/list racket/contract unstable/latent-contract/defthing
         "math.rkt"
         "contract.rkt"
         "ticks.rkt"
         "plot-element.rkt")

(provide (all-defined-out))

(define ((x-ticks-fun ts far?) r)
  (let-values ([(ts far-ts)  (if far? (values empty ts) (values ts empty))])
    (cond [(= (vector-length r) 2)  (values ts far-ts empty empty)]
          [(= (vector-length r) 3)  (values ts far-ts empty empty empty empty)]
          [else  (raise-type-error 'x-ticks-fun "2- or 3-vector of ivls" r)])))

(define ((y-ticks-fun ts far?) r)
  (let-values ([(ts far-ts)  (if far? (values empty ts) (values ts empty))])
    (cond [(= (vector-length r) 2)  (values empty empty ts far-ts)]
          [(= (vector-length r) 3)  (values empty empty ts far-ts empty empty)]
          [else  (raise-type-error 'y-ticks-fun "2- or 3-vector of ivls" r)])))

(define ((z-ticks-fun ts far?) r)
  (let-values ([(ts far-ts)  (if far? (values empty ts) (values ts empty))])
    (cond [(= (vector-length r) 3)  (values empty empty empty empty ts far-ts)]
          [else  (raise-type-error 'z-ticks-fun "3-vector of ivls" r)])))

(defproc (x-ticks [ts (listof tick?)] [#:far? far? boolean? #f]) nonrenderer?
  (nonrenderer #f #f (x-ticks-fun ts far?)))

(defproc (y-ticks [ts (listof tick?)] [#:far? far? boolean? #f]) nonrenderer?
  (nonrenderer #f #f (y-ticks-fun ts far?)))

(defproc (z-ticks [ts (listof tick?)] [#:far? far? boolean? #f]) nonrenderer?
  (nonrenderer #f #f (z-ticks-fun ts far?)))

(defproc (invisible-rect [x-min (or/c rational? #f)] [x-max (or/c rational? #f)]
                         [y-min (or/c rational? #f)] [y-max (or/c rational? #f)]
                         ) nonrenderer?
  (nonrenderer (vector (ivl x-min x-max) (ivl y-min y-max)) #f #f))

(defproc (invisible-rect3d [x-min (or/c rational? #f)] [x-max (or/c rational? #f)]
                           [y-min (or/c rational? #f)] [y-max (or/c rational? #f)]
                           [z-min (or/c rational? #f)] [z-max (or/c rational? #f)]
                           ) nonrenderer?
  (nonrenderer (vector (ivl x-min x-max) (ivl y-min y-max) (ivl z-min z-max)) #f #f))