swarm-support
[Top][All Lists]
Advanced

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

Re: [Swarm-Support] display


From: Paul Johnson
Subject: Re: [Swarm-Support] display
Date: Thu, 09 Aug 2007 19:03:12 -0500
User-agent: Thunderbird 2.0.0.5 (X11/20070719)

yuefengch wrote:
>  
> hello,
>   How to display the continuous space in Swarm. Only may Value2dDisplay and 
> Object2dDisplay supply 2 dimension displaying of discrete space?
>   Now I define a space througy double x,y, how to display them?
>   Thank you!
>                   yuefengch
>  
>   
THe screen of a computer is inherently a grid of pixels. Hence the best
you can do is decide how big you want the grid to be on your screen and
then inside the agents, convert the doubles to integers before you do
the drawing on the raster. In my models, I have agents who are on a
double based space, but on the grid display, the discretization is done
with a cast (int), as in

[r drawPointX: [self getCoordinate:space*2] Y:(int) [self
getCoordinate:1+space*2] Color: policyColor];

Although that method does not round up. You can use C library functions
floor() or such.

-- 
Paul E. Johnson                       email: address@hidden
Professor, Political Science          http://pj.freefaculty.org
1541 Lilac Lane, Rm 504                              
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66044-3177           FAX: (785) 864-5700



reply via email to

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