Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Thomas Pitiot
SocialAgents3D
Commits
86512eb7
Commit
86512eb7
authored
Sep 17, 2013
by
pitiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
linear ok
parent
e6def94a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
11 deletions
+21
-11
include/moving_obstacle.h
include/moving_obstacle.h
+1
-1
src/moving_obstacle.cpp
src/moving_obstacle.cpp
+19
-9
src/simulator.cpp
src/simulator.cpp
+1
-1
No files found.
include/moving_obstacle.h
View file @
86512eb7
...
...
@@ -6,7 +6,7 @@
#include "utils.h"
#include "env_map.h"
#include <set>
#define LINEAR
//
#define LINEAR
// #define SECURED
#ifdef LINEAR
#include "ShapeMatching/shapeMatchingLinear.h"
...
...
src/moving_obstacle.cpp
View file @
86512eb7
...
...
@@ -163,7 +163,7 @@ MovingObstacle::MovingObstacle(Simulator* sim, int ind, std::vector<VEC3> pos, s
index_parent
(
indParent
),
gravity_dist
(
0
),
beta
(
0.95
),
alpha
(
0.
2
)
alpha
(
0.
99
)
{
assert
(
pos
.
size
()
>
2
);
...
...
@@ -1096,12 +1096,12 @@ void MovingObstacle::updateForces()
//-------------------------------------------------------------------------
// ARASH : A présent on calcule les interactions avec les autres obstacles.
VEC3
norm
;
double
obst_stiffness
=
2.0
;
// agent-obstacle interaction stiffness
double
obst_stiffness
=
0.5
;
// agent-obstacle interaction stiffness
int
obst_power
=
2
;
// the power to which elevate the agent-obstacle distance
double
obst_radius_infl
,
obst_radius_infl_buildings
;
obst_radius_infl
=
2
0.
;
// scenario 1 et 3
obst_radius_infl
=
3
0.
;
// scenario 1 et 3
obst_radius_infl_buildings
=
50.0
f
;
float
fixed_obst_factor
=
5.0
f
;
...
...
@@ -1110,6 +1110,7 @@ void MovingObstacle::updateForces()
{
PFP
::
VEC3
normFace
=
CGoGN
::
Algo
::
Surface
::
Geometry
::
faceNormal
<
PFP
>
(
sim_
->
envMap_
.
map
,
parts_
[
i
]
->
d
,
sim_
->
envMap_
.
position
);
Dart
dd
=
map
.
phi_1
(
d
);
VEC3
p
=
position
[
dd
]
+
(
velocity
[
dd
]
*
sim_
->
timeStep_
);
// Evitement d'obstacles mobiles
...
...
@@ -1241,26 +1242,35 @@ void MovingObstacle::applyForces()
if
(
!
rigid_
)
{
Dart
d
=
groundFace
;
shape_
->
animate
();
for
(
unsigned
int
i
=
0
;
i
<
nbVertices
;
++
i
)
{
velocity
[
d
]
+=
forces
[
d
]
*
sim_
->
timeStep_
+
(
alpha
/
sim_
->
timeStep_
)
*
(
shape_
->
goal
[
d
]
-
position
[
d
])
;
velocity
[
map
.
phi_1
(
map
.
phi2
(
d
))]
+=
forces
[
d
]
*
sim_
->
timeStep_
+
(
alpha
/
sim_
->
timeStep_
)
*
(
shape_
->
goal
[
map
.
phi_1
(
map
.
phi2
(
d
))]
-
position
[
map
.
phi_1
(
map
.
phi2
(
d
))]);;
velocity
[
d
]
+=
(
forces
[
d
]
-
0.01
*
velocity
[
d
])
*
sim_
->
timeStep_
;
position
[
d
]
+=
(
velocity
[
d
]
*
sim_
->
timeStep_
);
position
[
map
.
phi_1
(
map
.
phi2
(
d
))]
+=
(
velocity
[
map
.
phi_1
(
map
.
phi2
(
d
))
]
*
sim_
->
timeStep_
);
position
[
map
.
phi_1
(
map
.
phi2
(
d
))]
+=
(
0.5
*
velocity
[
d
]
*
sim_
->
timeStep_
);
// PFP::VEC3 normal = CGoGN::Algo::Surface::Geometry::faceNormal<PFP>(sim_->envMap_.map, parts_[i]->d, sim_->envMap_.position);
// normal *= height;
// position[map.phi_1(map.phi2(d))] = position[d]+normal;
d
=
map
.
phi_1
(
d
);;
}
d
=
groundFace
;
// velocity[centerDart] +=forces[centerDart] * sim_->timeStep_;
// position[centerDart] += (velocity[centerDart] * sim_->timeStep_);
shape_
->
animate
();
for
(
unsigned
int
i
=
0
;
i
<
nbVertices
;
++
i
)
{
position
[
d
]
+=
alpha
*
(
shape_
->
goal
[
d
]
-
position
[
d
]);
position
[
map
.
phi_1
(
map
.
phi2
(
d
))]
+=
alpha
*
(
shape_
->
goal
[
map
.
phi_1
(
map
.
phi2
(
d
))]
-
position
[
map
.
phi_1
(
map
.
phi2
(
d
))]);
// PFP::VEC3 normal = CGoGN::Algo::Surface::Geometry::faceNormal<PFP>(sim_->envMap_.map, parts_[i]->d, sim_->envMap_.position);
// normal *= height;
// position[map.phi_1(map.phi2(d))] = position[d]+normal;
d
=
map
.
phi_1
(
d
);;
}
...
...
src/simulator.cpp
View file @
86512eb7
...
...
@@ -17,7 +17,7 @@ timespec timespec_delta(const timespec& t1, const timespec& t2) {
Simulator
::
Simulator
(
unsigned
int
config
,
unsigned
int
minS
,
unsigned
int
nbAgent
,
unsigned
int
nbObst
,
bool
resolution
)
:
#ifdef TWO_AND_HALF_DIM
timeStep_
(
0.
0
5
f
),
timeStep_
(
0.5
f
),
#else
// timeStep_(config > 2 ? 0.01f : 0.25f),
timeStep_
(
0.01
f
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment