Re: [plt-dev] Re: [plt-scheme] scaling and rotating images using image.ss

2009-11-14 Thread Matthias Felleisen

This should be 

(overlay/places "center" "middle"
(rotate  0 a)
(rotate 20 a)
(rotate 40 a)
(rotate 60 a))

not 

 .. "middle" "middle" ...

correct? 


On Nov 14, 2009, at 1:18 AM, John Clements wrote:

> 
> On Sep 26, 2009, at 6:29 AM, Matthias Felleisen wrote:
> 
>> 
>> 
>> 1. htdp/world is deprecated, use 2htdp/universe instead.
>> 
>> 2. we consider the pinhole approach to our image library as a mistake. To 
>> solve the problem Robby is working on 2htdp/image, a replacement for the 
>> image library. When it comes out (end of semester probably) it will support 
>> rotate and other such operations, plus comparisons will be much faster.
> 
> I'm surprised to say it, but right now I'm *really missing the pinhole*.
> 
> I'm trying to write a function in 2htdp/image that draws, say, 36 copies of a 
> shape arranged in a big "circle" around a center.  With pinholes, this was 
> easy.  Move the pinhole way off to the left, then rotate the thing around the 
> pinhole by 10 degrees, 20 degrees, etc. Overlay them all, and you're done. [*]
> 
> With the new approach, I'm finding this nearly impossible.  The natural 
> approach involves, for instance, putting the thing "beside" a long horizontal 
> space, and then rotating it.  The problem is that it doesn't rotate about a 
> fixed point.  To see the problem, consider this program:
> 
> (require 2htdp/image)
> 
> (define a (beside (rectangle 150 2 "solid" "black") (ellipse 10 50 "solid" 
> "purple")))
> 
> (overlay/places "middle" "middle"
>(rotate  0 a)
>(rotate 20 a)
>(rotate 40 a)
>(rotate 60 a))
> 
> The problem is that mapping a point in the pre-rotation shape to a point in 
> the post-rotation shape is hard.
> 
> ...
> 
> After wrestling with this for quite a while, I have a solution of sorts; you 
> have to overlay the shape you want to rotate on a large outline circle in 
> such a way that the shape is entirely inside the circle. Rotating this shape 
> does not change the bounding box at all, meaning that you can overlay them 
> correctly. Needless to say, computing the size of the circle required is a 
> big pain.
> 
> E.G.:
> 
> (define b (overlay/xy (circle 200 "outline" "blue") 200 200 a))
> 
> (overlay
> (rotate  0 b)
> (rotate 20 b)
> (rotate 40 b)
> (rotate 60 b))
> 
> Am I missing something obvious?
> 
> John
> 
> [*] with the obvious caveat that the old version didn't rotate shapes at all.
> 
> 
> _
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-dev

_
  For list-related administrative tasks:
  http://list.cs.brown.edu/mailman/listinfo/plt-dev


Re: [plt-dev] Re: [plt-scheme] scaling and rotating images using image.ss

2009-11-14 Thread Robby Findler
middle and center are synonymous (and can be used in both horizontal
and vertical directions).

Robby

On Sat, Nov 14, 2009 at 10:42 AM, Matthias Felleisen
 wrote:
