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
David Cazier
CGoGN
Commits
04bba86e
Commit
04bba86e
authored
Jun 28, 2013
by
Sylvain Thery
Browse files
continue gen algorithms simplification
parents
42e869b6
059d7f9c
Changes
42
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/volumeExplorer.cpp
View file @
04bba86e
...
...
@@ -196,6 +196,16 @@ void MyQT::cb_Open()
updateGL
()
;
}
void
MyQT
::
cb_Save
()
{
std
::
string
filters
(
"all (*.*);; tetmesh (*.tetmesh);; tet (*.tet);; node (*.node);; msh (*.msh);; vtu (*.vtu);; nas (*.nas);; vbgz (*.vbgz)"
)
;
std
::
string
filename
=
selectFileSave
(
"Save Mesh"
,
""
,
filters
)
;
if
(
filename
.
empty
())
return
;
Algo
::
Volume
::
Export
::
exportMesh
<
PFP
>
(
myMap
,
position
,
filename
);
}
void
MyQT
::
cb_initGL
()
{
...
...
Apps/Examples/volumeExplorer.h
View file @
04bba86e
...
...
@@ -48,6 +48,8 @@
#include
"ui_volumeExplorer.h"
#include
"Utils/Qt/qtui.h"
#include
"Algo/Export/exportVol.h"
using
namespace
CGoGN
;
...
...
@@ -127,6 +129,7 @@ protected:
void
cb_mousePress
(
int
button
,
int
x
,
int
y
);
void
cb_mouseRelease
(
int
button
,
int
x
,
int
y
);
void
cb_Open
();
void
cb_Save
();
// slots locaux
...
...
SCHNApps/Plugins/CMakeLists.txt
View file @
04bba86e
...
...
@@ -9,5 +9,5 @@ ADD_SUBDIRECTORY(renderScalar)
ADD_SUBDIRECTORY
(
renderExplod
)
ADD_SUBDIRECTORY
(
renderTopoSurface
)
ADD_SUBDIRECTORY
(
subdivideSurface
)
ADD_SUBDIRECTORY
(
surfaceDeformation
)
#
ADD_SUBDIRECTORY(surfaceDeformation)
ADD_SUBDIRECTORY
(
subdivideMRVolume
)
SCHNApps/Plugins/renderExplod/forms/renderExplod.ui
View file @
04bba86e
...
...
@@ -6,7 +6,7 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
174
</width>
<width>
200
</width>
<height>
545
</height>
</rect>
</property>
...
...
@@ -101,7 +101,7 @@
<item
row=
"1"
column=
"1"
>
<widget
class=
"QSlider"
name=
"slider_facesScaleFactor"
>
<property
name=
"value"
>
<number>
50
</number>
<number>
99
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
...
...
@@ -118,7 +118,7 @@
<item
row=
"2"
column=
"1"
>
<widget
class=
"QSlider"
name=
"slider_volumesScaleFactor"
>
<property
name=
"value"
>
<number>
50
</number>
<number>
99
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
...
...
SCHNApps/Plugins/renderExplod/src/renderExplod.cpp
View file @
04bba86e
...
...
@@ -276,7 +276,7 @@ void RenderExplodPlugin::changeRenderFaces(View* view, MapHandlerGen* map, bool
void
RenderExplodPlugin
::
changeFacesScaleFactor
(
View
*
view
,
MapHandlerGen
*
map
,
int
i
,
bool
fromUI
)
{
ParameterSet
*
params
=
h_viewParams
[
view
];
params
->
perMap
[
map
->
getName
()]
->
facesScaleFactor
=
i
/
50
.0
;
params
->
perMap
[
map
->
getName
()]
->
facesScaleFactor
=
i
/
99
.0
;
if
(
view
->
isCurrentView
())
{
...
...
@@ -289,7 +289,7 @@ void RenderExplodPlugin::changeFacesScaleFactor(View* view, MapHandlerGen* map,
void
RenderExplodPlugin
::
changeVolumesScaleFactor
(
View
*
view
,
MapHandlerGen
*
map
,
int
i
,
bool
fromUI
)
{
ParameterSet
*
params
=
h_viewParams
[
view
];
params
->
perMap
[
map
->
getName
()]
->
volumesScaleFactor
=
i
/
50
.0
;
params
->
perMap
[
map
->
getName
()]
->
volumesScaleFactor
=
i
/
99
.0
;
if
(
view
->
isCurrentView
())
{
...
...
include/Algo/Export/exportVol.hpp
View file @
04bba86e
...
...
@@ -775,7 +775,7 @@ bool exportTetmesh(typename PFP::MAP& map, const VertexAttribute<typename PFP::V
VertexAutoAttribute
<
unsigned
int
>
indices
(
map
,
"indices_vert"
);
fout
<<
"
Vertices"
<<
std
::
endl
<<
position
.
nbElements
()
<<
std
::
endl
;
fout
<<
"Vertices"
<<
std
::
endl
<<
position
.
nbElements
()
<<
std
::
endl
;
std
::
vector
<
unsigned
int
>
tetra
;
tetra
.
reserve
(
2048
);
...
...
@@ -784,7 +784,7 @@ bool exportTetmesh(typename PFP::MAP& map, const VertexAttribute<typename PFP::V
for
(
unsigned
int
i
=
position
.
begin
();
i
!=
position
.
end
();
position
.
next
(
i
))
{
const
VEC3
&
P
=
position
[
i
];
fout
<<
P
[
0
]
<<
" "
<<
P
[
1
]
<<
" "
<<
P
[
2
]
<<
std
::
endl
;
fout
<<
P
[
0
]
<<
" "
<<
P
[
1
]
<<
" "
<<
P
[
2
]
<<
" "
<<
"0"
<<
std
::
endl
;
indices
[
i
]
=
count
++
;
}
...
...
@@ -815,7 +815,7 @@ bool exportTetmesh(typename PFP::MAP& map, const VertexAttribute<typename PFP::V
}
unsigned
int
nbtetra
=
tetra
.
size
()
/
4
;
fout
<<
"
Tetrahedra"
<<
std
::
endl
<<
nbtetra
<<
std
::
endl
;
fout
<<
"Tetrahedra"
<<
std
::
endl
<<
nbtetra
<<
std
::
endl
;
for
(
unsigned
int
i
=
0
;
i
<
nbtetra
;
++
i
)
{
...
...
@@ -858,6 +858,7 @@ bool exportMesh(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3
break
;
default:
CGoGNerr
<<
"unknown file format for "
<<
filename
<<
CGoGNendl
;
return
false
;
break
;
}
}
...
...
include/Algo/Geometry/centroid.hpp
View file @
04bba86e
...
...
@@ -349,6 +349,7 @@ public:
};
template
<
typename
PFP
,
typename
V_ATT
,
typename
W_ATT
>
void
computeCentroidELWVolumes
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
W_ATT
&
vol_centroid
,
...
...
include/Algo/Geometry/normal.h
View file @
04bba86e
...
...
@@ -40,23 +40,24 @@ namespace Surface
namespace
Geometry
{
template
<
typename
PFP
>
typename
PFP
::
VEC3
triangleNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>
&
position
)
;
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
triangleNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
_ATT
&
position
)
;
template
<
typename
PFP
>
typename
PFP
::
VEC3
newellNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>
&
position
);
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
newellNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
_ATT
&
position
);
template
<
typename
PFP
>
typename
PFP
::
VEC3
faceNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>
&
position
)
;
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
faceNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
_ATT
&
position
)
;
template
<
typename
PFP
>
typename
PFP
::
VEC3
vertexNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>
&
position
)
;
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
vertexNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
_ATT
&
position
)
;
template
<
typename
PFP
>
typename
PFP
::
VEC3
vertexBorderNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>
&
position
)
;
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
vertexBorderNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
_ATT
&
position
)
;
template
<
typename
PFP
>
void
computeNormalFaces
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
FaceAttribute
<
typename
PFP
::
VEC3
>&
face_normal
,
unsigned
int
thread
=
0
)
;
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
=
0
)
;
/**
...
...
@@ -67,27 +68,27 @@ void computeNormalFaces(typename PFP::MAP& map, const VertexAttribute<typename P
* @param the selector
* @ param th the thread number
*/
template
<
typename
PFP
>
void
computeNormalVertices
(
typename
PFP
::
MAP
&
map
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
VertexAttribute
<
typename
PFP
::
VEC3
>
&
normal
,
unsigned
int
thread
=
0
)
;
template
<
typename
PFP
,
typename
V_ATT
>
void
computeNormalVertices
(
typename
PFP
::
MAP
&
map
,
const
V
_ATT
&
position
,
V_ATT
&
normal
,
unsigned
int
thread
=
0
)
;
namespace
Parallel
{
template
<
typename
PFP
>
void
computeNormalVertices
(
typename
PFP
::
MAP
&
map
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
VertexAttribute
<
typename
PFP
::
VEC3
>
&
normal
,
unsigned
int
nbth
=
0
)
;
template
<
typename
PFP
,
typename
V_ATT
>
void
computeNormalVertices
(
typename
PFP
::
MAP
&
map
,
const
V
_ATT
&
position
,
V_ATT
&
normal
,
unsigned
int
nbth
=
0
)
;
template
<
typename
PFP
>
void
computeNormalFaces
(
typename
PFP
::
MAP
&
map
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
FaceAttribute
<
typename
PFP
::
VEC3
>
&
face_normal
,
unsigned
int
nbth
=
0
)
;
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
nbth
=
0
)
;
}
template
<
typename
PFP
>
typename
PFP
::
REAL
computeAngleBetweenNormalsOnEdge
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>
&
position
)
;
template
<
typename
PFP
,
typename
V_ATT
>
typename
PFP
::
REAL
computeAngleBetweenNormalsOnEdge
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
_ATT
&
position
)
;
template
<
typename
PFP
>
void
computeAnglesBetweenNormalsOnEdges
(
typename
PFP
::
MAP
&
map
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
EdgeAttribute
<
typename
PFP
::
REAL
>
&
angles
,
unsigned
int
thread
=
0
)
;
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
=
0
)
;
}
// namespace Geometry
...
...
include/Algo/Geometry/normal.hpp
View file @
04bba86e
...
...
@@ -44,60 +44,145 @@ namespace Surface
namespace
Geometry
{
template
<
typename
PFP
>
typename
PFP
::
VEC3
triangleNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
)
//template <typename PFP>
//typename PFP::VEC3 triangleNormal(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position)
//{
// typename PFP::VEC3 N = Geom::triangleNormal(position[d], position[map.phi1(d)], position[map.phi_1(d)]) ;
// N.normalize() ;
// return N ;
//}
//template<typename PFP>
//typename PFP::VEC3 newellNormal(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position)
//{
// typename PFP::VEC3 N(0);
// Traversor2FV<typename PFP::MAP> t(map, d) ;
// for(Dart it = t.begin(); it != t.end(); it = t.next())
// {
// const typename PFP::VEC3& P = position[it];
// const typename PFP::VEC3& Q = position[map.phi1(it)];
// N[0] += (P[1] - Q[1]) * (P[2] + Q[2]);
// N[1] += (P[2] - Q[2]) * (P[0] + Q[0]);
// N[2] += (P[0] - Q[0]) * (P[1] + Q[1]);
// }
// N.normalize();
// return N;
//}
//template <typename PFP>
//typename PFP::VEC3 faceNormal(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position)
//{
// if(map.faceDegree(d) == 3)
// return triangleNormal<PFP>(map, d, position) ;
// else
// return newellNormal<PFP>(map, d, position) ;
//}
//template <typename PFP>
//typename PFP::VEC3 vertexNormal(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position)
//{
// typedef typename PFP::VEC3 VEC3 ;
// VEC3 N(0) ;
// Traversor2VF<typename PFP::MAP> t(map, d) ;
// for(Dart it = t.begin(); it != t.end(); it = t.next())
// {
// VEC3 n = faceNormal<PFP>(map, it, position) ;
// if(!n.hasNan())
// {
// VEC3 v1 = vectorOutOfDart<PFP>(map, it, position) ;
// VEC3 v2 = vectorOutOfDart<PFP>(map, map.phi_1(it), position) ;
// n *= convexFaceArea<PFP>(map, it, position) / (v1.norm2() * v2.norm2()) ;
// N += n ;
// }
// }
// N.normalize() ;
// return N ;
//}
//template <typename PFP>
//typename PFP::VEC3 vertexBorderNormal(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position)
//{
// assert(map.dimension() == 3);
// typedef typename PFP::VEC3 VEC3 ;
// VEC3 N(0) ;
// std::vector<Dart> faces;
// CellMarker<FACE> f(map);
// FunctorStore fs(faces);
// map.foreach_dart_of_vertex(d,fs);
// for(std::vector<Dart>::iterator it = faces.begin() ; it != faces.end() ; ++it)
// {
// if(!f.isMarked(*it) && map.isBoundaryFace(*it))
// {
// f.mark(*it);
// VEC3 n = faceNormal<PFP>(map, *it, position);
// if(!n.hasNan())
// {
// VEC3 v1 = vectorOutOfDart<PFP>(map, *it, position);
// VEC3 v2 = vectorOutOfDart<PFP>(map, map.phi_1(*it), position);
// n *= convexFaceArea<PFP>(map, *it, position) / (v1.norm2() * v2.norm2());
// N += n ;
// }
// }
// }
// N.normalize() ;
// return N ;
//}
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
triangleNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V_ATT
&
position
)
{
typename
PFP
::
VEC3
N
=
Geom
::
triangleNormal
(
position
[
d
],
position
[
map
.
phi1
(
d
)],
position
[
map
.
phi_1
(
d
)])
;
typename
V_ATT
::
DATA_TYPE
N
=
Geom
::
triangleNormal
(
position
[
d
],
position
[
map
.
phi1
(
d
)],
position
[
map
.
phi_1
(
d
)])
;
N
.
normalize
()
;
return
N
;
}
template
<
typename
PFP
>
typename
PFP
::
VEC3
newellNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>
&
position
)
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
newellNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
_ATT
&
position
)
{
typename
PFP
::
VEC3
N
(
0
);
Traversor2FV
<
typename
PFP
::
MAP
>
t
(
map
,
d
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
{
const
typename
PFP
::
VEC3
&
P
=
position
[
it
];
const
typename
PFP
::
VEC3
&
Q
=
position
[
map
.
phi1
(
it
)];
N
[
0
]
+=
(
P
[
1
]
-
Q
[
1
])
*
(
P
[
2
]
+
Q
[
2
]);
N
[
1
]
+=
(
P
[
2
]
-
Q
[
2
])
*
(
P
[
0
]
+
Q
[
0
]);
N
[
2
]
+=
(
P
[
0
]
-
Q
[
0
])
*
(
P
[
1
]
+
Q
[
1
]);
}
N
.
normalize
();
return
N
;
typedef
typename
V_ATT
::
DATA_TYPE
VEC3
;
VEC3
N
(
0
);
Traversor2FV
<
typename
PFP
::
MAP
>
t
(
map
,
d
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
{
const
VEC3
&
P
=
position
[
it
];
const
VEC3
&
Q
=
position
[
map
.
phi1
(
it
)];
N
[
0
]
+=
(
P
[
1
]
-
Q
[
1
])
*
(
P
[
2
]
+
Q
[
2
]);
N
[
1
]
+=
(
P
[
2
]
-
Q
[
2
])
*
(
P
[
0
]
+
Q
[
0
]);
N
[
2
]
+=
(
P
[
0
]
-
Q
[
0
])
*
(
P
[
1
]
+
Q
[
1
]);
}
N
.
normalize
();
return
N
;
}
template
<
typename
PFP
>
typename
PFP
::
VEC3
faceNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>
&
position
)
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
faceNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
_ATT
&
position
)
{
if
(
map
.
faceDegree
(
d
)
==
3
)
return
triangleNormal
<
PFP
>
(
map
,
d
,
position
)
;
else
return
newellNormal
<
PFP
>
(
map
,
d
,
position
)
;
// {
// VEC3 N(0) ;
// Dart it = d ;
// do
// {
// VEC3 n = triangleNormal<PFP>(map, it, position) ;
// //if(!std::isnan(n[0]) && !std::isnan(n[1]) && !std::isnan(n[2]))
// if(!n.hasNan())
// N += n ;
// it = map.phi1(it) ;
// } while (it != d) ;
// N.normalize() ;
// return N ;
// }
}
template
<
typename
PFP
>
typename
PFP
::
VEC3
vertexNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
)
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
vertexNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V_ATT
&
position
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
V_ATT
::
DATA_TYPE
VEC3
;
VEC3
N
(
0
)
;
...
...
@@ -118,12 +203,12 @@ typename PFP::VEC3 vertexNormal(typename PFP::MAP& map, Dart d, const VertexAttr
return
N
;
}
template
<
typename
PFP
>
typename
PFP
::
VEC3
vertexBorderNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>
&
position
)
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
vertexBorderNormal
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
_ATT
&
position
)
{
assert
(
map
.
dimension
()
==
3
);
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
V_ATT
::
DATA_TYPE
VEC3
;
VEC3
N
(
0
)
;
std
::
vector
<
Dart
>
faces
;
...
...
@@ -152,16 +237,18 @@ typename PFP::VEC3 vertexBorderNormal(typename PFP::MAP& map, Dart d, const Vert
return
N
;
}
template
<
typename
PFP
>
void
computeNormalFaces
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
FaceAttribute
<
typename
PFP
::
VEC3
>&
face_normal
,
unsigned
int
thread
)
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
)
{
TraversorF
<
typename
PFP
::
MAP
>
trav
(
map
,
thread
);
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
face_normal
[
d
]
=
faceNormal
<
PFP
>
(
map
,
d
,
position
)
;
}
template
<
typename
PFP
>
void
computeNormalVertices
(
typename
PFP
::
MAP
&
map
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
VertexAttribute
<
typename
PFP
::
VEC3
>
&
normal
,
unsigned
int
thread
)
template
<
typename
PFP
,
typename
V_ATT
>
void
computeNormalVertices
(
typename
PFP
::
MAP
&
map
,
const
V
_ATT
&
position
,
V_ATT
&
normal
,
unsigned
int
thread
)
{
TraversorV
<
typename
PFP
::
MAP
>
trav
(
map
,
thread
);
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
...
...
@@ -173,13 +260,13 @@ void computeNormalVertices(typename PFP::MAP& map, const VertexAttribute<typenam
namespace
Parallel
{
template
<
typename
PFP
>
template
<
typename
PFP
,
typename
V_ATT
>
class
FunctorComputeNormalVertices
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
{
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>
&
m_position
;
V
ertexAttribute
<
typename
PFP
::
VEC3
>
&
m_normal
;
const
V
_ATT
&
m_position
;
V
_ATT
&
m_normal
;
public:
FunctorComputeNormalVertices
<
PFP
>
(
typename
PFP
::
MAP
&
map
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
VertexAttribute
<
typename
PFP
::
VEC3
>
&
normal
)
:
FunctorComputeNormalVertices
<
PFP
,
V_ATT
>
(
typename
PFP
::
MAP
&
map
,
const
V
_ATT
&
position
,
V_ATT
&
normal
)
:
FunctorMapThreaded
<
typename
PFP
::
MAP
>
(
map
),
m_position
(
position
),
m_normal
(
normal
)
{
}
...
...
@@ -189,45 +276,45 @@ public:
}
};
template
<
typename
PFP
>
void
computeNormalVertices
(
typename
PFP
::
MAP
&
map
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
VertexAttribute
<
typename
PFP
::
VEC3
>
&
normal
,
unsigned
int
nbth
)
template
<
typename
PFP
,
typename
V_ATT
>
void
computeNormalVertices
(
typename
PFP
::
MAP
&
map
,
const
V
_ATT
&
position
,
V_ATT
&
normal
,
unsigned
int
nbth
)
{
FunctorComputeNormalVertices
<
PFP
>
funct
(
map
,
position
,
normal
);
FunctorComputeNormalVertices
<
PFP
,
V_ATT
>
funct
(
map
,
position
,
normal
);
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
VERTEX
>
(
map
,
funct
,
nbth
,
false
);
}
template
<
typename
PFP
>
template
<
typename
PFP
,
typename
V_ATT
,
typename
F_ATT
>
class
FunctorComputeNormalFaces
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
{
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>
&
m_position
;
F
aceAttribute
<
typename
PFP
::
VEC3
>
&
m_normal
;
const
V
_ATT
&
m_position
;
F
_ATT
&
m_normal
;
public:
FunctorComputeNormalFaces
<
PFP
>
(
typename
PFP
::
MAP
&
map
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
FaceAttribute
<
typename
PFP
::
VEC3
>
&
normal
)
:
FunctorComputeNormalFaces
<
PFP
,
V_ATT
,
F_ATT
>
(
typename
PFP
::
MAP
&
map
,
const
V
_ATT
&
position
,
F_ATT
&
normal
)
:
FunctorMapThreaded
<
typename
PFP
::
MAP
>
(
map
),
m_position
(
position
),
m_normal
(
normal
)
{
}
void
run
(
Dart
d
,
unsigned
int
threadID
)
void
run
(
Dart
d
,
unsigned
int
/*
threadID
*/
)
{
m_normal
[
d
]
=
faceNormal
<
PFP
>
(
this
->
m_map
,
d
,
m_position
)
;
}
};
template
<
typename
PFP
>
void
computeNormalFaces
(
typename
PFP
::
MAP
&
map
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
FaceAttribute
<
typename
PFP
::
VEC3
>
&
normal
,
unsigned
int
nbth
)
template
<
typename
PFP
,
typename
V_ATT
,
typename
F_ATT
>
void
computeNormalFaces
(
typename
PFP
::
MAP
&
map
,
const
V
_ATT
&
position
,
F_ATT
&
normal
,
unsigned
int
nbth
)
{
FunctorComputeNormalFaces
<
PFP
>
funct
(
map
,
position
,
normal
);
FunctorComputeNormalFaces
<
PFP
,
V_ATT
,
F_ATT
>
funct
(
map
,
position
,
normal
);
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
FACE
>
(
map
,
funct
,
nbth
,
false
);
}
template
<
typename
PFP
>
template
<
typename
PFP
,
typename
V_ATT
,
typename
E_ATT
>
class
FunctorComputeAngleBetweenNormalsOnEdge
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
{
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>
&
m_position
;
FaceAttribute
<
typename
PFP
::
VEC3
>
&
m_angles
;
const
V
_ATT
&
m_position
;
E_ATT
&
m_angles
;
public:
FunctorComputeAngleBetweenNormalsOnEdge
<
PFP
>
(
typename
PFP
::
MAP
&
map
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
EdgeAttribute
<
typename
PFP
::
VEC3
>
&
angles
)
:
FunctorComputeAngleBetweenNormalsOnEdge
<
PFP
,
V_ATT
,
E_ATT
>
(
typename
PFP
::
MAP
&
map
,
const
V
_ATT
&
position
,
E_ATT
&
angles
)
:
FunctorMapThreaded
<
typename
PFP
::
MAP
>
(
map
),
m_position
(
position
),
m_angles
(
angles
)
{
}
...
...
@@ -238,10 +325,10 @@ public:
};
template
<
typename
PFP
>
void
computeAnglesBetweenNormalsOnEdges
(
typename
PFP
::
MAP
&
map
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
EdgeAttribute
<
typename
PFP
::
REAL
>
&
angles
,
unsigned
int
nbth
)
template
<
typename
PFP
,
typename
V_ATT
,
typename
E_ATT
>
void
computeAnglesBetweenNormalsOnEdges
(
typename
PFP
::
MAP
&
map
,
const
V
_ATT
&
position
,
E_ATT
&
angles
,
unsigned
int
nbth
)
{
FunctorComputeAngleBetweenNormalsOnEdge
<
PFP
>
funct
(
map
,
position
,
angles
);
FunctorComputeAngleBetweenNormalsOnEdge
<
PFP
,
V_ATT
,
E_ATT
>
funct
(
map
,
position
,
angles
);
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
EDGE
>
(
map
,
funct
,
nbth
,
false
);
}
...
...
@@ -249,10 +336,10 @@ void computeAnglesBetweenNormalsOnEdges(typename PFP::MAP& map, const VertexAttr
template
<
typename
PFP
>
typename
PFP
::
REAL
computeAngleBetweenNormalsOnEdge
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>
&
position
)
template
<
typename
PFP
,
typename
V_ATT
>
typename
PFP
::
REAL
computeAngleBetweenNormalsOnEdge
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V
_ATT
&
position
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
V_ATT
::
DATA_TYPE
VEC3
;
if
(
map
.
isBoundaryEdge
(
d
))
return
0
;
...
...
@@ -280,8 +367,8 @@ typename PFP::REAL computeAngleBetweenNormalsOnEdge(typename PFP::MAP& map, Dart
return
a
;
}
template
<
typename
PFP
>
void
computeAnglesBetweenNormalsOnEdges
(
typename
PFP
::
MAP
&
map
,
const
V
ertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
EdgeAttribute
<
typename
PFP
::
REAL
>
&
angles
,
unsigned
int
thread
)
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
)
{
TraversorE
<
typename
PFP
::
MAP
>
trav
(
map
,
thread
);
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
...
...
include/Algo/ImplicitHierarchicalMesh/ihm3.h
View file @
04bba86e
...
...
@@ -141,6 +141,10 @@ public:
* Topological operations on Hierarchical Implicit 3-maps
*************************************************************************/
// void deleteVolume(Dart d);
bool
isWellEmbedded
();
//@{
//!
...
...
@@ -162,6 +166,11 @@ public:
void
deleteVertexSubdividedFace
(
Dart
d
);
//@}
void
setVertexVertexFunctor
(
FunctorType
*
f
)
{
vertexVertexFunctor
=
f
;
}
void
setEdgeVertexFunctor
(
FunctorType
*
f
)
{
edgeVertexFunctor
=
f
;
}
void
setFaceVertexFunctor
(
FunctorType
*
f
)
{
faceVertexFunctor
=
f
;
}
void
setVolumeVertexFunctor
(
FunctorType
*
f
)
{
volumeVertexFunctor
=
f
;
}
void
computeVertexVertexFunctor
(
Dart
d
)
{
(
*
vertexVertexFunctor
)(
d
);
}
void
computeEdgeVertexFunctor
(
Dart
d
)
{
(
*
edgeVertexFunctor
)(
d
);
}
void
computeFaceVertexFunctor
(
Dart
d
)
{
(
*
faceVertexFunctor
)(
d
);
}
...
...
@@ -373,7 +382,8 @@ public:
virtual
bool
foreach_dart_of_face2
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
);
//@}
template
<
unsigned
int
ORBIT
>
unsigned
int
getEmbedding
(
Dart
d
);
}
;