swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: raster and aspect ratio


From: John Carnahan
Subject: Re: Re: raster and aspect ratio
Date: Wed, 14 Feb 1996 15:11:23 -0800 (PST)

Nelson and all,

> [first, a general comment. Adding features like this are the *perfect*
> opportunity for people to subclass Swarm library objects. Some people
> out there are doing this now for their own work. I regret that I
> haven't had time to look at what's been done, to see if there are new
> generally useful classes and/or whether new features should be added
> in to the existing classes.]

Actually I already have an object, DrawSpace, which is a subclass of 
ZoomRaster that holds stuff like the scaling for the aspect ratio and 
does the linear transforming for any object that calls it. Its pretty 
cool. I get all of the scaling ratios and centers as an init and all my sim 
objects have to is call one method in DrawSpace and the scaling and 
drawing are done for it.

> Could you change the draw code so that before it draws a mosquito
> ("skeeter", in Texas terminology) it first does the transform, then
> checks for a collision, then doesn't draw the mosquito if it collides
> with the hut?

This would be a piece of cake since all the transforming is done by the 
DrawSpace object. So what I would have to do is have each mosquito loop 
through all the huts and ask them where they would draw themselves after 
the linear transformation.  A mosquito could not just ask the space it 
was on if the hut is there since other huts around it might be 
drawing to the same place. You can see the problem with this since 
looping through all huts, each time a mosquito wants to draw itself, would 
be a bad thing.

> This would be something like a specialized hut-and-mosquito drawing
> class. Not such a bad idea, really, and it fits in with some of my
> newest code that has an object that does nothing but draw agents on
> Raster widgets.

This looks like my best alternative. I could create a instance list of 
sacred window points in DrawSpace when I first draw the huts and each time a 
mosquito wanted to draw itself it could check against this list to see if 
the point on the window is ok to draw on. But the question remains. Is 
this worse than just redrawing the huts every time step? And is this 
worse then checking just before drawing what color is already there?

Thanks,
 
John Carnahan
--Graduate Student. Dept. of Biology UCLA       --
--(310) 206-4079                                --




reply via email to

[Prev in Thread] Current Thread [Next in Thread]