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
c2731df0
Commit
c2731df0
authored
Feb 17, 2012
by
Sylvain Thery
Browse files
Merge branch 'master' of cgogn:~cgogn/CGoGN
parents
b6114761
9c008fb8
Changes
14
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/viewer.cpp
View file @
c2731df0
...
...
@@ -161,7 +161,6 @@ void Viewer::cb_redraw()
}
glDisable
(
GL_POLYGON_OFFSET_FILL
)
;
}
}
void
Viewer
::
cb_Open
()
...
...
@@ -183,9 +182,6 @@ void Viewer::cb_Save()
exportMesh
(
filename
)
;
}
void
Viewer
::
importMesh
(
std
::
string
&
filename
)
{
myMap
.
clear
(
true
)
;
...
...
@@ -209,14 +205,13 @@ void Viewer::importMesh(std::string& filename)
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
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
TRIANGLES
)
;
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
normalBaseSize
=
bb
.
diagSize
()
/
100.0
f
;
// vertexBaseSize = normalBaseSize /5.0f ;
// vertexBaseSize = normalBaseSize /
5.0f ;
normal
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"normal"
)
;
if
(
!
normal
.
isValid
())
...
...
@@ -319,4 +314,3 @@ int main(int argc, char **argv)
return
app
.
exec
()
;
}
Apps/Examples/viewer.h
View file @
c2731df0
...
...
@@ -86,7 +86,6 @@ public:
float
faceShrinkage
;
int
m_renderStyle
;
// bool m_drawTopo;
bool
m_drawVertices
;
bool
m_drawEdges
;
bool
m_drawFaces
;
...
...
@@ -118,7 +117,6 @@ public:
void
importMesh
(
std
::
string
&
filename
)
;
void
exportMesh
(
std
::
string
&
filename
);
public
slots
:
void
slot_drawVertices
(
bool
b
)
;
void
slot_verticesSize
(
int
i
)
;
...
...
@@ -128,4 +126,3 @@ public slots:
void
slot_drawNormals
(
bool
b
)
;
void
slot_normalsSize
(
int
i
)
;
};
include/Algo/ImplicitHierarchicalMesh/ihm3.h
View file @
c2731df0
...
...
@@ -143,6 +143,16 @@ public:
*/
void
swapEdges
(
Dart
d
,
Dart
e
);
//!
/*!
*
*/
void
saveRelationsAroundVertex
(
Dart
d
,
std
::
vector
<
std
::
pair
<
Dart
,
Dart
>
>&
vd
);
void
unsewAroundVertex
(
std
::
vector
<
std
::
pair
<
Dart
,
Dart
>
>&
vd
);
Dart
quadranguleFace
(
Dart
d
);
// //!
// /*!
// *
...
...
include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp
View file @
c2731df0
...
...
@@ -403,8 +403,8 @@ Dart subdivideVolumeClassic2(typename PFP::MAP& map, Dart d, typename PFP::TVEC3
/*
* Subdivide Faces
*/
std
::
vector
<
std
::
pair
<
Dart
,
Dart
>
>
subdivided
f
aces
;
subdivided
f
aces
.
reserve
(
25
);
std
::
vector
<
std
::
pair
<
Dart
,
Dart
>
>
subdivided
F
aces
;
subdivided
F
aces
.
reserve
(
128
);
Traversor3WF
<
typename
PFP
::
MAP
>
traF
(
map
,
old
);
for
(
Dart
dit
=
traF
.
begin
();
dit
!=
traF
.
end
();
dit
=
traF
.
next
())
...
...
@@ -413,43 +413,18 @@ Dart subdivideVolumeClassic2(typename PFP::MAP& map, Dart d, typename PFP::TVEC3
if
(
!
map
.
faceIsSubdivided
(
dit
))
Algo
::
IHM
::
subdivideFace
<
PFP
>
(
map
,
dit
,
position
,
Algo
::
IHM
::
S_QUAD
);
//save
a
dart from the subdivided face
//save dart
s
from the
central vertex of each
subdivided face
unsigned
int
cur
=
map
.
getCurrentLevel
()
;
unsigned
int
fLevel
=
map
.
faceLevel
(
dit
)
+
1
;
//puisque dans tous les cas, la face est subdivisee
map
.
setCurrentLevel
(
fLevel
)
;
//le brin est forcement du niveau cur
Dart
cf
=
map
.
phi2
(
map
.
phi1
(
dit
));
Dart
e
=
cf
;
do
{
subdividedfaces
.
push_back
(
std
::
pair
<
Dart
,
Dart
>
(
e
,
map
.
phi2
(
e
)));
e
=
map
.
phi2
(
map
.
phi_1
(
e
));
}
while
(
e
!=
cf
);
unsigned
int
fLevel
=
map
.
faceLevel
(
dit
);
map
.
setCurrentLevel
(
fLevel
+
1
)
;
map
.
saveRelationsAroundVertex
(
map
.
phi2
(
map
.
phi1
(
dit
)),
subdividedFaces
);
map
.
setCurrentLevel
(
cur
);
}
unsigned
int
fLevel
=
map
.
faceLevel
(
old
)
+
1
;
//puisque dans tous les cas, la face est subdivisee
map
.
setCurrentLevel
(
fLevel
)
;
for
(
std
::
vector
<
std
::
pair
<
Dart
,
Dart
>
>::
iterator
it
=
subdividedfaces
.
begin
();
it
!=
subdividedfaces
.
end
();
++
it
)
{
Dart
f1
=
(
*
it
).
first
;
if
(
!
map
.
Map2
::
isBoundaryEdge
(
f1
))
{
Dart
f2
=
map
.
phi2
(
f1
);
map
.
unsewFaces
(
f1
);
map
.
copyDartEmbedding
(
VERTEX
,
map
.
phi2
(
f2
),
f1
);
map
.
copyDartEmbedding
(
VERTEX
,
map
.
phi2
(
f1
),
f2
);
}
}
cur
=
map
.
getCurrentLevel
()
;
unsigned
int
fLevel
=
map
.
faceLevel
(
old
);
map
.
setCurrentLevel
(
fLevel
+
1
)
;
map
.
unsewAroundVertex
(
subdividedFaces
);
map
.
setCurrentLevel
(
cur
);
/*
...
...
@@ -469,58 +444,26 @@ Dart subdivideVolumeClassic2(typename PFP::MAP& map, Dart d, typename PFP::TVEC3
//volCenter += position[d];
//++degree;
Dart
old
=
map
.
phi2
(
map
.
phi1
(
dit
));
map
.
Map2
::
fillHole
(
old
);
Dart
dd
=
map
.
phi1
(
map
.
phi1
(
old
))
;
map
.
splitFace
(
old
,
dd
)
;
unsigned
int
idface
=
map
.
getNewFaceId
();
map
.
setFaceId
(
dd
,
idface
,
FACE
);
Dart
ne
=
map
.
phi1
(
map
.
phi1
(
old
))
;
map
.
cutEdge
(
ne
);
centralDart
=
map
.
phi1
(
ne
);
centralDart
=
map
.
quadranguleFace
(
dit
);
position
[
centralDart
]
=
volCenter
;
newEdges
.
push_back
(
ne
);
newEdges
.
push_back
(
map
.
phi1
(
ne
));
unsigned
int
id
=
map
.
getNewEdgeId
()
;
map
.
setEdgeId
(
ne
,
id
,
EDGE
)
;
Dart
stop
=
map
.
phi2
(
map
.
phi1
(
ne
));
ne
=
map
.
phi2
(
ne
);
do
{
dd
=
map
.
phi1
(
map
.
phi1
(
map
.
phi1
(
ne
)));
map
.
splitFace
(
ne
,
dd
)
;
unsigned
int
idface
=
map
.
getNewFaceId
();
map
.
setFaceId
(
dd
,
idface
,
FACE
);
newEdges
.
push_back
(
map
.
phi1
(
dd
));
ne
=
map
.
phi2
(
map
.
phi_1
(
ne
));
dd
=
map
.
phi1
(
map
.
phi1
(
dd
));
}
while
(
dd
!=
stop
);
}
//volCenter /= double(degree);
for
(
std
::
vector
<
std
::
pair
<
Dart
,
Dart
>
>::
iterator
it
=
subdividedfaces
.
begin
();
it
!=
subdividedfaces
.
end
();
++
it
)
for
(
std
::
vector
<
std
::
pair
<
Dart
,
Dart
>
>::
iterator
it
=
subdividedFaces
.
begin
();
it
!=
subdividedFaces
.
end
();
++
it
)
{
Dart
f1
=
(
*
it
).
first
;
Dart
f2
=
(
*
it
).
second
;
Dart
f1
=
map
.
phi2
(
(
*
it
).
first
)
;
Dart
f2
=
map
.
phi2
(
(
*
it
).
second
)
;
if
(
map
.
isBoundaryFace
(
map
.
phi2
(
f1
)
)
&&
map
.
isBoundaryFace
(
map
.
phi2
(
f2
))
)
if
(
map
.
isBoundaryFace
(
f1
)
&&
map
.
isBoundaryFace
(
f2
))
{
map
.
sewVolumes
(
map
.
phi2
(
f1
),
map
.
phi2
(
f2
));
std
::
cout
<<
"plop"
<<
std
::
endl
;
map
.
sewVolumes
(
f1
,
f2
,
false
);
}
}
//volCenter /= double(degree);
//position[centralDart] = volCenter;
// //Third step : 3-sew internal faces
...
...
@@ -567,7 +510,7 @@ Dart subdivideVolumeClassic2(typename PFP::MAP& map, Dart d, typename PFP::TVEC3
map
.
setCurrentLevel
(
cur
)
;
return
subdivided
f
aces
.
begin
()
->
first
;
return
subdivided
F
aces
.
front
().
first
;
}
...
...
@@ -658,8 +601,6 @@ void subdivideLoop(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
}
//if is not a tetrahedron
// unsigned int vdeg = map.vertexDegree(dit);
// if(vdeg > 3)
unsigned
int
fdeg
=
map
.
faceDegree
(
map
.
phi2
(
f1
));
if
(
fdeg
>
3
)
{
...
...
include/Topology/generic/genericmap.h
View file @
c2731df0
...
...
@@ -297,7 +297,6 @@ public:
/**
* get the cell index of the given dimension associated to dart d
* (can go through the whole orbit due to lazy embedding)
* @return EMBNULL if the orbit of d is not attached to any cell
*/
unsigned
int
getEmbedding
(
unsigned
int
orbit
,
Dart
d
)
;
...
...
include/Topology/generic/traversor2.hpp
View file @
c2731df0
...
...
@@ -487,7 +487,6 @@ Traversor2<MAP>* Traversor2<MAP>::createIncident(MAP& map, Dart dart, unsigned i
return
NULL
;
}
template
<
typename
MAP
>
Traversor2
<
MAP
>*
Traversor2
<
MAP
>::
createAdjacent
(
MAP
&
map
,
Dart
dart
,
unsigned
int
orbX
,
unsigned
int
orbY
)
{
...
...
@@ -519,10 +518,4 @@ Traversor2<MAP>* Traversor2<MAP>::createAdjacent(MAP& map, Dart dart, unsigned i
return
NULL
;
}
}
// namespace CGoGN
include/Topology/map/map2.h
View file @
c2731df0
...
...
@@ -284,6 +284,13 @@ public:
* @return true if the merge has been executed, false otherwise
*/
virtual
bool
mergeVolumes
(
Dart
d
,
Dart
e
);
//! Split a surface into two disconnected surfaces along a edge path
/*! @param vd a vector of darts
* @param firstSideOpen : if false, one of the 2 sides of the surface remains closed (no hole)
* @param secondSideOpen : if false, the other side of the surface remains closed (no hole)
*/
virtual
void
splitSurface
(
std
::
vector
<
Dart
>&
vd
,
bool
firstSideClosed
=
true
,
bool
secondSideClosed
=
true
);
//@}
/*! @name Topological Queries
...
...
include/Topology/map/map2MR/
map2MR
_Primal.h
→
include/Topology/map/map2MR/
filters
_Primal.h
View file @
c2731df0
...
...
@@ -22,267 +22,131 @@
* *
*******************************************************************************/
#ifndef __MAP2MR_PRIMAL__
#define __MAP2MR_PRIMAL__
#include
"Topology/map/embeddedMap2.h"
#include
"Topology/generic/traversorCell.h"
#include
"Topology/generic/traversor2.h"
#ifndef __MR_FILTERS_PRIMAL__
#define __MR_FILTERS_PRIMAL__
#include
<cmath>
namespace
CGoGN
{
/*********************************************************************************
* MAP2 MR PRIMAL ADAPTIVE
*********************************************************************************/
class
Map2MR_PrimalAdapt
:
public
EmbeddedMap2
namespace
Multiresolution
{
protected:
bool
shareVertexEmbeddings
;
FunctorType
*
vertexVertexFunctor
;
FunctorType
*
edgeVertexFunctor
;
FunctorType
*
faceVertexFunctor
;
public:
Map2MR_PrimalAdapt
()
;
std
::
string
mapTypeName
()
{
return
"Map2MR_PrimalAdapt"
;
}
/***************************************************
* CELLS INFORMATION *
***************************************************/
/**
* Return the level of the edge of d in the current level map
*/
unsigned
int
edgeLevel
(
Dart
d
)
;
/**
* Return the level of the face of d in the current level map
*/
unsigned
int
faceLevel
(
Dart
d
)
;
/**
* Given the face of d in the current level map,
* return a level 0 dart of its origin face
*/
Dart
faceOrigin
(
Dart
d
)
;
/**
* Return the oldest dart of the face of d in the current level map
*/
Dart
faceOldestDart
(
Dart
d
)
;
/**
* Return true if the edge of d in the current level map
* has already been subdivided to the next level
*/
bool
edgeIsSubdivided
(
Dart
d
)
;
/**
* Return true if the edge of d in the current level map
* is subdivided to the next level,
* none of its resulting edges is in turn subdivided to the next level
* and the middle vertex is of degree 2
*/
bool
edgeCanBeCoarsened
(
Dart
d
)
;
/**
* Return true if the face of d in the current level map
* has already been subdivided to the next level
*/
bool
faceIsSubdivided
(
Dart
d
)
;
/**
* Return true if the face of d in the current level map
* is subdivided to the next level
* and none of its resulting faces is in turn subdivided to the next level
*/
bool
faceIsSubdividedOnce
(
Dart
d
)
;
/***************************************************
* SUBDIVISION *
***************************************************/
protected:
// void propagatePhi1(Dart d) ;
// void propagatePhi_1(Dart d) ;
/**
* add a new resolution level
*/
void
addNewLevel
()
;
/**
* subdivide the edge of d to the next level
*/
void
subdivideEdge
(
Dart
d
)
;
/**
* coarsen the edge of d from the next level
*/
void
coarsenEdge
(
Dart
d
)
;
class
MRFilter
{
public:
/**
* subdivide the face of d to the next level
*/
unsigned
int
subdivideFace
(
Dart
d
)
;
/**
* coarsen the face of d from the next level
*/
void
coarsenFace
(
Dart
d
)
;
/**
* vertices attributes management
*/
void
setVertexVertexFunctor
(
FunctorType
*
f
)
{
vertexVertexFunctor
=
f
;
}
void
setEdgeVertexFunctor
(
FunctorType
*
f
)
{
edgeVertexFunctor
=
f
;
}
void
setFaceVertexFunctor
(
FunctorType
*
f
)
{
faceVertexFunctor
=
f
;
}
MRFilter
()
{}
virtual
~
MRFilter
()
{}
virtual
void
operator
()
()
=
0
;
}
;
/*********************************************************************************
*
MAP2 MR PRIMAL REGULAR
*
ANALYSIS FILTERS
*********************************************************************************/
class
Map2MR_PrimalRegular
:
public
EmbeddedMap2
template
<
typename
PFP
>
class
PipoOddAnalysisFilter
:
public
MRFilter
{
protected:
bool
shareVertexEmbeddings
;
typename
PFP
::
MAP
&
m_map
;
typename
PFP
::
TVEC3
&
m_position
;
public:
Map2MR_PrimalRegular
()
;
std
::
string
mapTypeName
()
{
return
"Map2MR_PrimalRegular"
;
}
PipoOddAnalysisFilter
(
typename
PFP
::
MAP
&
m
,
typename
PFP
::
TVEC3
&
p
)
:
m_map
(
m
),
m_position
(
p
)
{}
bool
isOddVertex
(
Dart
d
)
;
void
operator
()
()
{
TraversorE
<
typename
PFP
::
MAP
>
trav
(
m_map
)
;
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
{
m_map
.
incCurrentLevel
()
;
void
addNewLevel
()
;
Dart
oddV
=
m_map
.
phi2
(
d
)
;
m_position
[
oddV
]
=
typename
PFP
::
VEC3
(
0
)
;
void
analysis
(
FunctorType
*
f
)
;
void
synthesis
(
FunctorType
*
odd
,
FunctorType
*
even
)
;
m_map
.
decCurrentLevel
()
;
}
}
}
;
template
<
typename
PFP
>
class
PipoAnalysisF
uncto
r
:
public
FunctorType
class
Pipo
Even
AnalysisF
ilte
r
:
public
MRFilter
{
protected:
typename
PFP
::
MAP
&
m_map
;
typename
PFP
::
TVEC3
&
m_position
;
public:
PipoAnalysisF
uncto
r
(
typename
PFP
::
MAP
&
m
,
typename
PFP
::
TVEC3
&
p
)
:
m_map
(
m
),
m_position
(
p
)
Pipo
Even
AnalysisF
ilte
r
(
typename
PFP
::
MAP
&
m
,
typename
PFP
::
TVEC3
&
p
)
:
m_map
(
m
),
m_position
(
p
)
{}
bool
operator
()
(
Dart
d
)
void
operator
()
()
{
return
false
;
// TraversorV<typename PFP::MAP> trav(m_map) ;
// for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
// {
// }
}
}
;
/*********************************************************************************
* SYNTHESIS FILTERS
*********************************************************************************/
template
<
typename
PFP
>
class
PipoOddSynthesisF
uncto
r
:
public
FunctorType
class
PipoOddSynthesisF
ilte
r
:
public
MRFilter
{
protected:
typename
PFP
::
MAP
&
m_map
;
typename
PFP
::
TVEC3
&
m_position
;
public:
PipoOddSynthesisF
uncto
r
(
typename
PFP
::
MAP
&
m
,
typename
PFP
::
TVEC3
&
p
)
:
m_map
(
m
),
m_position
(
p
)
PipoOddSynthesisF
ilte
r
(
typename
PFP
::
MAP
&
m
,
typename
PFP
::
TVEC3
&
p
)
:
m_map
(
m
),
m_position
(
p
)
{}
bool
operator
()
(
Dart
d
)
void
operator
()
()
{
Dart
it
=
d
;
Dart
d1
=
m_map
.
phi2
(
it
)
;
bool
centerV
=
false
;
while
(
m_map
.
getDartLevel
(
d1
)
==
m_map
.
getCurrentLevel
())
TraversorE
<
typename
PFP
::
MAP
>
trav
(
m_map
)
;
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
{
it
=
m_map
.
phi1
(
d1
)
;
if
(
it
==
d
)
{
centerV
=
true
;
d1
=
m_map
.
phi1
(
m_map
.
phi1
(
it
))
;
break
;
}
d1
=
m_map
.
phi2
(
it
)
;
}
typename
PFP
::
VEC3
p
=
(
m_position
[
d
]
+
m_position
[
m_map
.
phi2
(
d
)])
/
2.0
;
m_map
.
de
cCurrentLevel
()
;
m_map
.
in
cCurrentLevel
()
;
typename
PFP
::
VEC3
p
;
if
(
centerV
)
{
unsigned
int
degree
=
0
;
Traversor2FV
<
typename
PFP
::
MAP
>
trav
(
m_map
,
d1
)
;
for
(
Dart
fit
=
trav
.
begin
();
fit
!=
trav
.
end
();
fit
=
trav
.
next
())
{
++
degree
;
p
+=
m_position
[
fit
]
;
}
p
/=
degree
;
}
else
{
Dart
d2
=
m_map
.
phi2
(
d1
)
;
p
=
(
m_position
[
d1
]
+
m_position
[
d2
])
/
2.0
;
}
m_map
.
incCurrentLevel
()
;
m_position
[
d
]
=
p
;
Dart
oddV
=
m_map
.
phi2
(
d
)
;
m_position
[
oddV
]
+=
p
;
return
false
;
m_map
.
decCurrentLevel
()
;
}
}
}
;
template
<
typename
PFP
>
class
PipoEvenSynthesisF
uncto
r
:
public
FunctorType
class
PipoEvenSynthesisF
ilte
r
:
public
MRFilter
{
protected:
typename
PFP
::
MAP
&
m_map
;
typename
PFP
::
TVEC3
&
m_position
;
public:
PipoEvenSynthesisF
uncto
r
(
typename
PFP
::
MAP
&
m
,
typename
PFP
::
TVEC3
&
p
)
:
m_map
(
m
),
m_position
(
p
)
PipoEvenSynthesisF
ilte
r
(
typename
PFP
::
MAP
&
m
,
typename
PFP
::
TVEC3
&
p
)
:
m_map
(
m
),
m_position
(
p
)
{}
bool
operator
()
(
Dart
d
)
void
operator
()
()
{
typename
PFP
::
VEC3
p
(
0
)
;
unsigned
int
degree
=
0
;
Traversor2VVaE
<
typename
PFP
::
MAP
>
trav
(
m_map
,
d
)
;
for
(
Dart
it
=
trav
.
begin
();
it
!=
trav
.
end
();
it
=
trav
.
next
())
{
++
degree
;
p
+=
m_position
[
it
]
;
}
p
/=
degree
;
p
*=
0.5
;
p
+=
m_position
[
d
]
*
0.5
;
m_position
[
d
]
=
p
;
return
false
;
// TraversorV<typename PFP::MAP> trav(m_map) ;
// for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
// {
// }
}
}
;
/*********************************************************************************
*
VERTEX
FUNCTORS
*
SUBDIVISION
FUNCTORS
*********************************************************************************/
template
<
typename
PFP
>
...
...
@@ -578,6 +442,9 @@ public:
}
}
;
}
// namespace Multiresolution
}
// namespace CGoGN
#endif
include/Topology/map/map2MR/map2MR_PrimalAdapt.h
0 → 100644
View file @
c2731df0