2017-08-13 13:21 GMT+02:00 Fernando Basso <fernandobasso...@gmail.com>:

> The description of the problem is:
>
> “Use the image primitives to create the image of a simple automobile,
> boat, or tree. Make sure you can easily change the scale of the entire
> image.”
>
> What sort of math am I supposed to know in order to apply this concept of
> "scaling" the image?
>
> Perhaps something like:
>
> (define SIZE 200)
> (define car-body (rectangle (* SIZE 1) (* SIZE 0.4) "solid" "orangered"))
> (define tire (circle (* SIZE 0.1) "solid" "black"))
>
> I think if I do something like that I can then later change SIZE and
> everything should still work fine.
>
> Is that the expected approach or I am missing some other math concept here?
>

Basically, but it is a clearer if you make the scale explicit.

Something like this:

    (define scale 2)
    (define TIRE-RADIUS  (* scale 10))
    (define CAR-LENGTH (* scale 90))
    (define CAR-HEIGHT  (* scale 40))
    ... draw car ...

-- 
Jens Axel Søgaard

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to