Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Thomas Pitiot
SocialAgents3D
Commits
bc52f045
Commit
bc52f045
authored
Feb 23, 2015
by
Thomas Pitiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changements subdivision, init en gros cube a subdiviser pour les tests de vertexstate des paticules
parent
5c811f0b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
93 additions
and
46 deletions
+93
-46
gmon.out
gmon.out
+0
-0
include/env_map.h
include/env_map.h
+1
-1
src/env_map.cpp
src/env_map.cpp
+62
-17
src/needle.cpp
src/needle.cpp
+4
-2
src/simulator.cpp
src/simulator.cpp
+21
-21
src/viewer.cpp
src/viewer.cpp
+5
-5
No files found.
gmon.out
View file @
bc52f045
No preview for this file type
include/env_map.h
View file @
bc52f045
...
...
@@ -55,7 +55,7 @@ public:
VEC3
mapMaxY
;
VEC3
mapMinZ
;
VEC3
mapMaxZ
;
bool
subdivideVolume
(
Dart
d
);
bool
subdivideVolume
(
Dart
d
);
Dart
getBelongingCell
(
const
PFP
::
VEC3
&
pos
);
...
...
src/env_map.cpp
View file @
bc52f045
...
...
@@ -45,7 +45,7 @@ void EnvMap::init(int argc, char **argv)
int
nb
=
5
;
int
nb
=
1
;
Algo
::
Volume
::
Tilings
::
Cubic
::
Grid
<
PFP
>
cubic
(
map
,
nb
,
nb
,
nb
);
cubic
.
embedIntoGrid
(
position
,
1.0
f
,
1.0
f
,
1.0
f
);
...
...
@@ -527,23 +527,56 @@ void EnvMap::popSegment(Segment* o)
bool
EnvMap
::
subdivideVolume
(
Dart
dglobal
)
{
unsigned
int
max
=
map
.
getMaxLevel
()
;
map
.
setCurrentLevel
(
max
)
;
unsigned
int
vLevel
=
map
.
volumeLevel
(
dglobal
);
Dart
old
=
map
.
volumeOldestDart
(
dglobal
);
// la subdivision ne doit pas mettre plus d'un level de différence entre des cellules adjacentes
// on commence donc par subdiviser les voisins qui ont trop de différence
Traversor3WF
<
typename
PFP
::
MAP
>
traF
(
map
,
old
);
for
(
Dart
dit
=
traF
.
begin
();
dit
!=
traF
.
end
();
dit
=
traF
.
next
())
{
Dart
nv
=
map
.
phi3
(
dit
);
if
(
!
map
.
isBoundaryMarked
(
3
,
nv
))
if
(
map
.
volumeLevel
(
nv
)
==
vLevel
-
1
)
subdivideVolume
(
nv
);
}
// on commence ensuite a subdiviser
bool
res
=
false
;
#ifdef IHMap
CGoGNout
<<
"debut refine"
<<
CGoGNendl
;
unsigned
int
max
=
map
.
getMaxLevel
()
;
map
.
setCurrentLevel
(
max
)
;
#ifdef DEBUG_affichage
std
::
cout
<<
"dglobal = "
<<
dglobal
<<
"level = "
<<
map
.
getDartLevel
(
dglobal
)
<<
std
::
endl
;
#endif
ARETES
oldobst
(
RegisteredEdges
[
dglobal
])
;
for
(
Segment
*
o
:
oldobst
)
{
#ifdef DEBUG_affichage
ArticulatedObject
*
mo
=
o
->
nid
;
CGoGNout
<<
"pop obst inside (index articul , segment ) : "
<<
mo
->
index_articulated
<<
" || "
<<
o
->
index
<<
CGoGNendl
;
#endif
this
->
popSegment
(
o
)
;
}
ARETES
oldNeighborObst
(
RegisteredNeighborEdges
[
dglobal
])
;
for
(
Segment
*
s
:
oldobst
)
this
->
popSegment
(
s
)
;
for
(
Segment
*
s
:
oldNeighborObst
)
this
->
popSegment
(
s
)
;
for
(
Segment
*
o
:
oldNeighborObst
)
{
#ifdef DEBUG_affichage
ArticulatedObject
*
mo
=
o
->
nid
;
CGoGNout
<<
"pop obst voisin (index articul , segment ) : "
<<
mo
->
index_articulated
<<
" || "
<<
o
->
index
<<
CGoGNendl
;
#endif
this
->
popSegment
(
o
)
;
}
#ifdef DEBUG_affichage
CGoGNout
<<
"tests pour subdivision"
<<
CGoGNendl
;
#endif
...
...
@@ -552,32 +585,44 @@ bool EnvMap::subdivideVolume(Dart dglobal)
#ifdef DEBUG_affichage
CGoGNout
<<
"debut subdivision"
<<
CGoGNendl
;
#endif
Algo
::
Volume
::
IHM
::
subdivideVolumeClassic
<
PFP
>
(
map
,
dglobal
,
position
);
Algo
::
Volume
::
IHM
::
subdivideVolumeClassic
<
PFP
>
(
map
,
dglobal
,
position
,
false
);
res
=
true
;
}
map
.
setCurrentLevel
(
map
.
getMaxLevel
())
;
map
.
check
();
#ifdef DEBUG_affichage
std
::
cout
<<
"after level = "
<<
map
.
getMaxLevel
()
<<
std
::
endl
;
#endif
//same for adjacent obstacles // optimiser
for
(
Segment
*
s
:
oldNeighborObst
)
for
(
Segment
*
o
:
oldNeighborObst
)
{
FirstRegistrationSegment
(
s
)
;
#ifdef DEBUG_affichage
ArticulatedObject
*
mo
=
o
->
nid
;
CGoGNout
<<
"reenregistrement obst voisin (index articul , segment ) : "
<<
mo
->
index_articulated
<<
" || "
<<
o
->
index
<<
CGoGNendl
;
#endif
FirstRegistrationSegment
(
o
)
;
}
//same for obstacles contained
for
(
Segment
*
s
:
oldobst
)
for
(
Segment
*
o
:
oldobst
)
{
// CGoGNout<<"reseting Obstacles"<<CGoGNendl;
resetPartSubdiv
(
s
);
FirstRegistrationSegment
(
s
);
#ifdef DEBUG_affichage
ArticulatedObject
*
mo
=
o
->
nid
;
CGoGNout
<<
"reenregistrement obst inside (index articul , segment ) : "
<<
mo
->
index_articulated
<<
" || "
<<
o
->
index
<<
CGoGNendl
;
#endif
resetPartSubdiv
(
o
);
FirstRegistrationSegment
(
o
);
}
CGoGNout
<<
"fin refine"
<<
CGoGNendl
;
CGoGNout
<<
"fin refine principal"
<<
CGoGNendl
;
#endif
return
res
;
...
...
src/needle.cpp
View file @
bc52f045
...
...
@@ -260,10 +260,12 @@ void Needle::refine()
Dart
volume
=
parts_
[
0
]
->
d
;
volume
=
sim_
->
envMap_
.
map
.
volumeOldestDart
(
volume
);
PFP
::
VEC3
edge
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
sim_
->
envMap_
.
map
,
volume
,
sim_
->
envMap_
.
position
)
;
if
(
edge
.
norm2
()
>
1
.0
f
)
if
(
edge
.
norm2
()
>
2
.0
f
)
{
if
(
sim_
->
envMap_
.
subdivideVolume
(
volume
))
refine
();
{
// refine();
}
}
...
...
src/simulator.cpp
View file @
bc52f045
...
...
@@ -55,35 +55,35 @@ void Simulator::initFixedObjects()
p
.
second
=
envMap_
.
getBelongingCell
(
pos
);
startingPoints
.
push_back
(
p
);
//
pos=VEC3(4,-2,3);
//
p.first=pos;
//
p.second=envMap_.getBelongingCell(pos);
//
startingPoints.push_back(p);
pos
=
VEC3
(
4
,
-
2
,
3
);
p
.
first
=
pos
;
p
.
second
=
envMap_
.
getBelongingCell
(
pos
);
startingPoints
.
push_back
(
p
);
//
pos=VEC3(1,-1,1);
//
p.first=pos;
//
p.second=envMap_.getBelongingCell(pos);
//
startingPoints.push_back(p);
pos
=
VEC3
(
1
,
-
1
,
1
);
p
.
first
=
pos
;
p
.
second
=
envMap_
.
getBelongingCell
(
pos
);
startingPoints
.
push_back
(
p
);
//
pos=VEC3(2,-2.5f,0.5f);
//
p.first=pos;
//
p.second=envMap_.getBelongingCell(pos);
//
startingPoints.push_back(p);
pos
=
VEC3
(
2
,
-
2.5
f
,
0.5
f
);
p
.
first
=
pos
;
p
.
second
=
envMap_
.
getBelongingCell
(
pos
);
startingPoints
.
push_back
(
p
);
ind
.
first
=
0
;
ind
.
second
=
1
;
segmentParts
.
push_back
(
ind
);
//
ind.first=2;
//
ind.second=3;
//
segmentParts.push_back(ind);
ind
.
first
=
2
;
ind
.
second
=
3
;
segmentParts
.
push_back
(
ind
);
//
ind.first=0;
//
ind.second=2;
//
segmentParts.push_back(ind);
//
ind.first=0;
//
ind.second=4;
//
segmentParts.push_back(ind);
ind
.
first
=
0
;
ind
.
second
=
2
;
segmentParts
.
push_back
(
ind
);
ind
.
first
=
0
;
ind
.
second
=
4
;
segmentParts
.
push_back
(
ind
);
ArticulatedObject
*
obj
=
new
Tree
(
this
,
startingPoints
,
segmentParts
);
...
...
src/viewer.cpp
View file @
bc52f045
...
...
@@ -311,11 +311,11 @@ void Volusion::cb_redraw()
for
(
auto
particule
:
simul
.
aiguille
->
parts_
)
{
VEC3
p
=
particule
->
getPosition
();
if
(
i
==
0
)
{
m_topo_render
->
overdrawDart
(
particule
->
d
,
15.0
f
,
1.0
f
,
0.5
f
,
1.0
f
);
m_topo_render
->
updateData
(
simul
.
envMap_
.
map
,
simul
.
envMap_
.
position
,
0.8
f
,
0.8
f
,
0.8
f
);
}
//
if(i==0)
//
{
//
m_topo_render->overdrawDart(particule->d,15.0f,1.0f,0.5f,1.0f);
//
m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f);
//
}
data
[
i
]
=
p
;
i
++
;
}
...
...
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