Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas Pitiot
SocialAgents3D
Commits
90052d0d
Commit
90052d0d
authored
Jan 14, 2013
by
Thomas Jund
Browse files
mode secure, integration fction pierre, ajout d'affichage
parent
6759c015
Changes
12
Hide whitespace changes
Inline
Side-by-side
include/agent.h
View file @
90052d0d
...
...
@@ -6,7 +6,14 @@
#include
"utils.h"
#include
"env_map.h"
#include
"spatialHashing.h"
#include
"Algo/MovingObjects/particle_cell_2D.h"
#define SECURED
#ifdef SECURED
#include
"Algo/MovingObjects/particle_cell_2D_secured.h"
#else
#include
"Algo/MovingObjects/particle_cell_2D.h"
#endif
class
Simulator
;
...
...
@@ -46,7 +53,11 @@ public:
#ifdef SPATIAL_HASHING
VEC3
pos
;
#else
CGoGN
::
Algo
::
MovingObjects
::
ParticleCell2D
<
PFP
>
part_
;
#ifdef SECURED
CGoGN
::
Algo
::
MovingObjects
::
ParticleCell2DSecured
<
PFP
>
part_
;
#else
CGoGN
::
Algo
::
MovingObjects
::
ParticleCell2D
<
PFP
>
part_
;
#endif
#endif
unsigned
int
curGoal_
;
...
...
include/env_render.h
View file @
90052d0d
...
...
@@ -57,11 +57,11 @@ inline void renderObstacle(EnvMap& m, MovingObstacle * obst, bool showBelonging=
}
glEnd
()
;
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_LINE
)
;
glColor3f
(
0
,
1
,
0
);
Algo
::
Render
::
GL1
::
renderTriQuadPoly
<
PFP
>
(
obst
->
map
,
Algo
::
Render
::
GL1
::
LINE
,
1
.
0
,
obst
->
position
,
obst
->
normal
)
;
//
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) ;
//
glColor3f(0,1,0);
//
Algo::Render::GL1::renderTriQuadPoly<PFP>(obst->map, Algo::Render::GL1::LINE,
//
1.0, obst->position,
//
obst->normal) ;
if
(
showVertices
)
{
...
...
include/moving_obstacle.h
View file @
90052d0d
...
...
@@ -39,6 +39,7 @@ public:
void
updateMesh
();
unsigned
int
nbVertices
;
CGoGN
::
Algo
::
MovingObjects
::
ParticleCell2DMemo
<
PFP
>
*
registering_part
;
// std::vector<PFP::VEC3> vertices;
...
...
include/socialAgents.ui
View file @
90052d0d
...
...
@@ -129,6 +129,19 @@
<item>
<widget
class=
"QSpinBox"
name=
"check_slide"
/>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"check_pos"
>
<property
name=
"text"
>
<string>
Draw X line
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QSpinBox"
name=
"check_x_val"
/>
</item>
<item>
<widget
class=
"QSpinBox"
name=
"check_y_val"
/>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"check_elipse"
>
<property
name=
"text"
>
...
...
include/viewer.h
View file @
90052d0d
...
...
@@ -103,8 +103,11 @@ public:
bool
drawObstPredictionTri
;
bool
drawObstPath
;
bool
draw_dart
;
bool
draw_posX
;
bool
draw_elipse
;
unsigned
int
dartSlider
;
int
posXSlider
;
int
posYSlider
;
public
slots
:
void
animate
()
;
...
...
@@ -183,9 +186,24 @@ public slots:
dartSlider
=
i
;
updateGL
();
}
void
slot_posX
(
bool
b
)
{
draw_posX
=
b
;
updateGL
()
;
}
void
slot_slide2
(
int
i
)
{
posXSlider
=
i
;
updateGL
();
}
void
slot_slide3
(
int
i
)
{
posYSlider
=
i
;
updateGL
();
}
void
slot_elipse
(
bool
b
)
{
draw_elipse
=
b
;
updateGL
();
}
{
draw_elipse
=
b
;
updateGL
();
}
}
;
src/agent.cpp
View file @
90052d0d
...
...
@@ -326,6 +326,11 @@ void Agent::update()
#else
VEC3
target
=
part_
.
getPosition
()
+
(
velocity_
*
sim_
->
timeStep_
)
;
part_
.
move
(
target
)
;
#ifdef SECURED
if
(
target
!=
part_
.
getPosition
())
std
::
cout
<<
"Problem agent "
<<
agentNo
<<
" (position : "
<<
part_
.
getPosition
()
<<
") time "
<<
sim_
->
globalTime_
<<
std
::
endl
;
#endif
#endif
meanDirection_
.
set
(
0
)
;
...
...
src/moving_mesh.cpp
View file @
90052d0d
...
...
@@ -16,7 +16,7 @@ constrainedV(map)
normal
=
map
.
addAttribute
<
VEC3
,
VERTEX
>
(
"normal"
);
float
area
=
Algo
::
Geometry
::
convexFaceArea
<
PFP
>
(
envMap
.
map
,
d
,
envMap
.
position
);
scaleValue
=
std
::
m
in
(
area
/
1400.0
f
,
10
0
.0
f
);
scaleValue
=
std
::
m
ax
(
area
/
1400.0
f
,
10.0
f
);
std
::
cout
<<
"scaleVal "
<<
scaleValue
<<
std
::
endl
;
// scaleValue = 4.0f;
scale
(
scaleValue
);
...
...
src/moving_obstacle.cpp
View file @
90052d0d
...
...
@@ -427,11 +427,11 @@ void MovingObstacle::update()
VEC3
v1
=
(
position
[
map
.
phi1
(
dd
)]
-
position
[
dd
]);
//inertie
velocity
[
dd
]
=
velocity
[
dd
]
*
0.99
5
f
;
velocity
[
dd
]
=
velocity
[
dd
]
*
0.99
f
;
//stretch spring : /!\ max rigidity relative to the timestep used (unstable otherwise)
float
norm
=
v1
.
norm
();
float
rigidity
=
1
0.0
f
;
float
rigidity
=
3
0.0
f
;
float
stretch
=
rigidity
*
(
edgeLength
[
dd
]
-
v1
.
norm
());
VEC3
f
=
stretch
*
(
v1
/
norm
)
*
sim_
->
timeStep_
;
...
...
src/simulator.cpp
View file @
90052d0d
...
...
@@ -687,7 +687,7 @@ void Simulator::addMovingObstacle(Dart d, unsigned int obstType)
return
;
}
bool
orientAccordingToFace
=
tru
e
;
bool
orientAccordingToFace
=
fals
e
;
if
(
orientAccordingToFace
)
{
while
(
envMap_
.
pedWayMark
.
isMarked
(
envMap_
.
map
.
phi2
(
d
)))
...
...
src/viewer.cpp
View file @
90052d0d
...
...
@@ -46,6 +46,7 @@ SocialAgents::SocialAgents(unsigned int config, unsigned int minSize, unsigned i
drawObstPredictionTri
(
false
),
drawObstPath
(
false
),
draw_dart
(
false
),
draw_posX
(
false
),
draw_elipse
(
false
)
{
timer
=
new
QTimer
(
this
)
;
...
...
@@ -80,6 +81,9 @@ void SocialAgents::initGUI()
setCallBack
(
dock
.
check_drawObstPath
,
SIGNAL
(
toggled
(
bool
)),
SLOT
(
slot_drawObstPath
(
bool
)))
;
setCallBack
(
dock
.
check_dart
,
SIGNAL
(
toggled
(
bool
)),
SLOT
(
slot_dart
(
bool
)))
;
setCallBack
(
dock
.
check_slide
,
SIGNAL
(
valueChanged
(
int
)),
SLOT
(
slot_slide
(
int
)))
;
setCallBack
(
dock
.
check_pos
,
SIGNAL
(
toggled
(
bool
)),
SLOT
(
slot_posX
(
bool
)))
;
setCallBack
(
dock
.
check_x_val
,
SIGNAL
(
valueChanged
(
int
)),
SLOT
(
slot_slide2
(
int
)))
;
setCallBack
(
dock
.
check_y_val
,
SIGNAL
(
valueChanged
(
int
)),
SLOT
(
slot_slide3
(
int
)))
;
setCallBack
(
dock
.
check_elipse
,
SIGNAL
(
toggled
(
bool
)),
SLOT
(
slot_elipse
(
bool
)))
;
}
...
...
@@ -154,6 +158,8 @@ static void drawEllipse(VEC3 F1, VEC3 F2, float s, int N)
void
SocialAgents
::
cb_redraw
()
{
dock
.
check_slide
->
setRange
(
0
,
simulator
.
envMap_
.
map
.
end
().
index
)
;
dock
.
check_x_val
->
setRange
(
-
10000
,
10000
)
;
dock
.
check_y_val
->
setRange
(
-
10000
,
10000
)
;
glDisable
(
GL_LIGHTING
)
;
...
...
@@ -204,6 +210,20 @@ void SocialAgents::cb_redraw()
}
}
if
(
draw_posX
)
{
glColor3f
(
1.0
f
,
1.0
f
,
0.0
f
)
;
glLineWidth
(
5.0
f
)
;
glBegin
(
GL_LINES
);
glVertex3f
(
posXSlider
,
-
10000
,
0
);
glVertex3f
(
posXSlider
,
10000
,
0
);
glEnd
();
glBegin
(
GL_LINES
);
glVertex3f
(
-
10000
,
posYSlider
,
0
);
glVertex3f
(
10000
,
posYSlider
,
0
);
glEnd
();
}
if
(
drawAgents
)
{
for
(
std
::
vector
<
Agent
*>::
iterator
it
=
simulator
.
agents_
.
begin
()
;
it
!=
simulator
.
agents_
.
end
()
;
++
it
)
...
...
svg/mapCleaned.svg
View file @
90052d0d
...
...
@@ -12,7 +12,7 @@
viewBox="0 0 1310 1173"
version="1.1"
id="svg2"
inkscape:version="0.48.1 r9
760
"
inkscape:version="0.48.
3.
1 r9
886
"
sodipodi:docname="mapCleaned.svg">
<metadata
id="metadata20589">
...
...
@@ -36,16 +36,17 @@
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1680"
inkscape:window-height="
102
1"
inkscape:window-height="
99
1"
id="namedview20587"
showgrid="false"
inkscape:zoom="
2.5600001
"
inkscape:cx="
1270.501
6"
inkscape:cy="
245.44341
"
inkscape:window-x="0"
inkscape:window-y="
0
"
inkscape:zoom="
1.8101934
"
inkscape:cx="
531.3716
6"
inkscape:cy="
904.14257
"
inkscape:window-x="
192
0"
inkscape:window-y="
27
"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
inkscape:current-layer="svg2"
inkscape:object-nodes="true" />
<defs
id="defs4">
<g
...
...
@@ -14935,10 +14936,11 @@
id="path6187"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#bababa;stroke-width:5.
6
;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;
color:#000000;
stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="
M
164.61719,501.41016 18
3.33594,518.38281 273.75,433.17187
"
style="
color:#000000;
fill:none;stroke:#bababa;stroke-width:5.
5999999
;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="
m
164.61719,501.41016 18
.71875,16.97265 87.04687,-88.47265
"
id="path6189"
inkscape:connector-curvature="0" />
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
<path
style="fill:none;stroke:#bababa;stroke-width:5.6;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;color:#000000;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="M 1268.3555,154.52344 1304.9531,51.203125"
...
...
@@ -14980,10 +14982,11 @@
id="path6241"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#bababa;stroke-width:5.
6
;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;
color:#000000;
stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
style="
color:#000000;
fill:none;stroke:#bababa;stroke-width:5.
5999999
;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 87.691406,194.32031 9.246094,11.60938 31.62109,40.65625 6.6211,8.83984 73.02343,98.10156 13.625,20.03125 30.5586,37.90625 17.99609,18.44532 3.36719,3.26171"
id="path6243"
inkscape:connector-curvature="0" />
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccc" />
<path
style="fill:none;stroke:#bababa;stroke-width:5.6;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;color:#000000;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 101.39063,554.23437 63.22656,-52.82421"
svg/mapRoads.svg
View file @
90052d0d
...
...
@@ -12,7 +12,7 @@
viewBox="0 0 1310 1173"
version="1.1"
id="svg2"
inkscape:version="0.48.1 r9
760
"
inkscape:version="0.48.
3.
1 r9
886
"
sodipodi:docname="mapRoads.svg">
<metadata
id="metadata20589">
...
...
@@ -36,14 +36,14 @@
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1680"
inkscape:window-height="
102
1"
inkscape:window-height="
99
1"
id="namedview20587"
showgrid="false"
inkscape:zoom="
0.45254835
"
inkscape:cx="
444.14566
"
inkscape:cy="
746.80007
"
inkscape:window-x="0"
inkscape:window-y="
0
"
inkscape:zoom="
7.2407736
"
inkscape:cx="
340.96034
"
inkscape:cy="
899.38878
"
inkscape:window-x="
192
0"
inkscape:window-y="
27
"
inkscape:window-maximized="1"
inkscape:current-layer="svg2"
inkscape:object-nodes="true"
...
...
@@ -18639,9 +18639,10 @@
inkscape:connector-curvature="0" />
<path
style="color:#000000;fill:none;stroke:#bababa;stroke-width:5.5999999;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 164.61719,501.41007 18.71875,16.9726
90.41406,-85.2109
"
d="m 164.61719,501.41007 18.71875,16.9726
87.04687,-88.4726
"
id="path6189"
inkscape:connector-curvature="0" />
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
<path
style="color:#000000;fill:none;stroke:#bababa;stroke-width:5.5999999;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 181.64453,906.33588 -7.44141,7.3593 -19.21093,18.2969 -23.32813,19.41019 -23.76562,6.9609 -24.480471,7.6094 -15.117188,4.2226"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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