swarm-support
[Top][All Lists]
Advanced

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

Re: [Swarm-Support] Re:model


From: Marcus G. Daniels
Subject: Re: [Swarm-Support] Re:model
Date: Sun, 02 Sep 2007 10:44:26 -0600
User-agent: Thunderbird 1.5.0.12 (X11/20070719)

yuefengch wrote:
In my model I want to develop a 3 dimension continous space(don't consider display).
A simple way is decide how continuous it really needs to be, and then make integers big enough to encode that. If you want resolution of 0.001 units then multiply everything by 1000. Then make a C array like this:

id space[(MAX_X - MIN_X)* 1000][(MAX_Y - MIN_Y) * 1000][(MAX_Z - MIN_Z)* 10000];


Then when you access `space' you'll need to do an add and multiply from each x/y/z value and also do some bound checking. A problem with this is that if you need much resolution or much range, you can run out of memory.

Another way to approach the problem, basically what Scott Christley said, is to encod coordinates in agents and use queries to relate where agents are relative to one another. Concretely, that could be done using a C interface to a database like http://postgis.refractions.net, which has 3d as well as 2d geometries.

Marcus


reply via email to

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