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
CGoGN
CGoGN
Commits
437409f6
Commit
437409f6
authored
Feb 18, 2014
by
Pierre Kraemer
Browse files
first successfully compiled program !!
parent
0ea6813e
Changes
71
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/clipping.cpp
View file @
437409f6
...
...
@@ -138,21 +138,21 @@ void Clipping::slot_drawFaces(bool b)
void
Clipping
::
slot_explodTopoPhi1
(
double
c
)
{
m_coeffTopoExplod
[
0
]
=
(
float
)
c
;
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
m_coeffTopoExplod
[
0
],
m_coeffTopoExplod
[
1
],
m_coeffTopoExplod
[
2
]);
m_render_topo
->
updateData
(
myMap
,
position
,
m_coeffTopoExplod
[
0
],
m_coeffTopoExplod
[
1
],
m_coeffTopoExplod
[
2
]);
updateGL
();
}
void
Clipping
::
slot_explodTopoPhi2
(
double
c
)
{
m_coeffTopoExplod
[
1
]
=
(
float
)
c
;
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
m_coeffTopoExplod
[
0
],
m_coeffTopoExplod
[
1
],
m_coeffTopoExplod
[
2
]);
m_render_topo
->
updateData
(
myMap
,
position
,
m_coeffTopoExplod
[
0
],
m_coeffTopoExplod
[
1
],
m_coeffTopoExplod
[
2
]);
updateGL
();
}
void
Clipping
::
slot_explodTopoPhi3
(
double
c
)
{
m_coeffTopoExplod
[
2
]
=
(
float
)
c
;
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
m_coeffTopoExplod
[
0
],
m_coeffTopoExplod
[
1
],
m_coeffTopoExplod
[
2
]);
m_render_topo
->
updateData
(
myMap
,
position
,
m_coeffTopoExplod
[
0
],
m_coeffTopoExplod
[
1
],
m_coeffTopoExplod
[
2
]);
updateGL
();
}
...
...
@@ -814,7 +814,7 @@ void Clipping::importMesh(std::string& filename)
updateVBOprimitives
(
Algo
::
Render
::
GL2
::
TRIANGLES
|
Algo
::
Render
::
GL2
::
LINES
|
Algo
::
Render
::
GL2
::
POINTS
)
;
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
m_coeffTopoExplod
[
0
],
m_coeffTopoExplod
[
1
],
m_coeffTopoExplod
[
2
]);
m_render_topo
->
updateData
(
myMap
,
position
,
m_coeffTopoExplod
[
0
],
m_coeffTopoExplod
[
1
],
m_coeffTopoExplod
[
2
]);
m_bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
gPosObj
=
m_bb
.
center
()
;
...
...
@@ -843,7 +843,7 @@ void Clipping::cb_initGL()
// create the render
m_render
=
new
Algo
::
Render
::
GL2
::
MapRender
();
m_render_topo
=
new
Algo
::
Render
::
GL2
::
Topo3Render
();
m_render_topo
=
new
Algo
::
Render
::
GL2
::
Topo3Render
<
PFP
>
();
// create VBO for position
m_positionVBO
=
new
Utils
::
VBO
();
...
...
Apps/Examples/clipping.h
View file @
437409f6
...
...
@@ -70,18 +70,18 @@ struct PFP: public PFP_STANDARD
typedef
EmbeddedMap3
MAP
;
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
PFP
::
VEC3
VEC3
;
class
Clipping
:
public
Utils
::
QT
::
SimpleQT
{
Q_OBJECT
public:
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
VEC3
VEC3
;
//Manip Carte
MAP
myMap
;
VertexAttribute
<
VEC3
>
position
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>
position
;
Dart
dglobal
;
//Render
...
...
@@ -91,7 +91,7 @@ public:
bool
m_drawTopo
;
Algo
::
Render
::
GL2
::
MapRender
*
m_render
;
Algo
::
Render
::
GL2
::
Topo3Render
*
m_render_topo
;
Algo
::
Render
::
GL2
::
Topo3Render
<
PFP
>
*
m_render_topo
;
Geom
::
BoundingBox
<
PFP
::
VEC3
>
m_bb
;
...
...
Apps/Examples/concave_rendering.cpp
View file @
437409f6
...
...
@@ -128,12 +128,13 @@ struct PFP: public PFP_STANDARD
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
PFP
::
VEC3
VEC3
;
// declaration of the map
MAP
myMap
;
// and attribute of position
VertexAttribute
<
VEC3
>
position
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>
position
;
unsigned
int
nb_ears
;
...
...
Apps/Examples/extrusionView.cpp
View file @
437409f6
...
...
@@ -53,6 +53,7 @@ struct PFP: public PFP_STANDARD
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
PFP
::
VEC3
VEC3
;
MAP
myMap
;
...
...
@@ -103,7 +104,7 @@ int main(int argc, char **argv)
QApplication
app
(
argc
,
argv
);
MyQT
sqt
;
VertexAttribute
<
VEC3
>
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
)
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
)
;
// define the face extruded (here a cross)
std
::
vector
<
PFP
::
VEC3
>
objV
;
...
...
Apps/Examples/mcmesh.h
View file @
437409f6
...
...
@@ -55,6 +55,7 @@ struct PFP: public PFP_STANDARD
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
PFP
::
VEC3
VEC3
;
typedef
unsigned
char
DATATYPE
;
...
...
@@ -76,7 +77,7 @@ public:
bool
m_drawEdges
;
bool
m_drawFaces
;
VertexAttribute
<
VEC3
>
position
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>
position
;
Algo
::
Render
::
GL2
::
MapRender
*
m_render
;
...
...
Apps/Examples/simpleGMap2.h
View file @
437409f6
...
...
@@ -42,6 +42,7 @@ struct PFP: public PFP_STANDARD
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
PFP
::
VEC3
VEC3
;
class
SimpleGMap2
:
public
Utils
::
QT
::
SimpleQT
...
...
@@ -51,7 +52,7 @@ class SimpleGMap2 : public Utils::QT::SimpleQT
public:
MAP
myMap
;
VertexAttribute
<
VEC3
>
position
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>
position
;
SimpleGMap2
()
;
...
...
Apps/Examples/simpleGMap3.cpp
View file @
437409f6
...
...
@@ -132,10 +132,10 @@ void SimpleGMap3::cb_initGL()
float
gWidthObj
=
std
::
max
<
float
>
(
std
::
max
<
float
>
(
tailleX
,
tailleY
),
tailleZ
)
;
setParamObject
(
gWidthObj
,
gPosObj
.
data
());
m_render_topo
=
new
Algo
::
Render
::
GL2
::
Topo3Render
();
m_render_topo
=
new
Algo
::
Render
::
GL2
::
Topo3Render
<
PFP
>
();
m_render_topo
->
setDartWidth
(
2.0
f
);
m_render_topo
->
setInitialDartsColor
(
1.0
f
,
1.0
f
,
1.0
f
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
0.8
f
);
m_render_topo
->
updateData
(
myMap
,
position
,
0.9
f
,
0.9
f
,
0.8
f
);
}
void
SimpleGMap3
::
cb_redraw
()
...
...
Apps/Examples/simpleGMap3.h
View file @
437409f6
...
...
@@ -43,6 +43,7 @@ struct PFP: public PFP_STANDARD
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
PFP
::
VEC3
VEC3
;
class
SimpleGMap3
:
public
Utils
::
QT
::
SimpleQT
...
...
@@ -52,10 +53,10 @@ class SimpleGMap3 : public Utils::QT::SimpleQT
public:
MAP
myMap
;
VertexAttribute
<
VEC3
>
position
;
VolumeAttribute
<
VEC3
>
volume
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>
position
;
VolumeAttribute
<
VEC3
,
MAP_IMPL
>
volume
;
Algo
::
Render
::
GL2
::
Topo3Render
*
m_render_topo
;
Algo
::
Render
::
GL2
::
Topo3Render
<
PFP
>
*
m_render_topo
;
SimpleGMap3
()
;
...
...
Apps/Examples/texturesExample.cpp
View file @
437409f6
...
...
@@ -85,12 +85,11 @@ void TexView::cb_initGL()
m_shader2
->
setSpecular
(
Geom
::
Vec4f
(
0.5
));
registerShader
(
m_shader2
);
glEnable
(
GL_TEXTURE_2D
);
if
(
!
m_obj
.
hasNormals
())
{
VertexAttribute
<
Geom
::
Vec3f
>
normal
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
>
(
"normal"
)
;
VertexAttribute
<
Geom
::
Vec3f
,
MAP_IMPL
>
normal
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
>
(
"normal"
)
;
if
(
!
normal
.
isValid
())
normal
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"normal"
)
;
...
...
@@ -99,7 +98,6 @@ void TexView::cb_initGL()
}
m_nbIndices
=
m_obj
.
createSimpleVBO_PTN
(
m_positionVBO
,
m_texcoordVBO
,
m_normalVBO
);
}
void
TexView
::
cb_redraw
()
...
...
@@ -120,8 +118,6 @@ void TexView::cb_redraw()
glDrawArrays
(
GL_TRIANGLES
,
0
,
m_nbIndices
);
m_shader
->
disableVertexAttribs
();
}
}
void
TexView
::
cb_keyPress
(
int
code
)
...
...
@@ -152,7 +148,6 @@ void TexView::cb_keyPress(int code)
m_shader2
->
setShininess
(
1.0
f
);
m_shader2
->
setSpecular
(
Geom
::
Vec4f
(
0
));
break
;
}
updateGL
();
}
...
...
@@ -179,10 +174,8 @@ void TexView::init(const std::string& fnm, const std::string& fnt)
// send BB info to interface for centering on GL screen
setParamObject
(
lWidthObj
,
lPosObj
.
data
());
}
void
TexView
::
computeImage
()
{
std
::
vector
<
Geom
::
Vec3f
>
colorTable
;
...
...
@@ -213,8 +206,8 @@ void TexView::computeTore()
{
#define NB 96
VertexAttribute
<
VEC3
>
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
VertexAttribute
<
Geom
::
Vec2f
>
texcoord
=
myMap
.
addAttribute
<
Geom
::
Vec2f
,
VERTEX
>
(
"texcoord"
);
VertexAttribute
<
VEC3
,
MAP_IMPL
>
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
VertexAttribute
<
Geom
::
Vec2f
,
MAP_IMPL
>
texcoord
=
myMap
.
addAttribute
<
Geom
::
Vec2f
,
VERTEX
>
(
"texcoord"
);
//Algo::Surface::Modelisation::Polyhedron<PFP> prim(myMap, position);
Algo
::
Surface
::
Tilings
::
Square
::
Tore
<
PFP
>
prim
(
myMap
,
NB
,
NB
);
prim
.
embedIntoTore
(
position
,
40.0
f
,
20.0
f
);
...
...
@@ -245,9 +238,6 @@ void TexView::computeTore()
m_obj
.
setTexCoordAttribute
(
texcoord
);
}
int
main
(
int
argc
,
char
**
argv
)
{
// interface:
...
...
@@ -267,10 +257,8 @@ int main(int argc, char**argv)
tv
.
init
(
""
,
"x"
);
}
tv
.
show
();
// et on attend la fin.
return
app
.
exec
();
}
Apps/Examples/texturesExample.h
View file @
437409f6
...
...
@@ -50,7 +50,9 @@ struct PFP: public PFP_STANDARD
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
PFP
::
VEC3
VEC3
;
/**
* A class for a little interface and rendering
*/
...
...
include/Algo/Geometry/boundingbox.h
View file @
437409f6
...
...
@@ -41,7 +41,7 @@ namespace Geometry
{
template
<
typename
PFP
>
Geom
::
BoundingBox
<
typename
PFP
::
VEC3
>
computeBoundingBox
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
)
Geom
::
BoundingBox
<
typename
PFP
::
VEC3
>
computeBoundingBox
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
)
{
Geom
::
BoundingBox
<
typename
PFP
::
VEC3
>
bb
;
TraversorV
<
typename
PFP
::
MAP
>
t
(
map
)
;
...
...
include/Algo/Geometry/laplacian.h
View file @
437409f6
...
...
@@ -43,41 +43,41 @@ template <typename PFP, typename ATTR_TYPE>
ATTR_TYPE
computeLaplacianTopoVertex
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
ATTR_TYPE
>&
attr
)
;
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
attr
)
;
template
<
typename
PFP
,
typename
ATTR_TYPE
>
ATTR_TYPE
computeLaplacianCotanVertex
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
EdgeAttribute
<
typename
PFP
::
REAL
>&
edgeWeight
,
const
VertexAttribute
<
typename
PFP
::
REAL
>&
vertexArea
,
const
VertexAttribute
<
ATTR_TYPE
>&
attr
)
;
const
EdgeAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
edgeWeight
,
const
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
vertexArea
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
attr
)
;
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
computeLaplacianTopoVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
ATTR_TYPE
>&
attr
,
VertexAttribute
<
ATTR_TYPE
>&
laplacian
)
;
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
attr
,
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
laplacian
)
;
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
computeLaplacianCotanVertices
(
typename
PFP
::
MAP
&
map
,
const
EdgeAttribute
<
typename
PFP
::
REAL
>&
edgeWeight
,
const
VertexAttribute
<
typename
PFP
::
REAL
>&
vertexArea
,
const
VertexAttribute
<
ATTR_TYPE
>&
attr
,
VertexAttribute
<
ATTR_TYPE
>&
laplacian
)
;
const
EdgeAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
edgeWeight
,
const
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
vertexArea
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
attr
,
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
laplacian
)
;
template
<
typename
PFP
>
typename
PFP
::
REAL
computeCotanWeightEdge
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
)
;
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
)
;
template
<
typename
PFP
>
void
computeCotanWeightEdges
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
EdgeAttribute
<
typename
PFP
::
REAL
>&
edgeWeight
)
;
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
EdgeAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
edgeWeight
)
;
}
// namespace Geometry
...
...
@@ -90,19 +90,21 @@ namespace Geometry
{
template
<
typename
PFP
,
typename
ATTR_TYPE
>
ATTR_TYPE
computeLaplacianTopoVertex
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
ATTR_TYPE
>&
attr
)
;
ATTR_TYPE
computeLaplacianTopoVertex
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
attr
)
;
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
computeLaplacianTopoVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
ATTR_TYPE
>&
attr
,
VertexAttribute
<
ATTR_TYPE
>
&
l
ap
lacian
)
;
void
computeLaplacianTopoVertices
(
typename
PFP
::
MAP
&
m
ap
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
attr
,
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
laplacian
)
;
}
// namespace Geometry
}
// namespace Volume
}
// namespace Algo
}
// namespace CGoGN
...
...
include/Algo/Geometry/laplacian.hpp
View file @
437409f6
...
...
@@ -42,7 +42,7 @@ template <typename PFP, typename ATTR_TYPE>
ATTR_TYPE
computeLaplacianTopoVertex
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
ATTR_TYPE
>&
attr
)
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
attr
)
{
ATTR_TYPE
l
(
0
)
;
ATTR_TYPE
value
=
attr
[
d
]
;
...
...
@@ -63,19 +63,21 @@ template <typename PFP, typename ATTR_TYPE>
ATTR_TYPE
computeLaplacianCotanVertex
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
EdgeAttribute
<
typename
PFP
::
REAL
>&
edgeWeight
,
const
VertexAttribute
<
typename
PFP
::
REAL
>&
vertexArea
,
const
VertexAttribute
<
ATTR_TYPE
>&
attr
)
const
EdgeAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
edgeWeight
,
const
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
vertexArea
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
attr
)
{
typedef
typename
PFP
::
REAL
REAL
;
ATTR_TYPE
l
(
0
)
;
typename
PFP
::
REAL
vArea
=
vertexArea
[
d
]
;
REAL
vArea
=
vertexArea
[
d
]
;
ATTR_TYPE
value
=
attr
[
d
]
;
typename
PFP
::
REAL
wSum
=
0
;
REAL
wSum
=
0
;
Traversor2VE
<
typename
PFP
::
MAP
>
t
(
map
,
d
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
{
typename
PFP
::
REAL
w
=
edgeWeight
[
it
]
/
vArea
;
REAL
w
=
edgeWeight
[
it
]
/
vArea
;
l
+=
(
attr
[
map
.
phi1
(
it
)]
-
value
)
*
w
;
wSum
+=
w
;
}
...
...
@@ -87,8 +89,8 @@ ATTR_TYPE computeLaplacianCotanVertex(
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
computeLaplacianTopoVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
ATTR_TYPE
>&
attr
,
VertexAttribute
<
ATTR_TYPE
>&
laplacian
)
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
attr
,
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
laplacian
)
{
TraversorV
<
typename
PFP
::
MAP
>
t
(
map
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
...
...
@@ -98,10 +100,10 @@ void computeLaplacianTopoVertices(
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
computeLaplacianCotanVertices
(
typename
PFP
::
MAP
&
map
,
const
EdgeAttribute
<
typename
PFP
::
REAL
>&
edgeWeight
,
const
VertexAttribute
<
typename
PFP
::
REAL
>&
vertexArea
,
const
VertexAttribute
<
ATTR_TYPE
>&
attr
,
VertexAttribute
<
ATTR_TYPE
>&
laplacian
)
const
EdgeAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
edgeWeight
,
const
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
vertexArea
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
attr
,
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
laplacian
)
{
TraversorV
<
typename
PFP
::
MAP
>
t
(
map
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
...
...
@@ -112,26 +114,29 @@ template <typename PFP>
typename
PFP
::
REAL
computeCotanWeightEdge
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
)
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
if
(
map
.
isBoundaryEdge
(
d
))
{
const
typename
PFP
::
VEC3
&
p1
=
position
[
d
]
;
const
typename
PFP
::
VEC3
&
p2
=
position
[
map
.
phi1
(
d
)]
;
const
typename
PFP
::
VEC3
&
p3
=
position
[
map
.
phi_1
(
d
)]
;
const
VEC3
&
p1
=
position
[
d
]
;
const
VEC3
&
p2
=
position
[
map
.
phi1
(
d
)]
;
const
VEC3
&
p3
=
position
[
map
.
phi_1
(
d
)]
;
typename
PFP
::
REAL
cot_alpha
=
1
/
tan
(
Geom
::
angle
(
p1
-
p3
,
p2
-
p3
))
;
REAL
cot_alpha
=
1
/
tan
(
Geom
::
angle
(
p1
-
p3
,
p2
-
p3
))
;
return
0.5
*
cot_alpha
;
}
else
{
const
typename
PFP
::
VEC3
&
p1
=
position
[
d
]
;
const
typename
PFP
::
VEC3
&
p2
=
position
[
map
.
phi1
(
d
)]
;
const
typename
PFP
::
VEC3
&
p3
=
position
[
map
.
phi_1
(
d
)]
;
const
typename
PFP
::
VEC3
&
p4
=
position
[
map
.
phi_1
(
map
.
phi2
(
d
))]
;
const
VEC3
&
p1
=
position
[
d
]
;
const
VEC3
&
p2
=
position
[
map
.
phi1
(
d
)]
;
const
VEC3
&
p3
=
position
[
map
.
phi_1
(
d
)]
;
const
VEC3
&
p4
=
position
[
map
.
phi_1
(
map
.
phi2
(
d
))]
;
typename
PFP
::
REAL
cot_alpha
=
1
/
tan
(
Geom
::
angle
(
p1
-
p3
,
p2
-
p3
))
;
typename
PFP
::
REAL
cot_beta
=
1
/
tan
(
Geom
::
angle
(
p2
-
p4
,
p1
-
p4
))
;
REAL
cot_alpha
=
1
/
tan
(
Geom
::
angle
(
p1
-
p3
,
p2
-
p3
))
;
REAL
cot_beta
=
1
/
tan
(
Geom
::
angle
(
p2
-
p4
,
p1
-
p4
))
;
return
0.5
*
(
cot_alpha
+
cot_beta
)
;
}
}
...
...
@@ -139,8 +144,8 @@ typename PFP::REAL computeCotanWeightEdge(
template
<
typename
PFP
>
void
computeCotanWeightEdges
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
EdgeAttribute
<
typename
PFP
::
REAL
>&
edgeWeight
)
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
EdgeAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
edgeWeight
)
{
TraversorE
<
typename
PFP
::
MAP
>
t
(
map
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
...
...
@@ -159,7 +164,10 @@ namespace Geometry
{
template
<
typename
PFP
,
typename
ATTR_TYPE
>
ATTR_TYPE
computeLaplacianTopoVertex
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
ATTR_TYPE
>&
attr
)
ATTR_TYPE
computeLaplacianTopoVertex
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
attr
)
{
ATTR_TYPE
l
(
0
)
;
ATTR_TYPE
value
=
attr
[
d
]
;
...
...
@@ -177,20 +185,20 @@ ATTR_TYPE computeLaplacianTopoVertex(typename PFP::MAP& map, Dart d, const Verte
}
template
<
typename
PFP
,
typename
ATTR_TYPE
>
void
computeLaplacianTopoVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
ATTR_TYPE
>&
attr
,
VertexAttribute
<
ATTR_TYPE
>&
laplacian
)
void
computeLaplacianTopoVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
attr
,
VertexAttribute
<
ATTR_TYPE
,
typename
PFP
::
MAP
::
IMPL
>&
laplacian
)
{
TraversorV
<
typename
PFP
::
MAP
>
t
(
map
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
laplacian
[
d
]
=
computeLaplacianTopoVertex
<
PFP
,
ATTR_TYPE
>
(
map
,
d
,
attr
)
;
}
}
// namespace Geometry
}
// namespace Volume
}
// namespace Algo
}
// namespace CGoGN
include/Algo/Import/import.hpp
View file @
437409f6
...
...
@@ -42,7 +42,10 @@ namespace Import
template
<
typename
PFP
>
bool
importMesh
(
typename
PFP
::
MAP
&
map
,
MeshTablesSurface
<
PFP
>&
mts
)
{
VertexAutoAttribute
<
NoTypeNameAttribute
<
std
::
vector
<
Dart
>
>
>
vecDartsPerVertex
(
map
,
"incidents"
);
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
MAP
::
IMPL
MAP_IMPL
;
VertexAutoAttribute
<
NoTypeNameAttribute
<
std
::
vector
<
Dart
>
>
,
MAP_IMPL
>
vecDartsPerVertex
(
map
,
"incidents"
);
unsigned
nbf
=
mts
.
getNbFaces
();
int
index
=
0
;
...
...
@@ -50,9 +53,9 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
std
::
vector
<
unsigned
int
>
edgesBuffer
;
edgesBuffer
.
reserve
(
16
);
DartMarkerNoUnmark
m
(
map
)
;
DartMarkerNoUnmark
<
MAP
>
m
(
map
)
;
FunctorInitEmb
<
typename
PFP
::
MAP
,
VERTEX
>
fsetemb
(
map
);
FunctorInitEmb
<
MAP
,
VERTEX
>
fsetemb
(
map
);
// for each face of table
for
(
unsigned
int
i
=
0
;
i
<
nbf
;
++
i
)
...
...
@@ -183,7 +186,10 @@ bool importVoxellisation(typename PFP::MAP& map, Algo::Surface::Modelisation::Vo
template
<
typename
PFP
>
bool
importMeshSAsV
(
typename
PFP
::
MAP
&
map
,
MeshTablesSurface
<
PFP
>&
mts
)
{
VertexAutoAttribute
<
NoTypeNameAttribute
<
std
::
vector
<
Dart
>
>
>
vecDartsPerVertex
(
map
,
"incidents"
);
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
MAP
::
IMPL
MAP_IMPL
;
VertexAutoAttribute
<
NoTypeNameAttribute
<
std
::
vector
<
Dart
>
>
,
MAP_IMPL
>
vecDartsPerVertex
(
map
,
"incidents"
);
unsigned
nbf
=
mts
.
getNbFaces
();
int
index
=
0
;
...
...
@@ -191,7 +197,7 @@ bool importMeshSAsV(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
std
::
vector
<
unsigned
int
>
edgesBuffer
;
edgesBuffer
.
reserve
(
16
);
DartMarkerNoUnmark
m
(
map
)
;
DartMarkerNoUnmark
<
MAP
>
m
(
map
)
;
// for each face of table
for
(
unsigned
int
i
=
0
;
i
<
nbf
;
++
i
)
...
...
@@ -222,7 +228,7 @@ bool importMeshSAsV(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
{
unsigned
int
em
=
edgesBuffer
[
j
];
// get embedding
FunctorSetEmb
<
typename
PFP
::
MAP
,
VERTEX
>
fsetemb
(
map
,
em
);
FunctorSetEmb
<
MAP
,
VERTEX
>
fsetemb
(
map
,
em
);
map
.
template
foreach_dart_of_orbit
<
PFP
::
MAP
::
VERTEX_OF_PARENT2
>(
d
,
fsetemb
);
m
.
mark
(
d
)
;
// mark on the fly to unmark on second loop
...
...
@@ -298,16 +304,20 @@ namespace Import
template
<
typename
PFP
>
bool
importMeshSToV
(
typename
PFP
::
MAP
&
map
,
Surface
::
Import
::
MeshTablesSurface
<
PFP
>&
mts
,
float
dist
)
{
VertexAutoAttribute
<
NoTypeNameAttribute
<
std
::
vector
<
Dart
>
>
>
vecDartsPerVertex
(
map
,
"incidents"
);
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
typename
PFP
::
VEC3
VEC3
;
VertexAutoAttribute
<
NoTypeNameAttribute
<
std
::
vector
<
Dart
>
>
,
MAP_IMPL
>
vecDartsPerVertex
(
map
,
"incidents"
);
unsigned
nbf
=
mts
.
getNbFaces
();
int
index
=
0
;
// buffer for tempo faces (used to remove degenerated edges)
std
::
vector
<
unsigned
int
>
edgesBuffer
;
edgesBuffer
.
reserve
(
16
);
DartMarkerNoUnmark
m
(
map
)
;
DartMarkerNoUnmark
<
MAP
>
m
(
map
)
;
VertexAttribute
<
typename
PFP
::
VEC3
>
position
=
map
.
template
getAttribute
<
typename
PFP
::
VEC3
,
VERTEX
>(
"position"
);
VertexAttribute
<
VEC3
,
MAP_IMPL
>
position
=
map
.
template
getAttribute
<
VEC3
,
VERTEX
>(
"position"
);
std
::
vector
<
unsigned
int
>
backEdgesBuffer
(
mts
.
getNbVertices
(),
EMBNULL
);
// for each face of table -> create a prism
...
...
@@ -334,7 +344,7 @@ bool importMeshSToV(typename PFP::MAP& map, Surface::Import::MeshTablesSurface<P
nbe
=
edgesBuffer
.
size
();
if
(
nbe
>
2
)
{