ex09 - Task 1a

Benutzeravatar
olg
Sonntagsinformatiker
Sonntagsinformatiker
Beiträge: 297
Registriert: 1. Okt 2008 19:24

ex09 - Task 1a

Beitrag von olg »

I have a question about the behavior of the circle, as its 'follow' definition is ambiguous.

Should it:
  1. Maintain a distance of 50 points at all times. I.e., it is being pushed away by the mouse like a magnet when being pushed against (see [1])

    or
  2. Follow the pointer to maintain a distance of 50, but do not follow if distance is < 50. This will allow the mouse to move over the circle. (see [2])

Are both implementations within the scope of the requirement?

[1] https://dl.dropboxusercontent.com/u/270758/magnet.mov
[2] https://dl.dropboxusercontent.com/u/270758/follow.mov
"To Perl, or not to Perl, that is the kvetching." ~Larry Wall

Osterlaus
BSc Spammer
BSc Spammer
Beiträge: 1263
Registriert: 23. Aug 2007 12:46
Wohnort: DA

Re: ex09 - Task 1a

Beitrag von Osterlaus »

{nothing to see here}

radio_controlled
BASIC-Programmierer
BASIC-Programmierer
Beiträge: 107
Registriert: 8. Okt 2010 20:31

Re: ex09 - Task 1a

Beitrag von radio_controlled »

There is also the possibility of the circle just maintaining a distance of 50 regardless of the mouse movements, for example the circle is always 50 to the right. Does that fulfill the requirements, too?

Benutzeravatar
olg
Sonntagsinformatiker
Sonntagsinformatiker
Beiträge: 297
Registriert: 1. Okt 2008 19:24

Re: ex09 - Task 1a

Beitrag von olg »

I also noticed the implementation of fillOval is incorrect (at least with respect to its variables).
While it seeems to draw an oval given a center and radius, it is really drawing an oval given its top/left corner, and the diameter of the rectangle to fit the oval within.

If you really want it to be centered on the first parameter, change the method call to:

Code: Alles auswählen

{ g.fillOval(center().x - radius(), center().y - radius(), radius() * 2, radius() * 2) })
and pass it Signal { 10 } as the radius.
"To Perl, or not to Perl, that is the kvetching." ~Larry Wall

salvaneschi
Mausschubser
Mausschubser
Beiträge: 49
Registriert: 29. Mär 2013 23:51

Re: ex09 - Task 1a

Beitrag von salvaneschi »

Hi all,
the solution we had in mind is the one described here as "just maintaining a distance of 50 regardless of the mouse movements, for example the circle is always 50 to the right", which should be the simplest. However, also the others that have been described will be accepted.

Antworten

Zurück zu „Archiv“