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
46711425
Commit
46711425
authored
Jul 11, 2014
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of cgogn:~vanhoey/CGoGN into develop
Conflicts: include/Algo/Geometry/normal.hpp
parents
b9ae811b
5ebd12a3
Changes
31
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
109 additions
and
134 deletions
+109
-134
CMakeLists.txt
CMakeLists.txt
+1
-1
include/Algo/Decimation/decimation.hpp
include/Algo/Decimation/decimation.hpp
+1
-1
include/Algo/Decimation/halfEdgeSelector.h
include/Algo/Decimation/halfEdgeSelector.h
+2
-2
include/Algo/Decimation/halfEdgeSelector.hpp
include/Algo/Decimation/halfEdgeSelector.hpp
+2
-2
include/Algo/Export/export.hpp
include/Algo/Export/export.hpp
+0
-2
include/Algo/Filtering/bilateral.h
include/Algo/Filtering/bilateral.h
+16
-5
include/Algo/Geometry/normal.hpp
include/Algo/Geometry/normal.hpp
+25
-48
include/Algo/Import/import2tablesSurface.hpp
include/Algo/Import/import2tablesSurface.hpp
+1
-13
include/Algo/Import/importFileTypes.h
include/Algo/Import/importFileTypes.h
+0
-9
include/Algo/ProgressiveMesh/pmesh.h
include/Algo/ProgressiveMesh/pmesh.h
+4
-4
include/Algo/ProgressiveMesh/pmesh.hpp
include/Algo/ProgressiveMesh/pmesh.hpp
+14
-14
include/Algo/Render/GL2/colorPerFaceRender.h
include/Algo/Render/GL2/colorPerFaceRender.h
+2
-2
include/Algo/Render/GL2/colorPerFaceRender.hpp
include/Algo/Render/GL2/colorPerFaceRender.hpp
+3
-3
include/Algo/Render/GL2/dataPerFaceRender.h
include/Algo/Render/GL2/dataPerFaceRender.h
+1
-1
include/Algo/Render/GL2/dataPerFaceRender.hpp
include/Algo/Render/GL2/dataPerFaceRender.hpp
+1
-1
include/Algo/Selection/collector.h
include/Algo/Selection/collector.h
+2
-0
include/Algo/Selection/collector.hpp
include/Algo/Selection/collector.hpp
+7
-7
include/Geometry/basic.h
include/Geometry/basic.h
+5
-3
include/Geometry/vector_gen.h
include/Geometry/vector_gen.h
+1
-1
include/Topology/generic/cells.h
include/Topology/generic/cells.h
+1
-1
include/Topology/generic/mapCommon.hpp
include/Topology/generic/mapCommon.hpp
+2
-2
include/Utils/Shaders/shaderFlat.frag
include/Utils/Shaders/shaderFlat.frag
+1
-0
include/Utils/Shaders/shaderFlat.geom
include/Utils/Shaders/shaderFlat.geom
+5
-3
include/Utils/Shaders/shaderFlatColor.frag
include/Utils/Shaders/shaderFlatColor.frag
+1
-0
include/Utils/Shaders/shaderIsoLines.frag
include/Utils/Shaders/shaderIsoLines.frag
+1
-0
include/Utils/pointSprite.frag
include/Utils/pointSprite.frag
+1
-0
include/Utils/qem.h
include/Utils/qem.h
+2
-2
include/Utils/svg.h
include/Utils/svg.h
+2
-2
src/Utils/GLSLShader.cpp
src/Utils/GLSLShader.cpp
+1
-1
src/Utils/Qt/qtSimple.cpp
src/Utils/Qt/qtSimple.cpp
+1
-1
src/Utils/svg.cpp
src/Utils/svg.cpp
+3
-3
No files found.
CMakeLists.txt
View file @
46711425
...
...
@@ -142,7 +142,7 @@ IF (WITH_QT)
ADD_DEFINITIONS
(
${
QT_DEFINITIONS
}
)
find_package
(
QGLViewer REQUIRED
)
SET
(
CGoGN_EXT_INCLUDES
${
CGoGN_EXT_INCLUDES
}
${
QT_INCLUDE_DIR
}
${
QGLVIEWER_INCLUDE_DIR
}
)
SET
(
CGoGN_EXT_LIBS
${
CGoGN_EXT_LIBS
}
${
QT_LIBRARIES
}
${
QGLVIEWER_LIBRARIES
}
)
SET
(
CGoGN_EXT_LIBS
${
QT_LIBRARIES
}
${
QGLVIEWER_LIBRARIES
}
${
CGoGN_EXT_LIBS
}
)
ENDIF
(
WITH_QT
)
IF
(
WITH_GLEWMX
)
...
...
include/Algo/Decimation/decimation.hpp
View file @
46711425
...
...
@@ -195,7 +195,7 @@ int decimate(
return
-
1
;
// init failed
}
unsigned
int
nbVertices
=
Algo
::
Topo
::
getNbOrbits
<
VERTEX
>
(
map
)
;
unsigned
int
nbVertices
=
Algo
::
Topo
::
getNbOrbits
<
VERTEX
>
(
map
)
;
bool
finished
=
false
;
while
(
!
finished
)
...
...
include/Algo/Decimation/halfEdgeSelector.h
View file @
46711425
...
...
@@ -230,8 +230,8 @@ public:
m_approxindex_normal
(
-
1
),
m_attrindex_normal
(
-
1
)
{
halfEdgeInfo
=
m
.
template
addAttribute
<
HalfEdgeInfo
,
DART
>(
"halfEdgeInfo"
)
;
m_quadric
=
m
.
template
addAttribute
<
Utils
::
QuadricNd
<
REAL
,
9
>,
VERTEX
>
(
"hQEMextNormal-quadric"
)
;
halfEdgeInfo
=
m
.
template
addAttribute
<
HalfEdgeInfo
,
DART
,
MAP
>(
"halfEdgeInfo"
)
;
m_quadric
=
m
.
template
addAttribute
<
Utils
::
QuadricNd
<
REAL
,
9
>,
VERTEX
,
MAP
>
(
"hQEMextNormal-quadric"
)
;
}
~
HalfEdgeSelector_QEMextColorNormal
()
{
...
...
include/Algo/Decimation/halfEdgeSelector.hpp
View file @
46711425
...
...
@@ -619,7 +619,7 @@ bool HalfEdgeSelector_QEMextColorNormal<PFP>::init()
++ok ;
m_approxindex_color = approxindex ;
m_attrindex_color = attrindex ;
m_color = m.template getAttribute<typename PFP::VEC3, VERTEX
>("color") ;
m_color = m.template getAttribute<typename PFP::VEC3, VERTEX, MAP
>("color") ;
assert(m_color.isValid() || !"EdgeSelector_QEMextColor: color attribute is not valid") ;
if (!saved)
{
...
...
@@ -632,7 +632,7 @@ bool HalfEdgeSelector_QEMextColorNormal<PFP>::init()
++ok ;
m_approxindex_normal = approxindex ;
m_attrindex_normal = attrindex ;
m_normal = m.template getAttribute<typename PFP::VEC3, VERTEX
>("normal") ;
m_normal = m.template getAttribute<typename PFP::VEC3, VERTEX, MAP
>("normal") ;
assert(m_normal.isValid() || !"EdgeSelector_QEMextColorNormal: normal attribute is not valid") ;
if (!saved)
{
...
...
include/Algo/Export/export.hpp
View file @
46711425
...
...
@@ -46,7 +46,6 @@ template <typename PFP>
bool
exportPLY
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
const
char
*
filename
,
bool
binary
)
{
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
// open file
std
::
ofstream
out
;
...
...
@@ -989,7 +988,6 @@ template <typename PFP>
bool
exportChoupi
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
const
char
*
filename
)
{
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
std
::
ofstream
out
(
filename
,
std
::
ios
::
out
)
;
if
(
!
out
.
good
())
...
...
include/Algo/Filtering/bilateral.h
View file @
46711425
...
...
@@ -59,13 +59,24 @@ void sigmaBilateral(typename PFP::MAP& map, const VertexAttribute<typename PFP::
sigmaS
=
2.5
f
*
(
sumAngles
/
float
(
nbEdges
)
)
;
}
/**
* \brief Function applying a bilateral filter smoothing on the mesh.
* \param map the map of the mesh
* \param positionIn the current positions container of the mesh
* \param positionOut the smoothed positions after the function call
* \param normal the normals
*/
template
<
typename
PFP
>
void
filterBilateral
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position2
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
normal
)
void
filterBilateral
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
positionIn
,
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
positionOut
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
normal
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
float
sigmaC
,
sigmaS
;
sigmaBilateral
<
PFP
>
(
map
,
positio
n
,
normal
,
sigmaC
,
sigmaS
)
;
sigmaBilateral
<
PFP
>
(
map
,
positionI
n
,
normal
,
sigmaC
,
sigmaS
)
;
TraversorV
<
typename
PFP
::
MAP
>
t
(
map
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
...
...
@@ -80,7 +91,7 @@ void filterBilateral(typename PFP::MAP& map, const VertexAttribute<typename PFP:
Traversor2VE
<
typename
PFP
::
MAP
>
te
(
map
,
d
)
;
for
(
Dart
it
=
te
.
begin
();
it
!=
te
.
end
();
it
=
te
.
next
())
{
VEC3
vec
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
map
,
it
,
positio
n
)
;
VEC3
vec
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
map
,
it
,
positionI
n
)
;
float
h
=
normal_d
*
vec
;
float
t
=
vec
.
norm
()
;
float
wcs
=
exp
(
(
-
1.0
f
*
(
t
*
t
)
/
(
2.0
f
*
sigmaC
*
sigmaC
)
)
+
(
-
1.0
f
*
(
h
*
h
)
/
(
2.0
f
*
sigmaS
*
sigmaS
)
)
)
;
...
...
@@ -88,10 +99,10 @@ void filterBilateral(typename PFP::MAP& map, const VertexAttribute<typename PFP:
normalizer
+=
wcs
;
}
position2
[
d
]
=
positio
n
[
d
]
+
((
sum
/
normalizer
)
*
normal_d
)
;
positionOut
[
d
]
=
positionI
n
[
d
]
+
((
sum
/
normalizer
)
*
normal_d
)
;
}
else
position2
[
d
]
=
positio
n
[
d
]
;
positionOut
[
d
]
=
positionI
n
[
d
]
;
}
}
...
...
include/Algo/Geometry/normal.hpp
View file @
46711425
...
...
@@ -28,6 +28,8 @@
#include "Topology/generic/traversor/traversorCell.h"
#include "Topology/generic/traversor/traversor2.h"
#include "Algo/Parallel/parallel_foreach.h"
#include <cmath>
namespace
CGoGN
...
...
@@ -45,8 +47,6 @@ namespace Geometry
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
triangleNormal
(
typename
PFP
::
MAP
&
map
,
Face
f
,
const
V_ATT
&
position
)
{
CHECK_ATTRIBUTEHANDLER_ORBIT
(
V_ATT
,
VERTEX
);
typename
V_ATT
::
DATA_TYPE
N
=
Geom
::
triangleNormal
(
position
[
f
.
dart
],
position
[
map
.
phi1
(
f
)],
...
...
@@ -59,8 +59,6 @@ typename V_ATT::DATA_TYPE triangleNormal(typename PFP::MAP& map, Face f, const V
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
newellNormal
(
typename
PFP
::
MAP
&
map
,
Face
f
,
const
V_ATT
&
position
)
{
CHECK_ATTRIBUTEHANDLER_ORBIT
(
V_ATT
,
VERTEX
);
typedef
typename
V_ATT
::
DATA_TYPE
VEC3
;
VEC3
N
(
0
);
...
...
@@ -80,8 +78,6 @@ typename V_ATT::DATA_TYPE newellNormal(typename PFP::MAP& map, Face f, const V_A
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
faceNormal
(
typename
PFP
::
MAP
&
map
,
Face
f
,
const
V_ATT
&
position
)
{
CHECK_ATTRIBUTEHANDLER_ORBIT
(
V_ATT
,
VERTEX
);
if
(
map
.
faceDegree
(
f
)
==
3
)
return
triangleNormal
<
PFP
>
(
map
,
f
,
position
)
;
else
...
...
@@ -91,8 +87,6 @@ typename V_ATT::DATA_TYPE faceNormal(typename PFP::MAP& map, Face f, const V_ATT
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
vertexNormal
(
typename
PFP
::
MAP
&
map
,
Vertex
v
,
const
V_ATT
&
position
)
{
CHECK_ATTRIBUTEHANDLER_ORBIT
(
V_ATT
,
VERTEX
);
typedef
typename
V_ATT
::
DATA_TYPE
VEC3
;
VEC3
N
(
0
)
;
...
...
@@ -104,12 +98,8 @@ typename V_ATT::DATA_TYPE vertexNormal(typename PFP::MAP& map, Vertex v, const V
{
VEC3
v1
=
vectorOutOfDart
<
PFP
>
(
map
,
f
.
dart
,
position
)
;
VEC3
v2
=
vectorOutOfDart
<
PFP
>
(
map
,
map
.
phi_1
(
f
),
position
)
;
typename
VEC3
::
DATA_TYPE
l
=
(
v1
.
norm2
()
*
v2
.
norm2
());
if
(
l
>
(
typename
VEC3
::
DATA_TYPE
(
0.0
))
)
{
n
*=
convexFaceArea
<
PFP
>
(
map
,
f
,
position
)
/
l
;
N
+=
n
;
}
n
*=
convexFaceArea
<
PFP
>
(
map
,
f
,
position
)
/
(
v1
.
norm2
()
*
v2
.
norm2
())
;
N
+=
n
;
}
});
...
...
@@ -120,7 +110,6 @@ typename V_ATT::DATA_TYPE vertexNormal(typename PFP::MAP& map, Vertex v, const V
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
vertexBorderNormal
(
typename
PFP
::
MAP
&
map
,
Vertex
v
,
const
V_ATT
&
position
)
{
CHECK_ATTRIBUTEHANDLER_ORBIT
(
V_ATT
,
VERTEX
);
assert
(
map
.
dimension
()
==
3
);
typedef
typename
V_ATT
::
DATA_TYPE
VEC3
;
...
...
@@ -156,43 +145,39 @@ typename V_ATT::DATA_TYPE vertexBorderNormal(typename PFP::MAP& map, Vertex v, c
template
<
typename
PFP
,
typename
V_ATT
,
typename
F_ATT
>
void
computeNormalFaces
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
F_ATT
&
face_normal
,
unsigned
int
thread
)
{
CHECK_ATTRIBUTEHANDLER_ORBIT
(
V_ATT
,
VERTEX
);
CHECK_ATTRIBUTEHANDLER_ORBIT
(
F_ATT
,
FACE
);
if
((
CGoGN
::
Parallel
::
NumberOfThreads
>
1
)
&&
(
thread
==
0
))
if
((
CGoGN
::
Parallel
::
NumberOfThreads
>
1
)
&&
(
thread
==
0
))
{
Parallel
::
computeNormalFaces
<
PFP
,
V_ATT
,
F_ATT
>
(
map
,
position
,
face_normal
);
Parallel
::
computeNormalFaces
<
PFP
,
V_ATT
,
F_ATT
>
(
map
,
position
,
face_normal
);
return
;
}
foreach_cell
<
FACE
>
(
map
,
[
&
]
(
Face
f
)
{
face_normal
[
f
]
=
faceNormal
<
PFP
>
(
map
,
f
,
position
)
;
},
AUTO
,
thread
);
},
AUTO
,
thread
);
}
template
<
typename
PFP
,
typename
V_ATT
>
void
computeNormalVertices
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
V_ATT
&
normal
,
unsigned
int
thread
)
{
CHECK_ATTRIBUTEHANDLER_ORBIT
(
V_ATT
,
VERTEX
);
if
((
CGoGN
::
Parallel
::
NumberOfThreads
>
1
)
&&
(
thread
==
0
))
if
((
CGoGN
::
Parallel
::
NumberOfThreads
>
1
)
&&
(
thread
==
0
))
{
Parallel
::
computeNormalVertices
<
PFP
,
V_ATT
>
(
map
,
position
,
normal
);
Parallel
::
computeNormalVertices
<
PFP
,
V_ATT
>
(
map
,
position
,
normal
);
return
;
}
foreach_cell
<
VERTEX
>
(
map
,
[
&
]
(
Vertex
v
)
{
normal
[
v
]
=
vertexNormal
<
PFP
>
(
map
,
v
,
position
)
;
},
FORCE_CELL_MARKING
,
thread
);
},
FORCE_CELL_MARKING
,
thread
);
}
template
<
typename
PFP
,
typename
V_ATT
>
typename
PFP
::
REAL
computeAngleBetweenNormalsOnEdge
(
typename
PFP
::
MAP
&
map
,
Edge
e
,
const
V_ATT
&
position
)
{
CHECK_ATTRIBUTEHANDLER_ORBIT
(
V_ATT
,
VERTEX
);
typedef
typename
V_ATT
::
DATA_TYPE
VEC3
;
if
(
map
.
isBoundaryEdge
(
e
))
...
...
@@ -226,58 +211,50 @@ typename PFP::REAL computeAngleBetweenNormalsOnEdge(typename PFP::MAP& map, Edge
template
<
typename
PFP
,
typename
V_ATT
,
typename
E_ATT
>
void
computeAnglesBetweenNormalsOnEdges
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
E_ATT
&
angles
,
unsigned
int
thread
)
{
CHECK_ATTRIBUTEHANDLER_ORBIT
(
V_ATT
,
VERTEX
);
CHECK_ATTRIBUTEHANDLER_ORBIT
(
E_ATT
,
EDGE
);
if
((
CGoGN
::
Parallel
::
NumberOfThreads
>
1
)
&&
(
thread
==
0
))
if
((
CGoGN
::
Parallel
::
NumberOfThreads
>
1
)
&&
(
thread
==
0
))
{
Parallel
::
computeAnglesBetweenNormalsOnEdges
<
PFP
,
V_ATT
,
E_ATT
>
(
map
,
position
,
angles
);
Parallel
::
computeAnglesBetweenNormalsOnEdges
<
PFP
,
V_ATT
,
E_ATT
>
(
map
,
position
,
angles
);
return
;
}
foreach_cell
<
EDGE
>
(
map
,
[
&
]
(
Edge
e
)
{
angles
[
e
]
=
computeAngleBetweenNormalsOnEdge
<
PFP
>
(
map
,
e
,
position
)
;
},
AUTO
,
thread
);
},
AUTO
,
thread
);
}
namespace
Parallel
{
template
<
typename
PFP
,
typename
V_ATT
>
void
computeNormalVertices
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
V_ATT
&
normal
)
{
CHECK_ATTRIBUTEHANDLER_ORBIT
(
V_ATT
,
VERTEX
);
CGoGN
::
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,
[
&
]
(
Vertex
v
,
unsigned
int
/*thr*/
)
CGoGN
::
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
,
unsigned
int
/*thr*/
)
{
normal
[
v
]
=
vertexNormal
<
PFP
>
(
map
,
v
,
position
)
;
},
FORCE_CELL_MARKING
);
},
true
,
FORCE_CELL_MARKING
);
}
template
<
typename
PFP
,
typename
V_ATT
,
typename
F_ATT
>
void
computeNormalFaces
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
F_ATT
&
normal
)
{
CHECK_ATTRIBUTEHANDLER_ORBIT
(
V_ATT
,
VERTEX
);
CHECK_ATTRIBUTEHANDLER_ORBIT
(
F_ATT
,
FACE
);
CGoGN
::
Parallel
::
foreach_cell
<
FACE
>
(
map
,
[
&
]
(
Face
f
,
unsigned
int
/*thr*/
)
CGoGN
::
Parallel
::
foreach_cell
<
FACE
>
(
map
,[
&
](
Face
f
,
unsigned
int
thr
)
{
normal
[
f
]
=
faceNormal
<
PFP
>
(
map
,
f
,
position
)
;
});
}
,
true
,
AUTO
);
}
template
<
typename
PFP
,
typename
V_ATT
,
typename
E_ATT
>
void
computeAnglesBetweenNormalsOnEdges
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
E_ATT
&
angles
)
{
CHECK_ATTRIBUTEHANDLER_ORBIT
(
V_ATT
,
VERTEX
);
CHECK_ATTRIBUTEHANDLER_ORBIT
(
E_ATT
,
EDGE
);
CGoGN
::
Parallel
::
foreach_cell
<
EDGE
>
(
map
,[
&
](
Edge
e
,
unsigned
int
/*thr*/
)
CGoGN
::
Parallel
::
foreach_cell
<
EDGE
>
(
map
,[
&
](
Edge
e
,
unsigned
int
thr
)
{
angles
[
e
]
=
computeAngleBetweenNormalsOnEdge
<
PFP
>
(
map
,
e
,
position
)
;
});
}
,
true
,
AUTO
);
}
}
// namespace Parallel
...
...
include/Algo/Import/import2tablesSurface.hpp
View file @
46711425
...
...
@@ -73,18 +73,6 @@ bool MeshTablesSurface<PFP>::importMesh(const std::string& filename, std::vector
CGoGNout << "TYPE: PLY" << CGoGNendl;
return importPly(filename, attrNames);
break;
/* case PLYPTM:
CGoGNout << "TYPE: PLYPTM" << CGoGNendl;
return importPlyPTM(filename, attrNames);
break;
*/
case
PLYSLFgeneric
:
CGoGNout
<<
"TYPE: PLYSLFgeneric"
<<
CGoGNendl
;
return
importPlySLFgeneric
(
filename
,
attrNames
);
break
;
case
PLYSLFgenericBin
:
CGoGNout
<<
"TYPE: PLYSLFgenericBin"
<<
CGoGNendl
;
return
importPlySLFgenericBin
(
filename
,
attrNames
);
break
;
case OBJ:
CGoGNout << "TYPE: OBJ" << CGoGNendl;
return importObj(filename, attrNames);
...
...
@@ -772,7 +760,7 @@ bool MeshTablesSurface<PFP>::importPlySLFgeneric(const std::string& filename, st
// Define containers
VertexAttribute<VEC3, MAP> positions = m_map.template getAttribute<VEC3, VERTEX, MAP>("position") ;
;
if (!positions.isValid())
positions = m_map.template addAttribute<VEC3, VERTEX, MAP>("position") ;
attrNames.push_back(positions.name()) ;
...
...
include/Algo/Import/importFileTypes.h
View file @
46711425
...
...
@@ -48,15 +48,6 @@ namespace Import
if
((
filename
.
rfind
(
".meshbin"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".MESHBIN"
)
!=
std
::
string
::
npos
))
return
MESHBIN
;
/* if ((filename.rfind(".plyptm")!=std::string::npos) || (filename.rfind(".PLYGEN")!=std::string::npos))
return PLYPTM;
*/
if
((
filename
.
rfind
(
".plyPTMextBin"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".plySHrealBin"
)
!=
std
::
string
::
npos
))
return
PLYSLFgenericBin
;
if
((
filename
.
rfind
(
".plyPTMext"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".plySHreal"
)
!=
std
::
string
::
npos
))
return
PLYSLFgeneric
;
if
((
filename
.
rfind
(
".ply"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".PLY"
)
!=
std
::
string
::
npos
))
return
PLY
;
...
...
include/Algo/ProgressiveMesh/pmesh.h
View file @
46711425
...
...
@@ -59,7 +59,7 @@ private:
MAP
&
m_map
;
VertexAttribute
<
VEC3
,
MAP
>&
position
;
DartMarker
<
MAP
>&
inactiveMarker
;
DartMarker
<
MAP
>&
inactiveMarker
;
Algo
::
Surface
::
Decimation
::
Selector
<
PFP
>*
m_selector
;
std
::
vector
<
Algo
::
Surface
::
Decimation
::
ApproximatorGen
<
PFP
>*>
m_approximators
;
...
...
@@ -81,15 +81,15 @@ private:
public:
ProgressiveMesh
(
MAP
&
map
,
DartMarker
<
MAP
>&
inactive
,
DartMarker
<
MAP
>&
inactive
,
Algo
::
Surface
::
Decimation
::
SelectorType
s
,
Algo
::
Surface
::
Decimation
::
ApproximatorType
a
,
VertexAttribute
<
VEC3
,
MAP
>&
position
)
;
ProgressiveMesh
(
MAP
&
map
,
DartMarker
&
inactive
,
MAP
&
map
,
DartMarker
<
MAP
>
&
inactive
,
Algo
::
Surface
::
Decimation
::
Selector
<
PFP
>*
selector
,
std
::
vector
<
Algo
::
Surface
::
Decimation
::
ApproximatorGen
<
PFP
>*>&
approximators
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
)
;
VertexAttribute
<
VEC3
,
MAP
>&
position
)
;
~
ProgressiveMesh
()
;
bool
initOk
()
{
return
m_initOk
;
}
...
...
include/Algo/ProgressiveMesh/pmesh.hpp
View file @
46711425
...
...
@@ -39,13 +39,13 @@ namespace PMesh
template
<
typename
PFP
>
ProgressiveMesh
<
PFP
>::
ProgressiveMesh
(
MAP
&
map
,
DartMarker
<
MAP
>&
inactive
,
DartMarker
<
MAP
>&
inactive
,
Algo
::
Surface
::
Decimation
::
SelectorType
s
,
Algo
::
Surface
::
Decimation
::
ApproximatorType
a
,
VertexAttribute
<
VEC3
,
MAP
>&
pos
)
:
m_map
(
map
),
position
(
pos
),
position
(
pos
),
inactiveMarker
(
inactive
)
{
CGoGNout
<<
" creating approximator and predictor.."
<<
CGoGNflush
;
...
...
@@ -87,22 +87,22 @@ ProgressiveMesh<PFP>::ProgressiveMesh(
switch
(
s
)
{
case
Algo
::
Surface
::
Decimation
::
S_MapOrder
:
{
m_selector
=
new
Algo
::
Surface
::
Decimation
::
EdgeSelector_MapOrder
<
PFP
>
(
m_map
,
positionsTable
,
m_approximators
)
;
m_selector
=
new
Algo
::
Surface
::
Decimation
::
EdgeSelector_MapOrder
<
PFP
>
(
m_map
,
position
,
m_approximators
)
;
break
;
}
case
Algo
::
Surface
::
Decimation
::
S_Random
:
{
m_selector
=
new
Algo
::
Surface
::
Decimation
::
EdgeSelector_Random
<
PFP
>
(
m_map
,
positionsTable
,
m_approximators
)
;
m_selector
=
new
Algo
::
Surface
::
Decimation
::
EdgeSelector_Random
<
PFP
>
(
m_map
,
position
,
m_approximators
)
;
break
;
}
case
Algo
::
Surface
::
Decimation
::
S_EdgeLength
:
{
m_selector
=
new
Algo
::
Surface
::
Decimation
::
EdgeSelector_Length
<
PFP
>
(
m_map
,
positionsTable
,
m_approximators
)
;
m_selector
=
new
Algo
::
Surface
::
Decimation
::
EdgeSelector_Length
<
PFP
>
(
m_map
,
position
,
m_approximators
)
;
break
;
}
case
Algo
::
Surface
::
Decimation
::
S_QEM
:
{
m_selector
=
new
Algo
::
Surface
::
Decimation
::
EdgeSelector_QEM
<
PFP
>
(
m_map
,
positionsTable
,
m_approximators
)
;
m_selector
=
new
Algo
::
Surface
::
Decimation
::
EdgeSelector_QEM
<
PFP
>
(
m_map
,
position
,
m_approximators
)
;
break
;
}
case
Algo
::
Surface
::
Decimation
::
S_MinDetail
:
{
m_selector
=
new
Algo
::
Surface
::
Decimation
::
EdgeSelector_MinDetail
<
PFP
>
(
m_map
,
positionsTable
,
m_approximators
)
;
m_selector
=
new
Algo
::
Surface
::
Decimation
::
EdgeSelector_MinDetail
<
PFP
>
(
m_map
,
position
,
m_approximators
)
;
break
;
}
case
Algo
::
Surface
::
Decimation
::
S_Curvature
:
{
m_selector
=
new
Algo
::
Surface
::
Decimation
::
EdgeSelector_Curvature
<
PFP
>
(
m_map
,
positionsTable
,
m_approximators
)
;
m_selector
=
new
Algo
::
Surface
::
Decimation
::
EdgeSelector_Curvature
<
PFP
>
(
m_map
,
position
,
m_approximators
)
;
break
;
}
}
CGoGNout
<<
"..done"
<<
CGoGNendl
;
...
...
@@ -137,11 +137,11 @@ ProgressiveMesh<PFP>::ProgressiveMesh(
template
<
typename
PFP
>
ProgressiveMesh
<
PFP
>::
ProgressiveMesh
(
MAP
&
map
,
DartMarker
&
inactive
,
MAP
&
map
,
DartMarker
<
MAP
>
&
inactive
,
Algo
::
Surface
::
Decimation
::
Selector
<
PFP
>*
selector
,
std
::
vector
<
Algo
::
Surface
::
Decimation
::
ApproximatorGen
<
PFP
>*>&
approximators
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
VertexAttribute
<
VEC3
,
MAP
>&
position
)
:
m_map
(
map
),
m_selector
(
selector
),
m_approximators
(
approximators
),
positionsTable
(
position
),
inactiveMarker
(
inactive
)
m_map
(
map
),
position
(
position
),
inactiveMarker
(
inactive
),
m_selector
(
selector
),
m_approximators
(
approximators
)
{
CGoGNout
<<
" initializing approximators.."
<<
CGoGNflush
;
for
(
typename
std
::
vector
<
Algo
::
Surface
::
Decimation
::
ApproximatorGen
<
PFP
>*>::
iterator
it
=
m_approximators
.
begin
();
it
!=
m_approximators
.
end
();
++
it
)
...
...
@@ -187,7 +187,7 @@ ProgressiveMesh<PFP>::~ProgressiveMesh()
template
<
typename
PFP
>
void
ProgressiveMesh
<
PFP
>::
createPM
(
unsigned
int
percentWantedVertices
)
{
unsigned
int
nbVertices
=
m_map
.
template
getNbOrbits
<
VERTEX
>()
;
unsigned
int
nbVertices
=
Algo
::
Topo
::
getNbOrbits
<
VERTEX
>
(
m_map
)
;
unsigned
int
nbWantedVertices
=
nbVertices
*
percentWantedVertices
/
100
;
CGoGNout
<<
" creating PM ("
<<
nbVertices
<<
" vertices).."
<<
/* flush */
CGoGNendl
;
...
...
@@ -281,7 +281,7 @@ void ProgressiveMesh<PFP>::coarsen()
edgeCollapse
(
vs
)
;
// collapse edge
Algo
::
Topo
::
setOrbitEmbedding
<
VERTEX
>
(
m_map
,
d2
,
s
->
getApproxV
())
;
Algo
::
Topo
::
setOrbitEmbedding
<
VERTEX
>
(
m_map
,
d2
,
v
s
->
getApproxV
())
;
Algo
::
Topo
::
setOrbitEmbedding
<
EDGE
>
(
m_map
,
d2
,
vs
->
getApproxE1
())
;
Algo
::
Topo
::
setOrbitEmbedding
<
EDGE
>
(
m_map
,
dd2
,
vs
->
getApproxE2
())
;
...
...
@@ -544,7 +544,7 @@ float ProgressiveMesh<PFP>::computeDistance2()
float distance = 0; // sum of 2-distance between original vertices and new vertices
gotoLevel(0) ; // mesh reconstruction from detail vectors
DartMarker
mUpdate(m_map) ;
DartMarker<MAP>
mUpdate(m_map) ;
for(Dart d = m_map.begin(); d != m_map.end(); m_map.next(d)) // vertices loop
{
if(!mUpdate.isMarked(d))
...
...
include/Algo/Render/GL2/colorPerFaceRender.h
View file @
46711425
...
...
@@ -71,7 +71,7 @@ public:
*/
template
<
typename
PFP
,
unsigned
int
ORBIT
>
void
updateVBO
(
Utils
::
VBO
&
vboPosition
,
Utils
::
VBO
&
vboColor
,
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
const
AttributeHandler
<
typename
PFP
::
VEC3
,
ORBIT
>&
colorPerXXX
)
;
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
positions
,
const
AttributeHandler
<
typename
PFP
::
VEC3
,
ORBIT
,
typename
PFP
::
MAP
::
IMPL
>&
colorPerXXX
)
;
/**
* update drawing buffers
...
...
@@ -85,7 +85,7 @@ public:
*/
template
<
typename
PFP
,
unsigned
int
ORBIT
>
void
updateVBO
(
Utils
::
VBO
&
vboPosition
,
Utils
::
VBO
&
vboNormal
,
Utils
::
VBO
&
vboColor
,
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
normals
,
const
AttributeHandler
<
typename
PFP
::
VEC3
,
ORBIT
>&
colorPerXXX
)
;
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
positions
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
normals
,
const
AttributeHandler
<
typename
PFP
::
VEC3
,
ORBIT
,
typename
PFP
::
MAP
::
IMPL
>&
colorPerXXX
)
;
/**
...
...
include/Algo/Render/GL2/colorPerFaceRender.hpp
View file @
46711425
...
...
@@ -51,7 +51,7 @@ m_nbTris(0)
template
<
typename
PFP
,
unsigned
int
ORBIT
>
void
ColorPerFaceRender
::
updateVBO
(
Utils
::
VBO
&
vboPosition
,
Utils
::
VBO
&
vboColor
,
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
const
AttributeHandler
<
typename
PFP
::
VEC3
,
ORBIT
>&
colorPerXXX
)
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
positions
,
const
AttributeHandler
<
typename
PFP
::
VEC3
,
ORBIT
,
typename
PFP
::
MAP
::
IMPL
>&
colorPerXXX
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
...
...
@@ -101,8 +101,8 @@ void ColorPerFaceRender::updateVBO(Utils::VBO& vboPosition, Utils::VBO& vboColor
template
<
typename
PFP
,
unsigned
int
ORBIT
>
void
ColorPerFaceRender
::
updateVBO
(
Utils
::
VBO
&
vboPosition
,
Utils
::
VBO
&
vboNormal
,
Utils
::
VBO
&
vboColor
,
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
normals
,
const
AttributeHandler
<
typename
PFP
::
VEC3
,
ORBIT
>&
colorPerXXX
)
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
positions
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
normals
,
const
AttributeHandler
<
typename
PFP
::
VEC3
,
ORBIT
,
typename
PFP
::
MAP
::
IMPL
>&
colorPerXXX
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
...
...
include/Algo/Render/GL2/dataPerFaceRender.h
View file @
46711425
...
...
@@ -70,7 +70,7 @@ public:
*/
template
<
typename
PFP
,
unsigned
int
ORBIT
,
typename
T
>
void
updateVBO
(
Utils
::
VBO
&
vboPosition
,
Utils
::
VBO
&
vboData
,
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
const
AttributeHandler
<
T
,
ORBIT
>&
dataPerXXX
)
;
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
positions
,
const
AttributeHandler
<
T
,
ORBIT
,
typename
PFP
::
MAP
>&
dataPerXXX
)
;
/**
* draw
...
...
include/Algo/Render/GL2/dataPerFaceRender.hpp
View file @
46711425
...
...
@@ -50,7 +50,7 @@ m_nbTris(0)
template
<
typename
PFP
,
unsigned
int
ORBIT
,
typename
T
>
void
DataPerFaceRender
::
updateVBO
(
Utils
::
VBO
&
vboPosition
,
Utils
::
VBO
&
vboData
,
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
const
AttributeHandler
<
T
,
ORBIT
>&
dataPerXXX
)
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
positions
,
const
AttributeHandler
<
T
,
ORBIT
,
typename
PFP
::
MAP
>&
dataPerXXX
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
...
...
include/Algo/Selection/collector.h
View file @
46711425
...
...
@@ -28,6 +28,8 @@
#include "Container/fakeAttribute.h"
#include "Geometry/basic.h"
#include "Topology/generic/traversor/traversor2.h"
/*****************************************
* Class hierarchy :
* Collector (virtual)
...
...
include/Algo/Selection/collector.hpp
View file @
46711425
...
...
@@ -119,7 +119,7 @@ void Collector_OneRing<PFP>::collectAll(Dart d)
this->insideVertices.push_back(d);
foreach_incident2<EDGE>(this->map, Vertex(d), [&] (Edge e)
foreach_incident2<EDGE>(this->map, Vertex(d), [&] (Edge e)
{
this->insideEdges.push_back(e);
this->insideFaces.push_back(e.dart);
...
...
@@ -133,7 +133,7 @@ void Collector_OneRing<PFP>::collectBorder(Dart d)
this->init(d);
this->border.reserve(12);
foreach_incident2<FACE>(this->map, Vertex(d), [&] (Face f)
foreach_incident2<FACE>(this->map, Vertex(d), [&] (Face f)
{
this->border.push_back(this->map.phi1(f.dart));
});
...
...
@@ -146,7 +146,7 @@ typename PFP::REAL Collector_OneRing<PFP>::computeArea(const VertexAttribute<VEC
REAL area = 0;
for (std::vector<Face>::const_iterator it = this->insideFaces.begin(); it != this->insideFaces.end(); ++it)
for (std::vector<Face>::const_iterator it = this->insideFaces.begin(); it != this->insideFaces.end(); ++it)
area += Algo::Surface::Geometry::triangleArea<PFP>(this->map, *it, pos);
return area;
...
...
@@ -169,7 +169,7 @@ void Collector_OneRing<PFP>::computeNormalCyclesTensor (const VertexAttribute<VE
// collect edges on the border
// TODO : should be an option ?
// TODO : not boundary safe
for (std::vector<Dart>::const_iterator it = this->border.begin(); it != this->border.end(); ++it)
for (std::vector<Dart>::const_iterator it = this->border.begin(); it != this->border.end(); ++it)
{
const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
tensor += Geom::transposed_vectors_mult(e,e) * edgeangle[*it] * (1 / e.norm()) ;
...
...
@@ -196,7 +196,7 @@ void Collector_OneRing<PFP>::computeNormalCyclesTensor (const VertexAttribute<VE
// collect edges on the border
// TODO : should be an option ?
// TODO : not boundary safe
for (std::vector<Dart>::const_iterator it = this->border.begin(); it != this->border.end(); ++it)
for (std::vector<Dart>::const_iterator it = this->border.begin(); it != this->border.end(); ++it)
{
const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
const REAL edgeangle = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(this->map, *it, pos) ;
...
...
@@ -518,12 +518,12 @@ void Collector_WithinSphere<PFP>::computeNormalCyclesTensor(const VertexAttribut
tensor += Geom::transposed_vectors_mult(e,e) * edgeangle * (1 / e.norm()) ;
}
// collect edges crossing the neighborhood's border
for (std::vector<Dart>::const_
iterator it = this->border.begin(); it != this->border.end(); ++it)
for (std::vector<Dart>::
iterator it = this->border.begin(); it != this->border.end(); ++it)
{
const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
REAL alpha ;
Algo::Surface::Geometry::intersectionSphereEdge<PFP>(this->map, centerPosition, radius, *it, pos, alpha) ;
const REAL edgeangle = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(this->map, *it
, pos) ;
const REAL edgeangle = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(this->map, Edge(*it)
, pos) ;
tensor += Geom::transposed_vectors_mult(e,e) * edgeangle * (1 / e.norm()) * alpha ;
}
...
...