-
Notifications
You must be signed in to change notification settings - Fork 99
ThreeD_step3
benoitgaudou edited this page Sep 20, 2021
·
7 revisions
- Mapping the network of connection
In this final step, we will display edges between cells that are within a given distance.
We add a new reflex to collect the neighbors of the cell that are within a certain distance:
species cells skills:[moving3D]{
...
reflex compute_neighbors {
neighbors <- cells select ((each distance_to self) < 10);
}
}
Then we update the cell aspect as follows. For each element (cells) of the neighbors
list, we draw a line between this neighbor's location and the current cell's location.
aspect default {
draw sphere(environment_size*0.01) color: #orange;
loop pp over: neighbors {
draw line([self.location,pp.location]);
}
}
The GIT version of the model can be found here Model 03.gaml
model Tuto3D
global {
int nb_cells <- 100;
int environment_size <- 100;
geometry shape <- cube(environment_size);
init {
create cell number: nb_cells {
location <- {rnd(environment_size), rnd(environment_size), rnd(environment_size)};
}
}
}
species cell skills: [moving3D] {
rgb color;
list<cell> neighbors;
int offset;
reflex move {
do wander;
}
reflex compute_neighbors {
neighbors <- cell select ((each distance_to self) < 10);
}
aspect default {
draw sphere(environment_size * 0.01) color: #orange;
loop pp over: neighbors {
draw line([self.location, pp.location]);
}
}
}
experiment Tuto3D type: gui {
parameter "Initial number of cells: " var: nb_cells min: 1 max: 1000 category: "Cells";
output {
display View1 type: opengl background: rgb(10, 40, 55) {
graphics "env" {
draw cube(environment_size) color: #black wireframe: true;
}
species cell;
}
}
}
- Installation and Launching
- Workspace, Projects and Models
- Editing Models
- Running Experiments
- Running Headless
- Preferences
- Troubleshooting
- Introduction
- Manipulate basic Species
- Global Species
- Defining Advanced Species
- Defining GUI Experiment
- Exploring Models
- Optimizing Model Section
- Multi-Paradigm Modeling
- Manipulate OSM Data
- Diffusion
- Using Database
- Using FIPA ACL
- Using BDI with BEN
- Using Driving Skill
- Manipulate dates
- Manipulate lights
- Using comodel
- Save and restore Simulations
- Using network
- Headless mode
- Using Headless
- Writing Unit Tests
- Ensure model's reproducibility
- Going further with extensions
- Built-in Species
- Built-in Skills
- Built-in Architecture
- Statements
- Data Type
- File Type
- Expressions
- Exhaustive list of GAMA Keywords
- Installing the GIT version
- Developing Extensions
- Introduction to GAMA Java API
- Using GAMA flags
- Creating a release of GAMA
- Documentation generation