# [racket] Controlling the size of plot symbols

 From: Alexander D. Knauth (alexander at knauth.org) Date: Fri Apr 11 16:17:39 EDT 2014 Previous message: [racket] Controlling the size of plot symbols Next message: [racket] Controlling the size of plot symbols Messages sorted by: [date] [thread] [subject] [author]

Is there something for plotting 3D parametric surfaces? (where there are two parameters instead of one)

If there is, then I would do something like this:
(define (sphere3d ctr-x ctr-y ctr-z r #:color color)
(parametric-surface3D (lambda (theta phi) ; theta and phi are the parameters
(let* ([z (* r (sin phi))]
[√x^2+y^2 (sqrt (- (sqr r) (sqr z)))]
[x (* √x^2+y^2 (cos theta))]
[y (* √x^2+y^2 (sin theta))])
(vector x y z)))
(list (list 0 (* 2 pi)) ; theta goes from 0 to 2pi
(list (- (/ pi 2)) (/ pi 2))) ; phi goes from -pi/2 to pi/2
#:color color))

I looked at the documentation already and didn’t find it, but is there something that can do that, maybe in a different place?

I saw parametric3d, but that looks like it only does one parameter, so it can only do lines.

If there isn’t, is there a way to define something like a parametric-surface3d?
Maybe something like this:
(define (parametric-surface3d f mins-and-maxes #:x-min [x-min #f] …)
(match mins-and-maxes
[(list (list u-min u-max) (list v-min v-max))
(…
(for*/list ([u-value (in-range u-min u-max ∆u)]
[v-value (in-range v-min v-max ∆v)])
(…
(f u-value v-value)
…))
…)]))
Where u and v are the parameters, u-min and u-max are the min and max of u, v-min and v-max are the min and max of v, and the function f is applied to the parameters like this: (f u-value v-value), and returns a (sequence-of real?) just like in parametric3d.

f: (real? real? . -> . (sequence-of real?)
mins-and-maxes: (listof (list/c real? real?))

Maybe a more general version could deal with any number of parameters (thats why I wanted to put them in one mins-and-maxes argument instead of having separate arguments for each min and max.

But I have no idea how to define something like this.

On Apr 10, 2014, at 11:27 PM, Neil Toronto <neil.toronto at gmail.com> wrote:
> (define (sphere3d x0 y0 z0 r color)
>  (isosurface3d (λ (x y z) (sqrt (+ (sqr (- x0 x))
>                                    (sqr (- y0 y))
>                                    (sqr (- z0 z)))))
>                r (- x0 r) (+ x0 r) (- y0 r) (+ y0 r) (- z0 r) (+ z0 r)
>                #:line-style 'transparent
>                #:color color))

 Posted on the users mailing list. Previous message: [racket] Controlling the size of plot symbols Next message: [racket] Controlling the size of plot symbols Messages sorted by: [date] [thread] [subject] [author]