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
Hurstel
CGoGN
Commits
82d8876f
Commit
82d8876f
authored
Dec 14, 2011
by
Sylvain Thery
Browse files
ajout fonction compact dans generic_map
+ test_compact dans Test
parent
639d734d
Changes
20
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/Tests/CMakeLists.txt
View file @
82d8876f
...
...
@@ -35,6 +35,10 @@ add_executable( Geom_intersectionD ./Geom_intersection.cpp)
target_link_libraries
(
Geom_intersectionD
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
add_executable
(
test_compactD ./test_compact.cpp
)
target_link_libraries
(
test_compactD
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
IF
(
WITH_QT
)
QT4_WRAP_CPP
(
concave_rendering_moc concave_rendering.h
)
...
...
Apps/Examples/clipping.cpp
View file @
82d8876f
...
...
@@ -793,11 +793,8 @@ void Clipping::importMesh(std::string& filename)
{
std
::
vector
<
std
::
string
>
attrNames
;
std
::
string
extension
;
size_t
pos
;
pos
=
filename
.
rfind
(
"."
);
// position of "." in filename
extension
=
filename
.
substr
(
pos
);
size_t
pos
=
filename
.
rfind
(
"."
);
// position of "." in filename
std
::
string
extension
=
filename
.
substr
(
pos
);
if
(
extension
==
std
::
string
(
".tet"
))
{
...
...
Apps/Examples/viewer.cpp
View file @
82d8876f
...
...
@@ -184,13 +184,25 @@ void Viewer::importMesh(std::string& filename)
{
myMap
.
clear
(
true
)
;
std
::
vector
<
std
::
string
>
attrNames
;
if
(
!
Algo
::
Import
::
importMesh
<
PFP
>
(
myMap
,
filename
.
c_str
(),
attrNames
))
size_t
pos
=
filename
.
rfind
(
"."
);
// position of "." in filename
std
::
string
extension
=
filename
.
substr
(
pos
);
if
(
extension
==
std
::
string
(
".map"
))
{
myMap
.
loadMapBin
(
filename
);
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
)
;
}
else
{
CGoGNerr
<<
"could not import "
<<
filename
<<
CGoGNendl
;
return
;
std
::
vector
<
std
::
string
>
attrNames
;
if
(
!
Algo
::
Import
::
importMesh
<
PFP
>
(
myMap
,
filename
.
c_str
(),
attrNames
))
{
CGoGNerr
<<
"could not import "
<<
filename
<<
CGoGNendl
;
return
;
}
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
attrNames
[
0
])
;
}
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
attrNames
[
0
])
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
POINTS
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
LINES
)
;
...
...
include/Topology/generic/genericmap.h
View file @
82d8876f
...
...
@@ -385,6 +385,16 @@ public:
*/
void
dumpAttributesAndMarkers
();
/**
* update topo relation after compacting the container:
*/
virtual
void
compactTopoRelations
(
const
std
::
vector
<
unsigned
int
>&
oldnew
)
=
0
;
/**
* compact the map
*/
void
compact
();
/****************************************
* DARTS TRAVERSALS *
****************************************/
...
...
include/Topology/gmap/gmap0.h
View file @
82d8876f
...
...
@@ -54,6 +54,8 @@ public:
virtual
void
update_topo_shortcuts
();
virtual
void
compactTopoRelations
(
const
std
::
vector
<
unsigned
int
>&
oldnew
);
/*! @name Basic Topological Operators
* Access and Modification
*************************************************************************/
...
...
include/Topology/gmap/gmap1.h
View file @
82d8876f
...
...
@@ -53,6 +53,8 @@ public:
virtual
void
update_topo_shortcuts
();
virtual
void
compactTopoRelations
(
const
std
::
vector
<
unsigned
int
>&
oldnew
);
/*! @name Basic Topological Operators
* Access and Modification
*************************************************************************/
...
...
include/Topology/gmap/gmap2.h
View file @
82d8876f
...
...
@@ -53,6 +53,8 @@ public:
virtual
void
update_topo_shortcuts
();
virtual
void
compactTopoRelations
(
const
std
::
vector
<
unsigned
int
>&
oldnew
);
/*! @name Basic Topological Operators
* Access and Modification
*************************************************************************/
...
...
include/Topology/gmap/gmap3.h
View file @
82d8876f
...
...
@@ -53,6 +53,8 @@ public:
virtual
void
update_topo_shortcuts
();
virtual
void
compactTopoRelations
(
const
std
::
vector
<
unsigned
int
>&
oldnew
);
/*! @name Basic Topological Operators
* Access and Modification
*************************************************************************/
...
...
include/Topology/map/map1.h
View file @
82d8876f
...
...
@@ -59,6 +59,8 @@ public:
virtual
void
update_topo_shortcuts
();
virtual
void
compactTopoRelations
(
const
std
::
vector
<
unsigned
int
>&
oldnew
);
/*! @name Basic Topological Operators
* Access and Modification
*************************************************************************/
...
...
include/Topology/map/map2.h
View file @
82d8876f
...
...
@@ -65,6 +65,8 @@ public:
virtual
void
update_topo_shortcuts
();
virtual
void
compactTopoRelations
(
const
std
::
vector
<
unsigned
int
>&
oldnew
);
/*! @name Basic Topological Operators
* Access and Modification
*************************************************************************/
...
...
include/Topology/map/map3.h
View file @
82d8876f
...
...
@@ -67,6 +67,8 @@ public:
virtual
void
update_topo_shortcuts
();
virtual
void
compactTopoRelations
(
const
std
::
vector
<
unsigned
int
>&
oldnew
);
/*! @name Basic Topological Operators
* Access and Modification
*************************************************************************/
...
...
src/Container/attributeContainer.cpp
View file @
82d8876f
...
...
@@ -203,6 +203,7 @@ void AttributeContainer::compact(std::vector<unsigned int>& mapOldNew)
}
++
nbb
;
mapOldNew
.
clear
();
mapOldNew
.
reserve
(
nbe
);
// now get the holes
...
...
src/Topology/generic/genericmap.cpp
View file @
82d8876f
...
...
@@ -514,6 +514,37 @@ void GenericMap::dumpAttributesAndMarkers()
}
}
void
GenericMap
::
compact
()
{
std
::
vector
<
unsigned
int
>
oldnew
;
// compacting the orbits attributes
for
(
unsigned
int
orbit
=
0
;
orbit
<
NB_ORBITS
;
++
orbit
)
{
if
((
orbit
!=
DART
)
&&
(
isOrbitEmbedded
(
orbit
)))
{
m_attribs
[
orbit
].
compact
(
oldnew
);
for
(
unsigned
int
i
=
m_attribs
[
DART
].
begin
();
i
!=
m_attribs
[
DART
].
end
();
m_attribs
[
DART
].
next
(
i
))
{
unsigned
int
&
idx
=
m_embeddings
[
orbit
]
->
operator
[](
i
);
unsigned
int
jdx
=
oldnew
[
idx
];
if
((
jdx
!=
0xffffffff
)
&&
(
jdx
!=
idx
))
idx
=
jdx
;
}
}
}
//compacting the topo
m_attribs
[
DART
].
compact
(
oldnew
);
// update topo relations: recurvise call from real map down to generic
compactTopoRelations
(
oldnew
);
// dumpAttributesAndMarkers();
}
/****************************************
* DARTS TRAVERSALS *
****************************************/
...
...
src/Topology/gmap/gmap0.cpp
View file @
82d8876f
...
...
@@ -45,4 +45,15 @@ void GMap0::deleteEdge(Dart d)
deleteDart
(
d
);
}
void
GMap0
::
compactTopoRelations
(
const
std
::
vector
<
unsigned
int
>&
oldnew
)
{
for
(
unsigned
int
i
=
m_attribs
[
DART
].
begin
();
i
!=
m_attribs
[
DART
].
end
();
m_attribs
[
DART
].
next
(
i
))
{
Dart
&
d
=
m_beta0
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
}
}
// namespace CGoGN
src/Topology/gmap/gmap1.cpp
View file @
82d8876f
...
...
@@ -75,5 +75,24 @@ void GMap1::deleteFace(Dart d)
deleteEdge
(
d
);
}
void
GMap1
::
compactTopoRelations
(
const
std
::
vector
<
unsigned
int
>&
oldnew
)
{
for
(
unsigned
int
i
=
m_attribs
[
DART
].
begin
();
i
!=
m_attribs
[
DART
].
end
();
m_attribs
[
DART
].
next
(
i
))
{
{
Dart
&
d
=
m_beta0
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
{
Dart
&
d
=
m_beta1
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
}
}
}
// namespace CGoGN
src/Topology/gmap/gmap2.cpp
View file @
82d8876f
...
...
@@ -895,4 +895,32 @@ void GMap2::closeMap()
}
}
void
GMap2
::
compactTopoRelations
(
const
std
::
vector
<
unsigned
int
>&
oldnew
)
{
for
(
unsigned
int
i
=
m_attribs
[
DART
].
begin
();
i
!=
m_attribs
[
DART
].
end
();
m_attribs
[
DART
].
next
(
i
))
{
{
Dart
&
d
=
m_beta0
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
{
Dart
&
d
=
m_beta1
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
{
Dart
&
d
=
m_beta2
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
}
}
}
// namespace CGoGN
src/Topology/gmap/gmap3.cpp
View file @
82d8876f
...
...
@@ -916,4 +916,36 @@ void GMap3::closeMap()
}
}
inline
void
GMap3
::
compactTopoRelations
(
const
std
::
vector
<
unsigned
int
>&
oldnew
)
{
for
(
unsigned
int
i
=
m_attribs
[
DART
].
begin
();
i
!=
m_attribs
[
DART
].
end
();
m_attribs
[
DART
].
next
(
i
))
{
{
Dart
&
d
=
m_beta0
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
{
Dart
&
d
=
m_beta1
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
{
Dart
&
d
=
m_beta2
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
{
Dart
&
d
=
m_beta3
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
}
}
}
// namespace CGoGN
src/Topology/map/map1.cpp
View file @
82d8876f
...
...
@@ -84,4 +84,25 @@ void Map1::reverseCycle(Dart d)
phi1sew
(
e
,
d
)
;
// Sew the last edge
}
void
Map1
::
compactTopoRelations
(
const
std
::
vector
<
unsigned
int
>&
oldnew
)
{
for
(
unsigned
int
i
=
m_attribs
[
DART
].
begin
();
i
!=
m_attribs
[
DART
].
end
();
m_attribs
[
DART
].
next
(
i
))
{
{
Dart
&
d
=
m_phi1
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
{
Dart
&
d
=
m_phi_1
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
}
}
}
// namespace CGoGN
src/Topology/map/map2.cpp
View file @
82d8876f
...
...
@@ -776,4 +776,30 @@ void Map2::closeMap()
}
}
void
Map2
::
compactTopoRelations
(
const
std
::
vector
<
unsigned
int
>&
oldnew
)
{
for
(
unsigned
int
i
=
m_attribs
[
DART
].
begin
();
i
!=
m_attribs
[
DART
].
end
();
m_attribs
[
DART
].
next
(
i
))
{
{
Dart
&
d
=
m_phi1
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
{
Dart
&
d
=
m_phi_1
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
{
Dart
&
d
=
m_phi2
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
}
}
}
// namespace CGoGN
src/Topology/map/map3.cpp
View file @
82d8876f
...
...
@@ -821,4 +821,36 @@ void Map3::closeMap()
}
}
void
Map3
::
compactTopoRelations
(
const
std
::
vector
<
unsigned
int
>&
oldnew
)
{
for
(
unsigned
int
i
=
m_attribs
[
DART
].
begin
();
i
!=
m_attribs
[
DART
].
end
();
m_attribs
[
DART
].
next
(
i
))
{
{
Dart
&
d
=
m_phi1
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
{
Dart
&
d
=
m_phi_1
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
{
Dart
&
d
=
m_phi2
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
{
Dart
&
d
=
m_phi3
->
operator
[](
i
);
Dart
e
=
Dart
(
oldnew
[
d
.
index
]);
if
(
d
!=
e
)
d
=
e
;
}
}
}
}
// namespace CGoGN
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