Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve library models #173

Merged
merged 6 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions gama.core/tests/Spatial Tests/models/Relation.experiment
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,18 @@ experiment RelationTests type: test {
the_path <- (cell where (each.color != #pink)) path_between (dummy(9), dummy(8));
assert the_path.weight = 12;
ask world{the_path <- (cell where (each.color != #pink)) path_between([dummy(9), dummy(8), dummy(1)]);}
assert the_path.weight = 22;

assert the_path.weight = 23;

//path_between on a grid with weighted cells
the_path <- (cell as_map (each::(each.color = #pink ? 10.0 : 2.0))) path_between ([dummy(9)]);
assert the_path.weight= 0;
the_path <- (cell as_map (each::(each.color = #pink ? 10.0 : 2.0))) path_between ([dummy(9), dummy(8)]);
assert the_path.weight= 24;
assert the_path.weight= 8;
the_path <- (cell as_map (each::(each.color = #pink ? 10.0 : 2.0))) path_between (dummy(9), dummy(8));
assert the_path.weight= 24;
assert the_path.weight= 8;
ask world{the_path <- (cell as_map (each::(each.color = #pink ? 10.0 : 2.0))) path_between([dummy(9), dummy(8), dummy(1)]);}
assert the_path.weight = 46;
assert the_path.weight = 19;
}

test "towards" {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* Name: QuadraticLinearandConstantatenuation
* Based on the internal empty template.
* Author: baptiste
* Tags:
*/


model QuadraticLinearandConstantattenuation


global {

init {
create GAMAGeometry2D number: 1 {
location <- {world.shape.width / 2, world.shape.height / 2, 0};
}

}

}

species GAMAGeometry2D {

aspect default {
draw sphere(10) at: location color: #white border: #gray;
}

}



experiment Display type: gui autorun: true {
float minimum_cycle_duration <- 0.01;
float quad;
float constant;
float linear;
int angle;
int height;
int distance;
parameter "Spot light angle" var:angle <- 0 min:0 max:360 slider:true category:"Spot light location";
parameter "Spot light height" var:height <- 0 min:-30 max:30 slider:true category:"Spot light location";
parameter "Spot light distance from ball" var:distance <- 10 min:2 max:30 slider:true category:"Spot light location";
parameter "Quadratic attenuation" var:quad <- 0.0001 min:0.0000001 max:0.001 slider:true category:"Light attenuation";
parameter "Linear attenuation" var:linear <- 0.001 min:0.0000001 max:0.1 slider:true category:"Light attenuation";
parameter "Constant attenuation" var:constant <- 0.1 min:0.0000001 max:9.0 slider:true category:"Light attenuation";

output {
layout #split;
// display using spot lights
// we set the ambient light to 0 to see better the directional lights (as if we were at night time)
display SpotLights type: 3d background: rgb(10, 40, 55) {

camera 'default' location: {-87.5648,126.2534,134.3343} target: {50.0,50.0,0.0};
light #ambient intensity: 0;
light #default intensity: 0;
light "1"
type: #spot
location: {(world.shape.width/2 + distance) * cos(angle) + world.shape.width/2, (world.shape.height/2 + distance) * sin(angle) + world.shape.height / 2, height}
direction:{cos(angle + 180), sin(angle + 180), 0}
intensity: #red
show: true
linear_attenuation:linear
constant_attenuation:constant
quadratic_attenuation: quad
dynamic: true;

species GAMAGeometry2D;
}
}
}

Loading