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
Etienne Schmitt
CGoGN
Commits
55cb77c0
Commit
55cb77c0
authored
Mar 11, 2014
by
untereiner
Browse files
some changes ?
parent
1a280155
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Apps/SandBox/testPlaneCutting.cpp
View file @
55cb77c0
...
...
@@ -57,18 +57,18 @@ Viewer::Viewer() :
void
Viewer
::
initGUI
()
{
setDock
(
&
dock
)
;
setDock
(
&
dock
)
;
dock
.
check_drawVertices
->
setChecked
(
false
)
;
dock
.
check_drawEdges
->
setChecked
(
false
)
;
dock
.
check_drawFaces
->
setChecked
(
true
)
;
dock
.
check_drawNormals
->
setChecked
(
false
)
;
dock
.
check_drawVertices
->
setChecked
(
false
)
;
dock
.
check_drawEdges
->
setChecked
(
false
)
;
dock
.
check_drawFaces
->
setChecked
(
true
)
;
dock
.
check_drawNormals
->
setChecked
(
false
)
;
dock
.
slider_verticesSize
->
setVisible
(
false
)
;
dock
.
slider_normalsSize
->
setVisible
(
false
)
;
dock
.
slider_verticesSize
->
setVisible
(
false
)
;
dock
.
slider_normalsSize
->
setVisible
(
false
)
;
dock
.
slider_verticesSize
->
setSliderPosition
(
50
)
;
dock
.
slider_normalsSize
->
setSliderPosition
(
50
)
;
dock
.
slider_verticesSize
->
setSliderPosition
(
50
)
;
dock
.
slider_normalsSize
->
setSliderPosition
(
50
)
;
setCallBack
(
dock
.
check_drawVertices
,
SIGNAL
(
toggled
(
bool
)),
SLOT
(
slot_drawVertices
(
bool
))
)
;
setCallBack
(
dock
.
slider_verticesSize
,
SIGNAL
(
valueChanged
(
int
)),
SLOT
(
slot_verticesSize
(
int
))
)
;
...
...
@@ -196,75 +196,113 @@ void Viewer::cb_Save()
void
Viewer
::
cb_keyPress
(
int
keycode
)
{
switch
(
keycode
)
{
case
'c'
:
myMap
.
check
();
break
;
case
'p'
:
switch
(
keycode
)
{
case
'c'
:
myMap
.
check
();
break
;
std
::
cout
<<
"PlaneCut"
<<
std
::
endl
;
Geom
::
Vec3f
n
(
0.1
,
0.1
,
1.0
);
Geom
::
Vec3f
o
=
bb
.
center
();
case
'p'
:
{
Geom
::
Plane3D
<
PFP
::
REAL
>
plan
(
n
,
o
);
std
::
cout
<<
"PlaneCut"
<<
std
::
endl
;
Geom
::
Vec3f
n
(
0.1
,
0.1
,
1.0
);
Geom
::
Vec3f
o
=
bb
.
center
();
CellMarker
<
FACE
>
over
(
myMap
);
Algo
::
Surface
::
Modelisation
::
planeCut
<
PFP
>
(
myMap
,
position
,
plan
,
over
,
false
,
true
);
Geom
::
Plane3D
<
PFP
::
REAL
>
plan
(
n
,
o
);
std
::
cout
<<
"PlaneCut Ok"
<<
std
::
endl
;
n
*=
bb
.
diagSize
()
/
20.0
f
;
CellMarker
<
FACE
>
over
(
myMap
)
;
Algo
::
Surface
::
Modelisation
::
planeCut
<
PFP
>
(
myMap
,
position
,
plan
,
over
,
true
,
true
)
;
TraversorV
<
PFP
::
MAP
>
trav
(
myMap
);
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
{
if
(
over
.
isMarked
(
d
))
position
[
d
]
+=
n
;
}
std
::
cout
<<
"PlaneCut Ok"
<<
std
::
endl
;
n
*=
bb
.
diagSize
()
/
20.0
f
;
TraversorV
<
PFP
::
MAP
>
trav
(
myMap
);
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
{
if
(
over
.
isMarked
(
d
))
position
[
d
]
+=
n
;
}
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
POINTS
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
LINES
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
TRIANGLES
)
;
Algo
::
Surface
::
Geometry
::
computeNormalVer
ti
c
es
<
PFP
>
(
myMap
,
position
,
normal
)
;
m_
positionVBO
->
updateData
(
position
)
;
m_
normalVBO
->
updateData
(
normal
)
;
m_render
->
initPrimi
ti
v
es
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
POINTS
)
;
m_
render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
LINES
)
;
m_
render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
TRIANGLES
)
;
m_topoRender
->
updateData
<
PFP
>
(
myMap
,
position
,
0.85
f
,
0.85
f
,
m_drawBoundaryTopo
)
;
updateGL
();
Algo
::
Surface
::
Geometry
::
computeNormalVertices
<
PFP
>
(
myMap
,
position
,
normal
)
;
m_positionVBO
->
updateData
(
position
)
;
m_normalVBO
->
updateData
(
normal
)
;
}
break
;
m_topoRender
->
updateData
<
PFP
>
(
myMap
,
position
,
0.85
f
,
0.85
f
,
m_drawBoundaryTopo
)
;
updateGL
()
;
case
'd'
:
{
Utils
::
Chrono
ch
;
ch
.
start
();
VEC3
P
(
0.6
f
,
0.55
f
,
0.51
f
);
float
dist
=
10000.0
f
;
TraversorF
<
PFP
::
MAP
>
trav
(
myMap
);
unsigned
int
nb
=
0
;
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
break
;
}
case
'P'
:
{
nb
++
;
float
d2
=
Algo
::
Geometry
::
squaredDistancePoint2Face
<
PFP
>
(
myMap
,
d
,
position
,
P
);
if
(
d2
<
dist
)
dist
=
d2
;
std
::
cout
<<
"PlaneCut"
<<
std
::
endl
;
Geom
::
Vec3f
n
(
0.1
,
0.1
,
1.0
);
Geom
::
Vec3f
o
=
bb
.
center
();
Geom
::
Plane3D
<
PFP
::
REAL
>
plan
(
n
,
o
);
CellMarker
<
FACE
>
over
(
myMap
);
Algo
::
Surface
::
Modelisation
::
planeCut2
<
PFP
>
(
myMap
,
position
,
plan
,
over
,
true
);
std
::
cout
<<
"PlaneCut Ok"
<<
std
::
endl
;
n
*=
bb
.
diagSize
()
/
20.0
f
;
TraversorV
<
PFP
::
MAP
>
trav
(
myMap
);
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
{
if
(
over
.
isMarked
(
d
))
position
[
d
]
+=
n
;
}
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
POINTS
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
LINES
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
TRIANGLES
)
;
Algo
::
Surface
::
Geometry
::
computeNormalVertices
<
PFP
>
(
myMap
,
position
,
normal
)
;
m_positionVBO
->
updateData
(
position
)
;
m_normalVBO
->
updateData
(
normal
)
;
m_topoRender
->
updateData
<
PFP
>
(
myMap
,
position
,
0.85
f
,
0.85
f
,
m_drawBoundaryTopo
)
;
updateGL
();
break
;
}
case
'd'
:
{
Utils
::
Chrono
ch
;
ch
.
start
();
VEC3
P
(
0.6
f
,
0.55
f
,
0.51
f
);
float
dist
=
10000.0
f
;
TraversorF
<
PFP
::
MAP
>
trav
(
myMap
);
unsigned
int
nb
=
0
;
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
{
nb
++
;
float
d2
=
Algo
::
Geometry
::
squaredDistancePoint2Face
<
PFP
>
(
myMap
,
d
,
position
,
P
);
if
(
d2
<
dist
)
dist
=
d2
;
}
std
::
cout
<<
"Dist="
<<
sqrt
(
dist
)
<<
" of "
<<
nb
<<
"faces in "
<<
ch
.
elapsed
()
<<
" ms"
<<
std
::
endl
;
break
;
}
std
::
cout
<<
"Dist="
<<
sqrt
(
dist
)
<<
" of "
<<
nb
<<
"faces in "
<<
ch
.
elapsed
()
<<
" ms"
<<
std
::
endl
;
}
break
;
default:
break
;
}
default:
break
;
}
}
void
Viewer
::
importMesh
(
std
::
string
&
filename
)
...
...
@@ -290,7 +328,7 @@ void Viewer::importMesh(std::string& filename)
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
attrNames
[
0
])
;
}
// myMap.enableQuickTraversal<VERTEX>() ;
// myMap.enableQuickTraversal<VERTEX>() ;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
POINTS
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
LINES
)
;
...
...
@@ -300,7 +338,7 @@ void Viewer::importMesh(std::string& filename)
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
normalBaseSize
=
bb
.
diagSize
()
/
100.0
f
;
// vertexBaseSize = normalBaseSize / 5.0f ;
// vertexBaseSize = normalBaseSize / 5.0f ;
normal
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
>
(
"normal"
)
;
if
(
!
normal
.
isValid
())
...
...
@@ -407,7 +445,7 @@ int main(int argc, char **argv)
Viewer
sqt
;
sqt
.
setGeometry
(
0
,
0
,
1000
,
800
)
;
sqt
.
show
()
;
sqt
.
show
()
;
if
(
argc
>=
2
)
{
...
...
Apps/SandBox/tilings.cpp
View file @
55cb77c0
...
...
@@ -106,6 +106,8 @@ void MyQT::squareTiling(int code)
Algo
::
Surface
::
Tilings
::
Square
::
Grid
<
PFP
>
g
(
myMap
,
10
,
10
,
true
);
g
.
embedIntoGrid
(
position
,
50
,
50
);
g
.
exportPositions
(
position
,
"grid.bs"
);
break
;
}
case
2
:
...
...
@@ -114,14 +116,18 @@ void MyQT::squareTiling(int code)
Algo
::
Surface
::
Tilings
::
Square
::
Grid
<
PFP
>
g
(
myMap
,
10
,
10
,
true
);
g
.
embedIntoTwistedStrip
(
position
,
0.3
,
0.8
,
5
);
g
.
exportPositions
(
position
,
"gridtwisted.bs"
);
break
;
}
case
3
:
{
std
::
cout
<<
"square grid hel
o
coid tiling"
<<
std
::
endl
;
std
::
cout
<<
"square grid hel
i
coid tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Grid
<
PFP
>
g
(
myMap
,
20
,
20
,
true
);
g
.
embedIntoHelicoid
(
position
,
0.3
,
0.8
,
5.0
,
2.0
);
g
.
exportPositions
(
position
,
"gridhelicoid.bs"
);
break
;
}
case
4
:
...
...
@@ -130,6 +136,8 @@ void MyQT::squareTiling(int code)
Algo
::
Surface
::
Tilings
::
Square
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
embedIntoCylinder
(
position
,
0.5
,
0.7
,
5.0
);
c
.
exportPositions
(
position
,
"cylinder.bs"
);
break
;
}
case
5
:
...
...
@@ -168,14 +176,17 @@ void MyQT::squareTiling(int code)
Algo
::
Surface
::
Tilings
::
Square
::
Cube
<
PFP
>
c
(
myMap
,
20
,
20
,
20
);
c
.
embedIntoCube
(
position
,
5.0
,
5.0
,
5.0
);
c
.
exportPositions
(
position
,
"cube.bs"
);
break
;
}
case
9
:
{
std
::
cout
<<
"square
cylinder con
e tiling"
<<
std
::
endl
;
std
::
cout
<<
"square
tor
e tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Tore
<
PFP
>
c
(
myMap
,
20
,
10
);
c
.
embedIntoTore
(
position
,
5.0
,
2.0
);
c
.
exportPositions
(
position
,
"tore.bs"
);
break
;
}
...
...
@@ -184,6 +195,8 @@ void MyQT::squareTiling(int code)
break
;
}
}
myMap
.
check
();
}
// mouse picking
...
...
include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp
View file @
55cb77c0
...
...
@@ -85,8 +85,8 @@ void subdivideFace(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP
unsigned
int
cur
=
map
.
getCurrentLevel
()
;
map
.
setCurrentLevel
(
fLevel
)
;
// go to the level of the face to subdivide its edges
unsigned
int
vLevel
=
map
.
volumeLevel
(
old
);
//one level of subdivision in the neighbordhood
// unsigned int vLevel = map.volumeLevel(old);
// Traversor3VW<typename PFP::MAP> trav3EW(map, old);
// for(Dart dit = trav3EW.begin() ; dit != trav3EW.end() ; dit = trav3EW.next())
// {
...
...
@@ -114,7 +114,6 @@ void subdivideFace(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP
map
.
setCurrentLevel
(
fLevel
+
1
)
;
// go to the next level to perform face subdivision
Dart
res
;
if
(
degree
==
3
&&
sType
==
IHM
::
S_TRI
)
//subdiviser une face triangulaire
{
...
...
@@ -146,47 +145,6 @@ void subdivideFace(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP
map
.
setFaceId
(
dd
,
idface
,
FACE
)
;
map
.
setFaceId
(
e
,
idface
,
FACE
)
;
// Dart stop = map.phi2(map.phi1(old));
// Dart dit = stop;
// do
// {
// unsigned int dId = map.getEdgeId(map.phi_1(map.phi2(dit)));
// unsigned int eId = map.getEdgeId(map.phi1(map.phi2(dit)));
// unsigned int t = dId + eId;
// if(t == 0)
// {
// map.setEdgeId(dit, 1, EDGE) ;
// map.setEdgeId(map.phi2(dit), 1, EDGE) ;
// }
// else if(t == 1)
// {
// map.setEdgeId(dit, 2, EDGE) ;
// map.setEdgeId(map.phi2(dit), 2, EDGE) ;
// }
// else if(t == 2)
// {
// if(dId == eId)
// {
// map.setEdgeId(dit, 0, EDGE) ;
// map.setEdgeId(map.phi2(dit), 0, EDGE) ;
// }
// else
// {
// map.setEdgeId(dit, 1, EDGE) ;
// map.setEdgeId(map.phi2(dit), 1, EDGE) ;
// }
// }
// else if(t == 3)
// {
// map.setEdgeId(dit, 0, EDGE) ;
// map.setEdgeId(map.phi2(dit), 0, EDGE) ;
// }
// dit = map.phi1(dit);
// }while(dit != stop);
}
else
{
...
...
include/Algo/Modelisation/planeCutting.h
View file @
55cb77c0
...
...
@@ -31,6 +31,7 @@
#include
"Topology/generic/cellmarker.h"
#include
"Topology/generic/traversorCell.h"
#include
"Algo/Modelisation/triangulation.h"
#include
"Algo/Modelisation/subdivision.h"
namespace
CGoGN
{
...
...
@@ -50,11 +51,28 @@ template <typename PFP>
void
planeCut
(
typename
PFP
::
MAP
&
map
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
Geom
::
Plane3D
<
typename
PFP
::
REAL
>&
plane
,
CellMarker
<
FACE
>&
cmf_over
,
bool
keepTriangles
=
false
,
bool
with_unsew
=
true
);
template
<
typename
PFP
>
void
planeCut2
(
typename
PFP
::
MAP
&
map
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
Geom
::
Plane3D
<
typename
PFP
::
REAL
>&
plane
,
CellMarker
<
FACE
>&
cmf_over
,
bool
with_unsew
);
}
// namespace Modelisation
}
// namespace Surface
namespace
Volume
{
namespace
Modelisation
{
template
<
typename
PFP
>
void
planeCut
(
typename
PFP
::
MAP
&
map
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
Geom
::
Plane3D
<
typename
PFP
::
REAL
>&
plane
,
CellMarker
<
FACE
>&
cmv_over
,
bool
keepTetrahedra
=
false
,
bool
with_unsew
=
true
);
}
// namespace Modelisation
}
// namespace Volume
}
// namespace Algo
}
// namespace CGoGN
...
...
include/Algo/Modelisation/planeCutting.hpp
View file @
55cb77c0
...
...
@@ -252,11 +252,215 @@ void planeCut(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& posit
delete
triangulator
;
}
template
<
typename
PFP
>
void
planeCut2
(
typename
PFP
::
MAP
&
map
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
Geom
::
Plane3D
<
typename
PFP
::
REAL
>&
plane
,
CellMarker
<
FACE
>&
cmf_over
,
bool
with_unsew
)
{
typedef
typename
PFP
::
REAL
REAL
;
//marker for vertices on the plane
CellMarker
<
VERTEX
>
cmv
(
map
);
// marker for vertices over the plane
CellMarker
<
VERTEX
>
cmv_over
(
map
);
EdgeAutoAttribute
<
VEC3
>
positionEdge
(
map
);
CellMarker
<
EDGE
>
cme
(
map
);
TraversorE
<
typename
PFP
::
MAP
>
traEdg
(
map
);
for
(
Dart
d
=
traEdg
.
begin
();
d
!=
traEdg
.
end
();
d
=
traEdg
.
next
())
{
Dart
dd
=
map
.
phi1
(
d
);
REAL
dist1
;
REAL
dist2
;
Geom
::
Orientation3D
or1
=
plane
.
orient
(
position
[
d
],
dist1
);
Geom
::
Orientation3D
or2
=
plane
.
orient
(
position
[
dd
],
dist2
);
if
(
or1
==
Geom
::
ON
)
cmv
.
mark
(
d
);
if
(
or2
==
Geom
::
ON
)
cmv
.
mark
(
dd
);
if
((
or1
!=
Geom
::
ON
)
&&
(
or2
!=
Geom
::
ON
)
&&
(
or1
!=
or2
))
{
if
(
dist1
<
0.0
)
dist1
=
-
dist1
;
if
(
dist2
<
0.0
)
// no abs() to avoid type problem with REAL template
dist2
=
-
dist2
;
positionEdge
[
d
]
=
(
position
[
d
]
*
dist2
+
position
[
dd
]
*
dist1
)
/
(
dist1
+
dist2
);
cme
.
mark
(
d
);
if
(
or1
==
Geom
::
OVER
)
cmv_over
.
mark
(
d
);
else
cmv_over
.
mark
(
dd
);
}
else
{
if
(
or1
==
Geom
::
OVER
)
{
cmv_over
.
mark
(
d
);
cmv_over
.
mark
(
dd
);
}
}
}
TraversorF
<
typename
PFP
::
MAP
>
traFac
(
map
);
for
(
Dart
d
=
traFac
.
begin
();
d
!=
traFac
.
end
();
d
=
traFac
.
next
())
{
// turn in the face to search if there are 2 edges marked as intersecting the plane
Traversor2FE
<
typename
PFP
::
MAP
>
traFE
(
map
,
d
);
Dart
e
=
traFE
.
begin
();
while
((
e
!=
traFE
.
end
())
&&
(
!
cme
.
isMarked
(
e
)))
e
=
traFE
.
next
();
Dart
E1
=
NIL
;
if
(
e
!=
traFE
.
end
())
E1
=
e
;
e
=
traFE
.
next
();
while
((
e
!=
traFE
.
end
())
&&
(
!
cme
.
isMarked
(
e
)))
e
=
traFE
.
next
();
Dart
E2
=
NIL
;
if
(
e
!=
traFE
.
end
())
E2
=
e
;
// is there 2 edges intersecting the plane
if
((
E1
!=
NIL
)
&&
(
E2
!=
NIL
))
// && (V2!=map.phi1(V1)) && (V1!=map.phi1(V2)))
{
Dart
x
=
Algo
::
Surface
::
Modelisation
::
trianguleFace
<
PFP
>
(
map
,
E1
);
position
[
x
]
=
(
positionEdge
[
E1
]
+
positionEdge
[
E2
]
)
*
0.5
;
//ensure to not scan this three new faces
traFac
.
skip
(
x
);
traFac
.
skip
(
map
.
phi2
(
x
));
traFac
.
skip
(
map
.
phi2
(
map
.
phi_1
(
x
)));
if
(
cmv_over
.
isMarked
(
E1
))
cmf_over
.
mark
(
map
.
phi2
((
map
.
phi_1
(
E1
))));
if
(
cmv_over
.
isMarked
(
E2
))
cmf_over
.
mark
(
map
.
phi2
((
map
.
phi_1
(
E2
))));
}
else
{
// find the first vertex not on the plane
Dart
e
=
d
;
while
(
cmv
.
isMarked
(
e
))
e
=
map
.
phi1
(
e
);
// face is all on same side than vertex
if
(
cmv_over
.
isMarked
(
e
))
cmf_over
.
mark
(
e
);
}
}
for
(
Dart
d
=
traEdg
.
begin
();
d
!=
traEdg
.
end
();
d
=
traEdg
.
next
())
{
if
(
cme
.
isMarked
(
d
))
{
map
.
flipBackEdge
(
d
);
if
(
with_unsew
)
{
Dart
d2
=
map
.
phi2
(
d
);
map
.
unsewFaces
(
d
);
// ne marche pas !
if
(
cmv_over
.
isMarked
(
map
.
phi_1
(
d
)))
cmf_over
.
mark
(
d
);
if
(
cmv_over
.
isMarked
(
map
.
phi_1
(
d2
)))
cmf_over
.
mark
(
d2
);
}
}
}
}
}
// namespace Modelisation
}
// namespace Surface
namespace
Volume
{
namespace
Modelisation
{
template
<
typename
PFP
>
void
planeCut
(
typename
PFP
::
MAP
&
map
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
Geom
::
Plane3D
<
typename
PFP
::
REAL
>&
plane
,
CellMarker
<
FACE
>&
cmf_over
,
bool
keepTetrahedra
=
false
,
bool
with_unsew
=
true
)
{
typedef
typename
PFP
::
REAL
REAL
;
//marker for vertices on the plane
CellMarker
<
VERTEX
>
cmv
(
map
);
// marker for vertices over the plane
CellMarker
<
VERTEX
>
cmv_over
(
map
);
TraversorE
<
typename
PFP
::
MAP
>
traEdg
(
map
);
for
(
Dart
d
=
traEdg
.
begin
();
d
!=
traEdg
.
end
();
d
=
traEdg
.
next
())
{
Dart
dd
=
map
.
phi1
(
d
);
REAL
dist1
;
REAL
dist2
;
Geom
::
Orientation3D
or1
=
plane
.
orient
(
position
[
d
],
dist1
);
Geom
::
Orientation3D
or2
=
plane
.
orient
(
position
[
dd
],
dist2
);
if
(
or1
==
Geom
::
ON
)
cmv
.
mark
(
d
);
if
(
or2
==
Geom
::
ON
)
cmv
.
mark
(
dd
);
if
((
or1
!=
Geom
::
ON
)
&&
(
or2
!=
Geom
::
ON
)
&&
(
or1
!=
or2
))
{
Dart
x
=
map
.
cutEdge
(
d
);
if
(
dist1
<
0.0
)
dist1
=
-
dist1
;
if
(
dist2
<
0.0
)
// no abs() to avoid type problem with REAL template
dist2
=
-
dist2
;
position
[
x
]
=
(
position
[
d
]
*
dist2
+
position
[
dd
]
*
dist1
)
/
(
dist1
+
dist2
);
traEdg
.
skip
(
x
);
traEdg
.
skip
(
map
.
phi_1
(
x
));
cmv
.
mark
(
x
);
if
(
or1
==
Geom
::
OVER
)
cmv_over
.
mark
(
d
);
else
cmv_over
.
mark
(
dd
);
}
else
{
if
(
or1
==
Geom
::
OVER
)
{
cmv_over
.
mark
(
d
);
cmv_over
.
mark
(
dd
);
}
}
}
TraversorW
<
typename
PFP
::
MAP
>
traVol
(
map
);
for
(
Dart
d
=
traVol
.
begin
();
d
!=
traVol
.
end
();
d
=
traVol
.
next
())
{
// turn in the volume to search if there are ? vertices marked as on the plane
}