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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
9c008fb8
Commit
9c008fb8
authored
Feb 17, 2012
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MR : begin new design of filters
parent
5f038b96
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
286 additions
and
376 deletions
+286
-376
Apps/Examples/viewer.cpp
Apps/Examples/viewer.cpp
+1
-27
Apps/Examples/viewer.h
Apps/Examples/viewer.h
+0
-3
include/Topology/generic/genericmap.h
include/Topology/generic/genericmap.h
+0
-1
include/Topology/generic/traversor2.hpp
include/Topology/generic/traversor2.hpp
+0
-7
include/Topology/map/map2.h
include/Topology/map/map2.h
+3
-3
include/Topology/map/map2MR/filters_Primal.h
include/Topology/map/map2MR/filters_Primal.h
+59
-192
include/Topology/map/map2MR/map2MR_PrimalAdapt.h
include/Topology/map/map2MR/map2MR_PrimalAdapt.h
+149
-0
include/Topology/map/map2MR/map2MR_PrimalRegular.h
include/Topology/map/map2MR/map2MR_PrimalRegular.h
+66
-0
src/Topology/map/map2.cpp
src/Topology/map/map2.cpp
+7
-7
src/Topology/map/map2MR/map2MR_PrimalAdapt.cpp
src/Topology/map/map2MR/map2MR_PrimalAdapt.cpp
+1
-136
No files found.
Apps/Examples/viewer.cpp
View file @
9c008fb8
...
...
@@ -161,7 +161,6 @@ void Viewer::cb_redraw()
}
glDisable
(
GL_POLYGON_OFFSET_FILL
)
;
}
}
void
Viewer
::
cb_Open
()
...
...
@@ -183,29 +182,6 @@ void Viewer::cb_Save()
exportMesh
(
filename
)
;
}
void
Viewer
::
cb_mousePress
(
int
button
,
int
x
,
int
y
)
{
if
(
Shift
())
{
std
::
cout
<<
"shift"
<<
std
::
endl
;
m_renderTopo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
,
0.9
,
allDarts
);
Dart
d
=
m_renderTopo
->
picking
<
PFP
>
(
myMap
,
x
,
y
,
allDarts
);
if
(
d
!=
Dart
::
nil
())
{
statusMsg
(
"dart picked"
);
}
else
{
statusMsg
(
"No dart was picked"
);
}
}
updateGL
();
}
void
Viewer
::
importMesh
(
std
::
string
&
filename
)
{
myMap
.
clear
(
true
)
;
...
...
@@ -229,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
())
...
...
@@ -339,4 +314,3 @@ int main(int argc, char **argv)
return
app
.
exec
()
;
}
Apps/Examples/viewer.h
View file @
9c008fb8
...
...
@@ -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/Topology/generic/genericmap.h
View file @
9c008fb8
...
...
@@ -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 @
9c008fb8
...
...
@@ -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 @
9c008fb8
...
...
@@ -287,10 +287,10 @@ public:
//! Split a surface into two disconnected surfaces along a edge path
/*! @param vd a vector of darts
* @param
F
irstSideOpen : if false, one of the 2 sides of the surface remains closed (no hole)
* @param
S
econdSideOpen : if false, the other side of the surface remains closed (no hole)
* @param
f
irstSideOpen : if false, one of the 2 sides of the surface remains closed (no hole)
* @param
s
econdSideOpen : if false, the other side of the surface remains closed (no hole)
*/
virtual
void
splitSurface
(
std
::
vector
<
Dart
>&
vd
,
bool
FirstSideClosed
=
true
,
bool
S
econdSideClosed
=
true
);
virtual
void
splitSurface
(
std
::
vector
<
Dart
>&
vd
,
bool
firstSideClosed
=
true
,
bool
s
econdSideClosed
=
true
);
//@}
/*! @name Topological Queries
...
...
include/Topology/map/map2MR/
map2MR
_Primal.h
→
include/Topology/map/map2MR/
filters
_Primal.h
View file @
9c008fb8
...
...
@@ -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
Pipo
AnalysisFunctor
:
public
FunctorType
class
Pipo
EvenAnalysisFilter
:
public
MRFilter
{
protected:
typename
PFP
::
MAP
&
m_map
;
typename
PFP
::
TVEC3
&
m_position
;
public:
Pipo
AnalysisFuncto
r
(
typename
PFP
::
MAP
&
m
,
typename
PFP
::
TVEC3
&
p
)
:
m_map
(
m
),
m_position
(
p
)
Pipo
EvenAnalysisFilte
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
unctor
:
public
FunctorType
class
PipoOddSynthesisF
ilter
:
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
unctor
:
public
FunctorType
class
PipoEvenSynthesisF
ilter
:
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 @
9c008fb8
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __MAP2MR_PRIMAL_ADAPT__
#define __MAP2MR_PRIMAL_ADAPT__
#include "Topology/map/embeddedMap2.h"
#include "Topology/generic/traversorCell.h"
#include "Topology/generic/traversor2.h"
#include <cmath>
namespace
CGoGN
{
class
Map2MR_PrimalAdapt
:
public
EmbeddedMap2
{
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
)
;
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
;
}
}
;
}
// namespace CGoGN
#endif
include/Topology/map/map2MR/map2MR_PrimalRegular.h
0 → 100644
View file @
9c008fb8
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *