September 2006


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
Uwe Grueters <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Sat, 16 Sep 2006 19:38:46 -0400
text/plain (37 lines)
Dear all, 

I am completely new to this list and to MASON. 

I intend to develop a model for virtual plants in 3d. Plant attributes 
(height, diameter) are calculated in the simulation and ConePortrayals3D 
for the plants created at runtime shall reflect these attributes. 

I found example code in the Balls3D model that does similar things to a 
SpherePortrayal3D. The BallPortrayal inherits from the SpherePortrayal3D 
and overrides the getModel method of the superclass. The if condition 
becomes true when the TransformGroup passed to the method is null (as in 
the getModel method of the superclass) or when the passed in Object casted 
to Ball has changed its mass. In the statements that are executed in that 
case the SpherePortayal3D scale-variable is multiplied by the BallObject's 
radius, that also has changed. So, there is a dynamic connection of the 
attributes of a ball and its portrayal. 

I tried to follow this scheme by creating a PlantPortrayal that extends 
TransformedPortrayal3D, overriding its getModel method, putting in || 
((Plant)obj).oldDiameter != ((Plant)obj).diameter and trying to change the 
internalTransform using components from the method code for scaling
(double,double,double) and rotatingY in the TransformedPortrayal3D. 

However, when I ran the code with a step method in which the diameter is 
increased by 1 each time step I saw the cone size to increase drametically  
at step 1 and at step 2 the cones seemed to be too large to be displayed.

Has anyone written code to dynamically connect a "TransformedPortrayal3D" 
to attributes of the underlying agent? Is there anyone, who could give me 
some advice in these matters? 

Since this behaviour is such a basic requirement for the model development 
I would greatly appreciate any helpful suggestions. 

Thank you very much in advance, Uwe