[racket] rotate an image using 2htdp/image

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Tue Jul 20 07:48:26 EDT 2010

No, but its upper left corner is consistently being kept at (20,20),
as the code asks.

If you were to write

  (underlay (rotate ang TRI) BACKGROUND)

in the body of render, you'd see the triangle also wiggling in this
way, but that's because the center of the bounding box is being kept
in a fixed position, but the bounding box's size is changing.
Centering is not done via the center of mass of a shape, but via the
bounding box.

You might also trying using frame to help you see what is going on here, eg:

  (underlay (frame (rotate ang TRI)) BACKGROUND)

hth,
Robby

On Tue, Jul 20, 2010 at 12:07 AM, Mathew Kurian <bluejamesbond at gmail.com> wrote:
> @
>
> Robby Findler
>
>  : I see what you mean. But in this example given by Paul Ojanen
>  (require 2htdp/image)
> (require 2htdp/universe)
>
> (define BACKGROUND (rectangle 100 100 "outline" "white"))
> (define TRI (triangle 35 "solid" "blue"))
>
> (define (render ang)
>  (place-image (rotate ang TRI) 20 20 BACKGROUND))
>
> (define (tock ang)
>  (modulo (+ ang 10) 360))
>
> (big-bang 0 (on-draw render) (on-tick tock))
> The triangle is not being consistent by keeping its center point on the
> center of BACKGROUND.
> Hopefully, this makes sense.
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>


Posted on the users mailing list.