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
98430ec3
Commit
98430ec3
authored
Feb 27, 2015
by
Thomas Pitiot
Browse files
Options
Browse Files
Download
Plain Diff
merged
parents
8b3aad18
9daeca4c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
11 deletions
+34
-11
include/env_map.h
include/env_map.h
+1
-0
src/env_map.cpp
src/env_map.cpp
+30
-8
src/needle.cpp
src/needle.cpp
+3
-3
No files found.
include/env_map.h
View file @
98430ec3
...
...
@@ -47,6 +47,7 @@ public:
void
init
(
int
argc
,
char
**
argv
)
;
bool
checkPointInMap
(
VEC3
pos
,
Dart
neighborhood
);
bool
insideVolume
(
VEC3
pos
,
Dart
d
);
REAL
volumeMaxdistance
(
Vol
volume
);
VEC3
normaleFromVolume
(
Dart
volume
,
Dart
face
);
void
open_file
(
std
::
string
filename
);
VEC3
mapMinX
;
...
...
src/env_map.cpp
View file @
98430ec3
...
...
@@ -47,7 +47,6 @@ void EnvMap::init(int argc, char **argv)
int
nb
=
1
;
Algo
::
Volume
::
Tilings
::
Cubic
::
Grid
<
PFP
>
cubic
(
map
,
nb
,
nb
,
nb
);
Algo
::
Volume
::
cubic
.
embedIntoGrid
(
position
,
1.0
f
,
1.0
f
,
1.0
f
);
// subdivideVolume(map.begin());
...
...
@@ -130,14 +129,28 @@ void EnvMap::init(int argc, char **argv)
// std::cout << "level :"<<map.getCurrentLevel() << std::endl ;
}
}
}
REAL
EnvMap
::
volumeMaxdistance
(
Vol
volume
)
{
Dart
d
=
volume
;
VEC3
center
=
Algo
::
Surface
::
Geometry
::
volumeCentroid
<
PFP
,
VertexAttribute
<
VEC3
,
MAP
>>
(
map
,
volume
,
position
);
REAL
res
=
(
position
[
d
]
-
center
).
norm2
();
for
(
Vertex
vert
:
verticesIncidentToVolume3
(
map
,
volume
))
{
REAL
size
=
(
position
[
vert
]
-
center
).
norm2
();
if
(
size
>
res
)
{
res
=
size
;
}
}
return
res
;
}
VEC3
EnvMap
::
normaleFromVolume
(
Dart
volume
,
Dart
face
)
// renvoie la normale a la face pointant vers l'extérieur du volume
{
VEC3
center
=
Algo
::
Surface
::
Geometry
::
volumeCentroid
<
PFP
,
VertexAttribute
<
VEC3
,
MAP
>>
(
map
,
volume
,
position
);
...
...
@@ -538,14 +551,19 @@ bool EnvMap::subdivideVolume(Dart dglobal)
map
.
setCurrentLevel
(
map
.
getMaxLevel
())
;
unsigned
int
vLevel
=
map
.
volumeLevel
(
dglobal
);
Dart
old
=
map
.
volumeOldestDart
(
dglobal
);
#ifdef DEBUG_affichage
int
count
=
0
;
#endif
// 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, true);
// for(Dart dit = traF.begin(); dit != traF.end(); dit = traF.next())
// {
for
(
Face
dit
:
facesIncidentToVolume3
(
map
,
old
))
{
#ifdef DEBUG_affichage
count
++
;
#endif
Dart
nv
=
map
.
phi3
(
dit
);
if
(
!
map
.
isBoundaryMarked
(
3
,
nv
))
{
...
...
@@ -554,18 +572,22 @@ bool EnvMap::subdivideVolume(Dart dglobal)
#ifdef DEBUG_affichage
std
::
cout
<<
"OK pour cascade en : "
<<
nv
<<
std
::
endl
;
#endif
int
currentLevel
=
map
.
getCurrentLevel
();
subdivideVolume
(
nv
);
map
.
setCurrentLevel
(
currentLevel
);
}
}
}
// on commence ensuite a subdiviser
// map.check();
map
.
setCurrentLevel
(
map
.
getMaxLevel
())
;
#ifdef DEBUG_affichage
CGoGNout
<<
"debut refine"
<<
CGoGNendl
;
std
::
cout
<<
"dglobal = "
<<
dglobal
<<
"level = "
<<
map
.
getDartLevel
(
dglobal
)
<<
std
::
endl
;
std
::
cout
<<
"dglobal = "
<<
dglobal
<<
"level = "
<<
map
.
getDartLevel
(
dglobal
)
<<
" nombre de faces verifiées : "
<<
count
<<
std
::
endl
;
#endif
ARETES
oldobst
(
RegisteredEdges
[
dglobal
])
;
...
...
src/needle.cpp
View file @
98430ec3
...
...
@@ -253,9 +253,9 @@ void Needle::refine()
{
#ifdef IHMap
Dart
volume
=
parts_
[
0
]
->
d
;
volume
=
sim_
->
envMap_
.
map
.
volu0eOldestDart
(
volume
);
PFP
::
VEC3
edge
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
sim_
->
envMap_
.
map
,
volume
,
sim_
->
envMap_
.
position
)
;
if
(
edge
.
norm2
()
>
2.0
f
)
REAL
rayon
=
sim_
->
envMap_
.
volume
Maxdistance
(
volume
)
;
if
(
rayon
>
2.0
f
)
{
if
(
sim_
->
envMap_
.
subdivideVolume
(
volume
))
{
...
...
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