June 2012


Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Joaquin Zabalo <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Wed, 20 Jun 2012 13:41:03 -0400
text/plain (57 lines)

Thanks for the quick response to my question. I now have a follow-up
question. I guess I should first explain what I am trying to do. I am using
a continuous field (e.g. Continuous2D(1.0,100,100))  for both predators the
prey. Each predator point represents a single predator. However, I am
assuming that each prey point represents a super-individual, such as a large
school of fish. Therefore, I am treating each prey point as the center of a
school of fish, which will be represented by a disk in the visualization. So
each large disk OvalPortrayal2D(6) represents a school of prey and each
small disk OvalPortrayal2D() represents a single predator. However, I would
like the size (width) of the OvalPortrayal2D to reflect the actual size of
the school, if possible.

The idea is that while the predator (small disk) is inside the school (large
disk), the number of fish in the school will decrease due to predation. In
the visualization, I can represent this decrease in the number of fish
either by making the large disk more transparent or by making the large disk
shrink. However, the predator (small disk) needs to determine if it is
inside one or more schools of prey (large disks) so that it can choose one
at random and feed while inside the school. I am accomplishing this by
obtaining a bag of all the schools in which the predator is closer to the
center of the school than the radius of the school. For instance, if the
school has diameter 6 (and hence radius 3), then the predator would have to
be within 3 units from the center of the school in order to be inside the
school. In the predatorís code I have:

Bag bag = baysim.fishSpace.getObjectsExactlyWithinDistance(myNewLoc, 3);

where myNewLoc  is the location of the predator and 3 is the radius of the
school OvalPortrayal2D(6).

I think this accomplishes the same thing as what you suggested:

Disk A overlaps with disk B if (A.X - B.X) * (A.X - B. X) + (A.Y - B.Y) *
(A.Y - B.Y) <= (A.R + B.R) * (A.R + B.R)

Am I correct in that assumption? 

You also mentioned that:

The width [and correspondingly height] of the portrayed disk is defined as
1.0 * W * S + O, where W is the scaling factor of the underlying field, S is
the "scale" value of the OvalPortrayal2D (in your example, it's the "6"),
and O is an additional offset in pixels.  The W changes as the user zooms in
and out, that's handled automatically for you.

How can I display a disk whose size (width) represents the actual size of
the school? Does a scale value of S=6 of the OvalPortrayal2D(6) mean that
the displayed disk will have a width of 6 times the default width of
OvalPortrayal2D()? If so, what is the default width if no scale value is
set, as in OvalPortrayal2D()? Also, what is the additional offset in pixels O?

Thanks for all your help.