>
> This should be
>
> (overlay/places "center" "middle"
>                (rotate  0 a)
>                (rotate 20 a)
>                (rotate 40 a)
>                (rotate 60 a))
>
> not
>
>  .. "middle" "middle" ...
>
> correct?
>
>
> On Nov 14, 2009, at 1:18 AM, John Clements wrote:
>
>>
>> On Sep 26, 2009, at 6:29 AM, Matthias Felleisen wrote:
>>
>>>
>>>
>>> 1. htdp/world is deprecated, use 2htdp/universe instead.
>>>
>>> 2. we consider the pinhole approach to our image library as a mistake. To 
>>> solve the problem Robby is working on 2htdp/image, a replacement for the 
>>> image library. When it comes out (end of semester probably) it will support 
>>> rotate and other such operations, plus comparisons will be much faster.
>>
>> I'm surprised to say it, but right now I'm *really missing the pinhole*.
>>
>> I'm trying to write a function in 2htdp/image that draws, say, 36 copies of 
>> a shape arranged in a big "circle" around a center.  With pinholes, this was 
>> easy.  Move the pinhole way off to the left, then rotate the thing around 
>> the pinhole by 10 degrees, 20 degrees, etc. Overlay them all, and you're 
>> done. [*]
>>
>> With the new approach, I'm finding this nearly impossible.  The natural 
>> approach involves, for instance, putting the thing "beside" a long 
>> horizontal space, and then rotating it.  The problem is that it doesn't 
>> rotate about a fixed point.  To see the problem, consider this program:
>>
>> (require 2htdp/image)
>>
>> (define a (beside (rectangle 150 2 "solid" "black") (ellipse 10 50 "solid" 
>> "purple")))
>>
>> (overlay/places "middle" "middle"
>>                (rotate  0 a)
>>                (rotate 20 a)
>>                (rotate 40 a)
>>                (rotate 60 a))
>>
>> The problem is that mapping a point in the pre-rotation shape to a point in 
>> the post-rotation shape is hard.
>>
>> ...
>>
>> After wrestling with this for quite a while, I have a solution of sorts; you 
>> have to overlay the shape you want to rotate on a large outline circle in 
>> such a way that the shape is entirely inside the circle. Rotating this shape 
>> does not change the bounding box at all, meaning that you can overlay them 
>> correctly. Needless to say, computing the size of the circle required is a 
>> big pain.
>>
>> E.G.:
>>
>> (define b (overlay/xy (circle 200 "outline" "blue") 200 200 a))
>>
>> (overlay
>> (rotate  0 b)
>> (rotate 20 b)
>> (rotate 40 b)
>> (rotate 60 b))
>>
>> Am I missing something obvious?
>>
>> John
>>
>> [*] with the obvious caveat that the old version didn't rotate shapes at all.
>>
>>
>> _
>>  For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-dev
>
>
_
  For list-related administrative tasks:
  http://list.cs.brown.edu/mailman/listinfo/plt-dev


Re: [plt-dev] Re: [plt-scheme] scaling and rotating images using image.ss

2009-11-14 Thread Matthias Felleisen

On Nov 14, 2009, at 11:46 AM, Robby Findler wrote:

> middle and center are synonymous (and can be used in both horizontal
> and vertical directions).


Then consider this a bug report/feature request. Like in HTML, I suggest that 
middle and center work for vertical and horizontal alignment, respectively. -- 
Matthias





> 
> Robby
> 
> On Sat, Nov 14, 2009 at 10:42 AM, Matthias Felleisen
>  wrote:
>> 
>> This should be
>> 
>> (overlay/places "center" "middle"
>>(rotate  0 a)
>>(rotate 20 a)
>>(rotate 40 a)
>>(rotate 60 a))
>> 
>> not
>> 
>>  .. "middle" "middle" ...
>> 
>> correct?
>> 
>> 
>> On Nov 14, 2009, at 1:18 AM, John Clements wrote:
>> 
>>> 
>>> On Sep 26, 2009, at 6:29 AM, Matthias Felleisen wrote:
>>> 
 
 
 1. htdp/world is deprecated, use 2htdp/universe instead.
 
 2. we consider the pinhole approach to our image library as a mistake. To 
 solve the problem Robby is working on 2htdp/image, a replacement for the 
 image library. When it comes out (end of semester probably) it will 
 support rotate and other such operations, plus comparisons will be much 
 faster.
