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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KennethVanhoey
CGoGN
Commits
950f5e11
Commit
950f5e11
authored
May 02, 2014
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace some functors by lambdas
parent
cc63ab5a
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
411 additions
and
420 deletions
+411
-420
include/Algo/Geometry/normal.hpp
include/Algo/Geometry/normal.hpp
+4
-3
include/Algo/Import/import.hpp
include/Algo/Import/import.hpp
+345
-359
include/Algo/Import/importObjTex.hpp
include/Algo/Import/importObjTex.hpp
+8
-6
include/Algo/MC/marchingcube.hpp
include/Algo/MC/marchingcube.hpp
+8
-5
include/Topology/generic/functor.h
include/Topology/generic/functor.h
+45
-45
include/Topology/map/map3.hpp
include/Topology/map/map3.hpp
+1
-2
No files found.
include/Algo/Geometry/normal.hpp
View file @
950f5e11
...
...
@@ -115,11 +115,12 @@ typename V_ATT::DATA_TYPE vertexBorderNormal(typename PFP::MAP& map, Vertex v, c
typedef
typename
V_ATT
::
DATA_TYPE
VEC3
;
VEC3
N
(
0
)
;
std
::
vector
<
Dart
>
faces
;
CellMarker
<
typename
PFP
::
MAP
,
FACE
>
f
(
map
);
faces
.
reserve
(
16
);
map
.
foreach_dart_of_vertex
(
v
,
[
&
]
(
Dart
d
)
{
faces
.
push_back
(
d
);
});
FunctorStore
fs
(
faces
);
map
.
foreach_dart_of_vertex
(
v
,
fs
);
CellMarker
<
typename
PFP
::
MAP
,
FACE
>
f
(
map
);
for
(
std
::
vector
<
Dart
>::
iterator
it
=
faces
.
begin
()
;
it
!=
faces
.
end
()
;
++
it
)
{
...
...
include/Algo/Import/import.hpp
View file @
950f5e11
This diff is collapsed.
Click to expand it.
include/Algo/Import/importObjTex.hpp
View file @
950f5e11
...
...
@@ -1635,7 +1635,10 @@ bool OBJModel<PFP>::import( const std::string& filename, std::vector<std::string
std::vector<unsigned int> localIndices;
localIndices.reserve(64*3);
FunctorInitEmb
<
typename
PFP
::
MAP
,
VERTEX
>
fsetemb
(
m_map
);
unsigned int vemb = EMBNULL;
auto fsetemb = [&] (Dart d) { m_map.template initDartEmbedding<VERTEX>(d, vemb); };
// FunctorInitEmb<typename PFP::MAP, VERTEX> fsetemb(m_map);
VertexAutoAttribute< NoTypeNameAttribute< std::vector<Dart> >, MAP_IMPL> vecDartsPerVertex(m_map, "incidents");
VertexAutoAttribute< NoTypeNameAttribute< std::vector<unsigned int> >, MAP_IMPL> vecNormIndPerVertex(m_map, "incidentsN");
...
...
@@ -1739,13 +1742,12 @@ bool OBJModel<PFP>::import( const std::string& filename, std::vector<std::string
for (short j = 0; j < nbe; ++j)
{
unsigned
int
em
=
localIndices
[
3
*
j
]
-
1
;
// get embedding
fsetemb
.
changeEmb
(
em
)
;
vemb = localIndices[3*j]-1; // get embedding
m_map.template foreach_dart_of_orbit<PFP::MAP::VERTEX_OF_PARENT>(d, fsetemb);
mk.mark(d) ; // mark on the fly to unmark on second loop
vecDartsPerVertex
[
em
].
push_back
(
d
);
// store incident darts for fast adjacency reconstruction
vecTCIndPerVertex
[
em
].
push_back
(
localIndices
[
3
*
j
+
1
]
-
1
);
vecNormIndPerVertex
[
em
].
push_back
(
localIndices
[
3
*
j
+
2
]
-
1
);
vecDartsPerVertex[
vemb
].push_back(d); // store incident darts for fast adjacency reconstruction
vecTCIndPerVertex[
vemb
].push_back(localIndices[3*j+1]-1);
vecNormIndPerVertex[
vemb
].push_back(localIndices[3*j+2]-1);
d = m_map.phi1(d);
}
}
...
...
include/Algo/MC/marchingcube.hpp
View file @
950f5e11
...
...
@@ -118,14 +118,17 @@ template< typename DataType, template < typename D2 > class Windowing, typename
Dart
MarchingCube
<
DataType
,
Windowing
,
PFP
>::
createTriEmb
(
unsigned
int
e1
,
unsigned
int
e2
,
unsigned
int
e3
)
{
L_DART
d
=
m_map
->
newFace
(
3
,
false
);
FunctorSetEmb
<
typename
PFP
::
MAP
,
VERTEX
>
fsetemb
(
*
m_map
,
e1
);
unsigned
int
vemb
=
e1
;
auto
fsetemb
=
[
&
]
(
Dart
d
)
{
m_map
->
template
setDartEmbedding
<
VERTEX
>(
d
,
vemb
);
};
m_map
->
template
foreach_dart_of_orbit
<
PFP
::
MAP
::
VERTEX_OF_PARENT
>(
d
,
fsetemb
);
d
=
m_map
->
phi1
(
d
);
fsetemb
.
changeEmb
(
e2
)
;
vemb
=
e2
;
m_map
->
template
foreach_dart_of_orbit
<
PFP
::
MAP
::
VERTEX_OF_PARENT
>(
d
,
fsetemb
);
d
=
m_map
->
phi1
(
d
);
fsetemb
.
changeEmb
(
e3
)
;
vemb
=
e3
;
m_map
->
template
foreach_dart_of_orbit
<
PFP
::
MAP
::
VERTEX_OF_PARENT
>(
d
,
fsetemb
);
d
=
m_map
->
phi1
(
d
);
...
...
@@ -136,7 +139,7 @@ template< typename DataType, template < typename D2 > class Windowing, typename
void
MarchingCube
<
DataType
,
Windowing
,
PFP
>::
simpleMeshing
()
{
// create the mesh if needed
if
(
m_map
==
NULL
)
if
(
m_map
==
NULL
)
{
m_map
=
new
L_MAP
();
}
...
...
include/Topology/generic/functor.h
View file @
950f5e11
...
...
@@ -267,39 +267,39 @@ public:
// Embedding Functors
/********************************************************/
template
<
typename
MAP
,
unsigned
int
ORBIT
>
class
FunctorSetEmb
:
public
FunctorMap
<
MAP
>
{
protected:
unsigned
int
emb
;
public:
FunctorSetEmb
(
MAP
&
map
,
unsigned
int
e
)
:
FunctorMap
<
MAP
>
(
map
),
emb
(
e
)
{}
bool
operator
()(
Dart
d
)
{
this
->
m_map
.
template
setDartEmbedding
<
ORBIT
>(
d
,
emb
);
return
false
;
}
void
changeEmb
(
unsigned
int
e
)
{
emb
=
e
;
}
};
template
<
typename
MAP
,
unsigned
int
ORBIT
>
class
FunctorInitEmb
:
public
FunctorMap
<
MAP
>
{
protected:
unsigned
int
emb
;
public:
FunctorInitEmb
(
MAP
&
map
)
:
FunctorMap
<
MAP
>
(
map
),
emb
(
EMBNULL
)
{}
FunctorInitEmb
(
MAP
&
map
,
unsigned
int
e
)
:
FunctorMap
<
MAP
>
(
map
),
emb
(
e
)
{}
bool
operator
()(
Dart
d
)
{
this
->
m_map
.
template
initDartEmbedding
<
ORBIT
>(
d
,
emb
);
return
false
;
}
void
changeEmb
(
unsigned
int
e
)
{
emb
=
e
;
}
};
//
template <typename MAP, unsigned int ORBIT>
//
class FunctorSetEmb : public FunctorMap<MAP>
//
{
//
protected:
//
unsigned int emb;
//
public:
//
FunctorSetEmb(MAP& map, unsigned int e) : FunctorMap<MAP>(map), emb(e)
//
{}
//
bool operator()(Dart d)
//
{
//
this->m_map.template setDartEmbedding<ORBIT>(d, emb);
//
return false;
//
}
//
void changeEmb(unsigned int e) { emb = e; }
//
};
//
template <typename MAP, unsigned int ORBIT>
//
class FunctorInitEmb : public FunctorMap<MAP>
//
{
//
protected:
//
unsigned int emb;
//
public:
//
FunctorInitEmb(MAP& map) : FunctorMap<MAP>(map), emb(EMBNULL)
//
{}
//
FunctorInitEmb(MAP& map, unsigned int e) : FunctorMap<MAP>(map), emb(e)
//
{}
//
bool operator()(Dart d)
//
{
//
this->m_map.template initDartEmbedding<ORBIT>(d, emb);
//
return false;
//
}
//
void changeEmb(unsigned int e) { emb = e; }
//
};
// Search Functor: look for a given dart when applied
/********************************************************/
...
...
@@ -332,18 +332,18 @@ public:
// Functor Store: to store the traversed darts in a given vector
/********************************************************/
class
FunctorStore
:
public
FunctorType
{
protected:
std
::
vector
<
Dart
>&
m_vec
;
public:
FunctorStore
(
std
::
vector
<
Dart
>&
vec
)
:
m_vec
(
vec
)
{}
bool
operator
()(
Dart
d
)
{
m_vec
.
push_back
(
d
);
return
false
;
}
};
//
class FunctorStore : public FunctorType
//
{
//
protected:
//
std::vector<Dart>& m_vec;
//
public:
//
FunctorStore(std::vector<Dart>& vec) : m_vec(vec) {}
//
bool operator()(Dart d)
//
{
//
m_vec.push_back(d);
//
return false;
//
}
//
};
template
<
typename
MAP
>
...
...
include/Topology/map/map3.hpp
View file @
950f5e11
...
...
@@ -301,8 +301,7 @@ Dart Map3<MAP_IMPL>::deleteVertex(Dart d)
// (one dart per face should be enough)
std
::
vector
<
Dart
>
fstoretmp
;
fstoretmp
.
reserve
(
128
);
FunctorStore fs(fstoretmp);
foreach_dart_of_vertex(d, fs);
foreach_dart_of_vertex
(
d
,
[
&
]
(
Dart
it
)
{
fstoretmp
.
push_back
(
it
);
});
// just one dart per face
std
::
vector
<
Dart
>
fstore
;
...
...
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