swarm-support
[Top][All Lists]
Advanced

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

Re: SWARM Boids


From: Marcus G. Daniels
Subject: Re: SWARM Boids
Date: 01 Jun 1999 09:23:04 -0700
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.3.10

>>>>> "EW" == Eric Werk <address@hidden> writes:

EW> I would like to make triangular representation of the boids, based
EW> on their size and current heading, but cannot figure out how to
EW> draw (and subsequently erase) a composite graphical object.

It would be nice to have more shapes for a Canvas.

It's not really all that hard to implement.  
There are two steps:

1. Figure out what Tk feature to use.  I think most university libraries
   would have a book on Tcl/Tk.  You can experiment with this
   stuff using the `wish' program.  Here I create canvas and draw a triangle.

$ wish
%  canvas .c -width 400 -height 100
.c
% pack .c
% .c create poly 0 0 0 20 20 0 0 0
1
%   

Incidentall, the other day the question came up about how to draw a
car on a Canvas.

  http://www.santafe.edu/projects/swarm/archive/list-archive.9905/0100.html

The same approach applies here, except instead of `poly', one would 
use `bitmap'.

2. Make a new subclass, of a CanvasItem (or NodeItem), implementing
   a custom `-createItem' method.  The idea is to send `eval:' to 
   `globalTkInterp', with the expressions above, but filling in the
   parameters using printf-style formatting.

Note: in the past, I know that folks have used globalTkInterp directly
in their models.  This is bad because it makes models dependent on the
tkobjc backend of Swarm, something we very much want to phase out.
However, if new features can find their way to the `gui' interface,
that is something we will try to support in any future graphics backend.



                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

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