>>> 
>>> I'm surprised to say it, but right now I'm *really missing the pinhole*.
>>> 
>>> I'm trying to write a function in 2htdp/image that draws, say, 36 copies of 
>>> a shape arranged in a big "circle" around a center.  With pinholes, this 
>>> was easy.  Move the pinhole way off to the left, then rotate the thing 
>>> around the pinhole by 10 degrees, 20 degrees, etc. Overlay them all, and 
>>> you're done. [*]
>>> 
>>> With the new approach, I'm finding this nearly impossible.  The natural 
>>> approach involves, for instance, putting the thing "beside" a long 
>>> horizontal space, and then rotating it.  The problem is that it doesn't 
>>> rotate about a fixed point.  To see the problem, consider this program:
>>> 
>>> (require 2htdp/image)
>>> 
>>> (define a (beside (rectangle 150 2 "solid" "black") (ellipse 10 50 "solid" 
>>> "purple")))
>>> 
>>> (overlay/places "middle" "middle"
>>>(rotate  0 a)
>>>(rotate 20 a)
>>>(rotate 40 a)
>>>(rotate 60 a))
>>> 
>>> The problem is that mapping a point in the pre-rotation shape to a point in 
>>> the post-rotation shape is hard.
>>> 
>>> ...
>>> 
>>> After wrestling with this for quite a while, I have a solution of sorts; 
>>> you have to overlay the shape you want to rotate on a large outline circle 
>>> in such a way that the shape is entirely inside the circle. Rotating this 
>>> shape does not change the bounding box at all, meaning that you can overlay 
>>> them correctly. Needless to say, computing the size of the circle required 
>>> is a big pain.
>>> 
>>> E.G.:
>>> 
>>> (define b (overlay/xy (circle 200 "outline" "blue") 200 200 a))
>>> 
>>> (overlay
>>> (rotate  0 b)
>>> (rotate 20 b)
>>> (rotate 40 b)
>>> (rotate 60 b))
>>> 
>>> Am I missing something obvious?
>>> 
>>> John
>>> 
>>> [*] with the obvious caveat that the old version didn't rotate shapes at 
>>> all.
>>> 
>>> 
>>> _
>>>  For list-related administrative tasks:
>>>  http://list.cs.brown.edu/mailman/listinfo/plt-dev
>> 
>> 

_
  For list-related administrative tasks:
  http://list.cs.brown.edu/mailman/listinfo/plt-dev


Re: [plt-dev] Re: [plt-scheme] scaling and rotating images using image.ss

2009-11-14 Thread Carl Eastlund
On Sat, Nov 14, 2009 at 11:49 AM, Matthias Felleisen
 wrote:
>
> On Nov 14, 2009, at 11:46 AM, Robby Findler wrote:
>
>> middle and center are synonymous (and can be used in both horizontal
>> and vertical directions).
>
>
> Then consider this a bug report/feature request. Like in HTML, I suggest that 
> middle and center work for vertical and horizontal alignment, respectively. 
> -- Matthias

UGH!  I vote for the "synonymous" version.  Why should users --
especially students -- have to remember which is which?  Especially
when the words mean the same thing.

--Carl
_
  For list-related administrative tasks:
  http://list.cs.brown.edu/mailman/listinfo/plt-dev


Re: [plt-dev] Re: [plt-scheme] scaling and rotating images using image.ss

2009-11-14 Thread Robby Findler
On Sat, Nov 14, 2009 at 10:49 AM, Matthias Felleisen
 wrote:
>
> On Nov 14, 2009, at 11:46 AM, Robby Findler wrote:
>
>> middle and center are synonymous (and can be used in both horizontal
>> and vertical directions).
>
>
> Then consider this a bug report/feature request. Like in HTML, I suggest that 
> middle and center work for vertical and horizontal alignment, respectively. 
> -- Matthias
>

They do work for vertical and horizontal alignment. You want errors?

Robby
_
  For list-related administrative tasks:
  http://list.cs.brown.edu/mailman/listinfo/plt-dev


Re: [plt-dev] Re: [plt-scheme] scaling and rotating images using image.ss

2009-11-14 Thread Matthias Felleisen

On Nov 14, 2009, at 11:55 AM, Robby Findler wrote:

> On Sat, Nov 14, 2009 at 10:49 AM, Matthias Felleisen
>  wrote:
>> 
>> On Nov 14, 2009, at 11:46 AM, Robby Findler wrote:
>> 
>>> middle and center are synonymous (and can be used in both horizontal
>>> and vertical directions).
>> 
>> 
>> Then consider this a bug report/feature request. Like in HTML, I suggest 
>> that middle and center work for vertical and horizontal alignment, 
>> respectively. -- Matthias
>> 
> 
> They do work for vertical and horizontal alignment. You want errors?

Yes I thought we wanted errors but Carl's probably right. Why should we care 
about HTML and the people who teach HTML. 
_
  For list-related administrative tasks:
  http://list.cs.brown.edu/mailman/listinfo/plt-dev