Skip to content
Snippets Groups Projects
Commit 20526175 authored by Michael Leuschel's avatar Michael Leuschel
Browse files

add a generic n-body VisB visualisation file


using new svg_objects feature (ProB 1.12.x)

Signed-off-by: default avatarMichael Leuschel <leuschel@uni-duesseldorf.de>
parent 64ad2e7e
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ MACHINE MovingParticles3 ...@@ -3,6 +3,7 @@ MACHINE MovingParticles3
INCLUDES MovingParticles PROMOTES Move INCLUDES MovingParticles PROMOTES Move
DEFINITIONS DEFINITIONS
VISB_JSON_FILE == "three_bodies.json"; VISB_JSON_FILE == "three_bodies.json";
NOBJS == 3;
SCALE == 1.25e11; // 100 % in visualisation SCALE == 1.25e11; // 100 % in visualisation
SCALE100 == (SCALE/100.0); SCALE100 == (SCALE/100.0);
SPEED_MULTIPLIER == 1000000.0; SPEED_MULTIPLIER == 1000000.0;
...@@ -16,7 +17,7 @@ DEFINITIONS ...@@ -16,7 +17,7 @@ DEFINITIONS
unit_vec(delta_vec(pos(j),pos(i))))) unit_vec(delta_vec(pos(j),pos(i)))))
) ) ) // acceleration due to gravitation ) ) ) // acceleration due to gravitation
PROPERTIES PROPERTIES
nobjs = 3 & nobjs = NOBJS &
/*@label "mass_values" */ mass = [5.97e24, 1.989e30, 1.989e30] /*@label "mass_values" */ mass = [5.97e24, 1.989e30, 1.989e30]
/*@desc "The mass of the 3 objects" */ /*@desc "The mass of the 3 objects" */
& &
......
...@@ -3,6 +3,7 @@ MACHINE MovingParticles4 ...@@ -3,6 +3,7 @@ MACHINE MovingParticles4
INCLUDES MovingParticles PROMOTES Move INCLUDES MovingParticles PROMOTES Move
DEFINITIONS DEFINITIONS
VISB_JSON_FILE == "four_bodies.json"; VISB_JSON_FILE == "four_bodies.json";
NOBJS == 4;
SCALE == 5.0e10; // 100 % in visualisation SCALE == 5.0e10; // 100 % in visualisation
SCALE100 == (SCALE/100.0); SCALE100 == (SCALE/100.0);
SPEED_MULTIPLIER == 1000000.0; SPEED_MULTIPLIER == 1000000.0;
...@@ -16,7 +17,7 @@ DEFINITIONS ...@@ -16,7 +17,7 @@ DEFINITIONS
unit_vec(delta_vec(pos(j),pos(i))))) unit_vec(delta_vec(pos(j),pos(i)))))
) ) ) // acceleration due to gravitation ) ) ) // acceleration due to gravitation
PROPERTIES PROPERTIES
nobjs = 4 & nobjs = NOBJS &
mass = [3.0e28, 3.0e28, 3.0e28, 3.0e28] mass = [3.0e28, 3.0e28, 3.0e28, 3.0e28]
& &
initial_pos = [ make_vec([-3.5e10,0.0e00]), make_vec([-1.0e10,0.0e00]), initial_pos = [ make_vec([-3.5e10,0.0e00]), make_vec([-1.0e10,0.0e00]),
......
{
"svg": "n_bodies.svg",
"comment": "version which uses new svg object creation",
"svg_objects":[
{
"for":{"from":1,"to":"NOBJS"},
"svg_class":"circle",
"id":"body%0",
"cx":"45",
"cy":"15",
"r":"10",
"stroke":"black",
"stroke-width":"0.5",
"fill":"green"
},
{
"for":{"from":1,"to":"NOBJS"},
"svg_class":"line",
"id":"speed%0",
"x1":"45",
"y1":"15",
"x2":"55",
"y2":"15",
"stroke":"#000",
"stroke-width":"0.3",
"marker-end":"url(#arrowhead)"
},
{
"for":{"from":1,"to":"NOBJS"},
"svg_class":"line",
"id":"gravitation%0",
"x1":"45",
"y1":"15",
"x2":"55",
"y2":"15",
"stroke":"green",
"stroke-width":"0.3",
"marker-end":"url(#endarrow)"
}
],
"items": [
{ "id": "body2",
"attr": "fill",
"optional":"true",
"value": "\"blue\""
},
{ "id": "body3",
"attr": "fill",
"optional":"true",
"value": "\"yellow\""
},
{ "id": "body4",
"attr": "fill",
"optional":"true",
"value": "\"orange\""
},
{
"for": {"from":1, "to":"NOBJS"},
"id": "body%0",
"attr": "cx",
"value" : "pos(%0)(1) / SCALE100"
},
{
"for": {"from":1, "to":"NOBJS"},
"id": "body%0",
"attr": "cy",
"value" : "pos(%0)(2) / SCALE100"
},
{
"for": {"from":1, "to":"NOBJS"},
"id": "body%0",
"attr": "r",
"value" : "2.0+5.0*mass(%0)/MAXMASS"
},
{
"for": {"from":1, "to":"NOBJS"},
"id": "speed%0",
"attr": "x1",
"value" : "pos(%0)(1) / SCALE100"
},
{
"for": {"from":1, "to":"NOBJS"},
"id": "speed%0",
"attr": "y1",
"value" : "pos(%0)(2) / SCALE100"
},
{
"for": {"from":1, "to":"NOBJS"},
"id": "speed%0",
"attr": "x2",
"value" : "(pos(%0)(1)+ SPEED_MULTIPLIER*speed(%0)(1)) / SCALE100"
},
{
"for": {"from":1, "to":"NOBJS"},
"id": "speed%0",
"attr": "y2",
"value" : "(pos(%0)(2)+ SPEED_MULTIPLIER*speed(%0)(2)) / SCALE100"
},
{
"for": {"from":1, "to":"NOBJS"},
"id": "gravitation%0",
"attr": "x1",
"value" : "pos(%0)(1) / SCALE100"
},
{
"for": {"from":1, "to":"NOBJS"},
"id": "gravitation%0",
"attr": "y1",
"value" : "pos(%0)(2) / SCALE100"
},
{
"for": {"from":1, "to":"NOBJS"},
"id": "gravitation%0",
"attr": "x2",
"value" : "(pos(%0)(1)+ GRAV_MULTIPLIER*gravitation(%0)(1)) / SCALE100"
},
{
"for": {"from":1, "to":"NOBJS"},
"id": "gravitation%0",
"attr": "y2",
"value" : "(pos(%0)(2)+ GRAV_MULTIPLIER*gravitation(%0)(2)) / SCALE100"
}
],
"events": [
{
"for": {"from":1, "to":"NOBJS"},
"id": "body%0",
"event": "Move",
"hovers": [{ "attr":"stroke-width", "enter":"6", "leave":"1"},
{ "attr":"opacity", "enter":"0.8", "leave":"1.0"}]
}
]
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment