Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
David Cazier
CGoGN
Commits
23f9b57f
Commit
23f9b57f
authored
Aug 30, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add clear function to ihm3 maps
parent
3ad89e99
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
64 deletions
+51
-64
include/Algo/Geometry/inclusion.hpp
include/Algo/Geometry/inclusion.hpp
+31
-64
include/Algo/ImplicitHierarchicalMesh/ihm3.h
include/Algo/ImplicitHierarchicalMesh/ihm3.h
+6
-0
src/Algo/ImplicitHierarchicalMesh/ihm3.cpp
src/Algo/ImplicitHierarchicalMesh/ihm3.cpp
+14
-0
No files found.
include/Algo/Geometry/inclusion.hpp
View file @
23f9b57f
...
@@ -70,17 +70,22 @@ bool isPointInVolume(typename PFP::MAP& map, Dart d, const VertexAttribute<typen
...
@@ -70,17 +70,22 @@ bool isPointInVolume(typename PFP::MAP& map, Dart d, const VertexAttribute<typen
//number of intersection between a ray and the volume must be odd
//number of intersection between a ray and the volume must be odd
int
countInter
=
0
;
int
countInter
=
0
;
int
countInter2
=
0
;
VEC3
dir
(
1.0
f
,
1.0
f
,
1.0
f
);
VEC3
dir
(
0.9
f
,
1.1
f
,
1.3
f
);
VEC3
inter
;
std
::
vector
<
VEC3
>
interPrec
;
std
::
vector
<
VEC3
>
interPrec
;
interPrec
.
reserve
(
16
);
interPrec
.
reserve
(
16
);
std
::
vector
<
Dart
>
visitedFaces
;
// Faces that are traversed
Traversor3WF
<
typename
PFP
::
MAP
>
trav
(
map
,
d
);
visitedFaces
.
reserve
(
64
);
for
(
Dart
e
=
trav
.
begin
();
e
!=
trav
.
end
();
e
=
trav
.
next
())
visitedFaces
.
push_back
(
d
);
// Start with the face of d
DartMarkerStore
mark
(
map
);
mark
.
markOrbit
<
FACE
>
(
d
)
;
for
(
unsigned
int
iface
=
0
;
iface
!=
visitedFaces
.
size
();
++
iface
)
{
{
Dart
e
=
visitedFaces
[
iface
];
VEC3
inter
;
bool
interRes
=
Algo
::
Geometry
::
intersectionLineConvexFace
<
PFP
>
(
map
,
e
,
position
,
point
,
dir
,
inter
);
bool
interRes
=
Algo
::
Geometry
::
intersectionLineConvexFace
<
PFP
>
(
map
,
e
,
position
,
point
,
dir
,
inter
);
if
(
interRes
&&
(
dir
*
(
inter
-
point
))
>=
0.0
f
)
if
(
interRes
)
{
{
// check if already intersect on same point (a vertex certainly)
// check if already intersect on same point (a vertex certainly)
bool
alreadyfound
=
false
;
bool
alreadyfound
=
false
;
...
@@ -92,69 +97,31 @@ bool isPointInVolume(typename PFP::MAP& map, Dart d, const VertexAttribute<typen
...
@@ -92,69 +97,31 @@ bool isPointInVolume(typename PFP::MAP& map, Dart d, const VertexAttribute<typen
if
(
!
alreadyfound
)
if
(
!
alreadyfound
)
{
{
++
countInter
;
float
v
=
dir
*
(
inter
-
point
);
if
(
v
>
0
)
++
countInter
;
if
(
v
<
0
)
++
countInter2
;
interPrec
.
push_back
(
inter
);
interPrec
.
push_back
(
inter
);
}
}
}
}
// add all face neighbours to the table
Dart
currentFace
=
e
;
do
{
Dart
ee
=
map
.
phi2
(
e
)
;
if
(
!
mark
.
isMarked
(
ee
))
// not already marked
{
visitedFaces
.
push_back
(
ee
)
;
mark
.
markOrbit
<
FACE
>
(
ee
)
;
}
e
=
map
.
phi1
(
e
)
;
}
while
(
e
!=
currentFace
)
;
}
}
//if the point is in the volume there is an odd number of intersection with all faces with any direction
//if the point is in the volume there is an odd number of intersection with all faces with any direction
return
(
countInter
%
2
)
==
1
;
return
((
countInter
%
2
)
!=
0
)
&&
((
countInter2
%
2
)
!=
0
);
// return (countInter % 2) == 1;
// if(isConvex<PFP>(map,d)) {
// CGoGNout << "optimize point in volume" << CGoGNendl;
// }
//
// std::list<Dart> visitedFaces; // Faces that are traversed
// visitedFaces.push_back(d); // Start with the face of d
// std::list<Dart>::iterator face;
// VEC3 dir(0.5f,0.5f,0.5f);
// VEC3 inter;
// std::vector<VEC3> interPrec;
//
// DartMarkerStore mark(map); // Lock a marker
// // For every face added to the list
// // search the number of faces intersected by a ray whose origin is the tested point
// for (face = visitedFaces.begin(); face != visitedFaces.end(); ++face)
// {
// if (!mark.isMarked(*face)) // Face has not been visited yet
// {
// bool alreadyfound = false;
// bool interRes = Algo::Geometry::intersectionLineConvexFace<PFP>(map, *face, position, point, dir, inter);
// if(interRes && (dir * (inter-point)) >= 0.0f)
// {
// if(interPrec.size() > 0)
// {
// for(typename std::vector<VEC3>::iterator it = interPrec.begin(); !alreadyfound && it != interPrec.end(); ++it)
// {
// if (Geom::arePointsEquals(*it,inter))
//// if((*it)[0] == inter[0])
// alreadyfound = true;
// }
// }
// if(!alreadyfound)
// {
// ++countInter;
// interPrec.push_back(inter);
// }
//
// // add non visited adjacent faces to the list of face
// Dart dNext = *face ;
// do
// {
// mark.mark(dNext); // Mark
// Dart adj = map.phi2(dNext); // Get adjacent face
// if (adj != dNext && !mark.isMarked(adj))
// visitedFaces.push_back(adj); // Add it
// dNext = map.phi1(dNext) ;
// } while(dNext != *face) ;
// }
// }
// }
//
// //if the point is in the volume there is an odd number of intersection with all faces with any direction
// return (countInter % 2) == 1;
}
}
template
<
typename
PFP
>
template
<
typename
PFP
>
...
...
include/Algo/ImplicitHierarchicalMesh/ihm3.h
View file @
23f9b57f
...
@@ -78,6 +78,12 @@ public:
...
@@ -78,6 +78,12 @@ public:
*/
*/
void
init
()
;
void
init
()
;
/**
* clear the map
* @param remove attrib remove attribute (not only clear the content)
*/
void
clear
(
bool
removeAttrib
);
/*! @name Attributes Management
/*! @name Attributes Management
* To handles Attributes for each level of an implicit 3-map
* To handles Attributes for each level of an implicit 3-map
*************************************************************************/
*************************************************************************/
...
...
src/Algo/ImplicitHierarchicalMesh/ihm3.cpp
View file @
23f9b57f
...
@@ -53,6 +53,20 @@ ImplicitHierarchicalMap3::~ImplicitHierarchicalMap3()
...
@@ -53,6 +53,20 @@ ImplicitHierarchicalMap3::~ImplicitHierarchicalMap3()
removeAttribute
(
m_dartLevel
)
;
removeAttribute
(
m_dartLevel
)
;
}
}
void
ImplicitHierarchicalMap3
::
clear
(
bool
removeAttrib
)
{
Map3
::
clear
(
removeAttrib
)
;
if
(
removeAttrib
)
{
m_dartLevel
=
Map3
::
addAttribute
<
unsigned
int
,
DART
>
(
"dartLevel"
)
;
m_faceId
=
Map3
::
addAttribute
<
unsigned
int
,
DART
>
(
"faceId"
)
;
m_edgeId
=
Map3
::
addAttribute
<
unsigned
int
,
DART
>
(
"edgeId"
)
;
for
(
unsigned
int
i
=
0
;
i
<
NB_ORBITS
;
++
i
)
m_nextLevelCell
[
i
]
=
NULL
;
}
}
void
ImplicitHierarchicalMap3
::
init
()
void
ImplicitHierarchicalMap3
::
init
()
{
{
initEdgeId
()
;
initEdgeId
()
;
...
...
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