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
ce1186a4
Commit
ce1186a4
authored
Jan 16, 2013
by
untereiner
Browse files
some namespace correction + dual map3 function
parent
fda2918a
Changes
10
Hide whitespace changes
Inline
Side-by-side
include/Algo/Decimation/edgeSelector.h
View file @
ce1186a4
...
...
@@ -379,14 +379,14 @@ public:
if
(
!
normal
.
isValid
())
{
normal
=
m
.
template
addAttribute
<
VEC3
,
VERTEX
>(
"normal"
)
;
Algo
::
Geometry
::
computeNormalVertices
<
PFP
>
(
m
,
pos
,
normal
)
;
Algo
::
Surface
::
Geometry
::
computeNormalVertices
<
PFP
>
(
m
,
pos
,
normal
)
;
}
edgeangle
=
m
.
template
getAttribute
<
REAL
,
EDGE
>(
"edgeangle"
)
;
if
(
!
edgeangle
.
isValid
())
{
edgeangle
=
m
.
template
addAttribute
<
REAL
,
EDGE
>(
"edgeangle"
)
;
Algo
::
Geometry
::
computeAnglesBetweenNormalsOnEdges
<
PFP
>
(
m
,
pos
,
edgeangle
)
;
Algo
::
Surface
::
Geometry
::
computeAnglesBetweenNormalsOnEdges
<
PFP
>
(
m
,
pos
,
edgeangle
)
;
}
kmax
=
m
.
template
getAttribute
<
REAL
,
VERTEX
>(
"kmax"
)
;
...
...
@@ -403,7 +403,7 @@ public:
Kmax
=
m
.
template
addAttribute
<
VEC3
,
VERTEX
>(
"Kmax"
)
;
Kmin
=
m
.
template
addAttribute
<
VEC3
,
VERTEX
>(
"Kmin"
)
;
Knormal
=
m
.
template
addAttribute
<
VEC3
,
VERTEX
>(
"Knormal"
)
;
Algo
::
Geometry
::
computeCurvatureVertices_NormalCycles
<
PFP
>
(
m
,
radius
,
pos
,
normal
,
edgeangle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
)
;
Algo
::
Surface
::
Geometry
::
computeCurvatureVertices_NormalCycles
<
PFP
>
(
m
,
radius
,
pos
,
normal
,
edgeangle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
)
;
}
edgeInfo
=
m
.
template
addAttribute
<
EdgeInfo
,
EDGE
>(
"edgeInfo"
)
;
...
...
@@ -467,7 +467,7 @@ public:
if
(
!
edgeangle
.
isValid
())
{
edgeangle
=
m
.
template
addAttribute
<
REAL
,
EDGE
>(
"edgeangle"
)
;
Algo
::
Geometry
::
computeAnglesBetweenNormalsOnEdges
<
PFP
>
(
m
,
pos
,
edgeangle
)
;
Algo
::
Surface
::
Geometry
::
computeAnglesBetweenNormalsOnEdges
<
PFP
>
(
m
,
pos
,
edgeangle
)
;
}
edgeInfo
=
m
.
template
addAttribute
<
EdgeInfo
,
EDGE
>(
"edgeInfo"
)
;
...
...
include/Algo/Decimation/edgeSelector.hpp
View file @
ce1186a4
...
...
@@ -300,7 +300,7 @@ void EdgeSelector_Length<PFP>::updateEdgeInfo(Dart d, bool recompute)
template
<
typename
PFP
>
void
EdgeSelector_Length
<
PFP
>::
computeEdgeInfo
(
Dart
d
,
EdgeInfo
&
einfo
)
{
VEC3
vec
=
Algo
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
m_map
,
d
,
this
->
m_position
)
;
VEC3
vec
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
m_map
,
d
,
this
->
m_position
)
;
einfo
.
it
=
edges
.
insert
(
std
::
make_pair
(
vec
.
norm2
(),
d
))
;
einfo
.
valid
=
true
;
}
...
...
@@ -989,7 +989,7 @@ void EdgeSelector_NormalArea<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
template
<
typename
PFP
>
void
EdgeSelector_NormalArea
<
PFP
>::
computeEdgeMatrix
(
Dart
d
)
{
const
typename
PFP
::
VEC3
e
=
Algo
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
m_map
,
d
,
this
->
m_position
)
;
const
typename
PFP
::
VEC3
e
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
m_map
,
d
,
this
->
m_position
)
;
edgeMatrix
[
d
].
identity
();
edgeMatrix
[
d
]
*=
e
.
norm2
();
edgeMatrix
[
d
]
-=
Geom
::
transposed_vectors_mult
(
e
,
e
)
;
...
...
@@ -1086,15 +1086,15 @@ void EdgeSelector_Curvature<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
{
typename
PFP
::
MAP
&
m
=
this
->
m_map
;
normal
[
d2
]
=
Algo
::
Geometry
::
vertexNormal
<
PFP
>
(
m
,
d2
,
this
->
m_position
)
;
Algo
::
Geometry
::
computeCurvatureVertex_NormalCycles
<
PFP
>
(
m
,
d2
,
radius
,
this
->
m_position
,
normal
,
edgeangle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
)
;
normal
[
d2
]
=
Algo
::
Surface
::
Geometry
::
vertexNormal
<
PFP
>
(
m
,
d2
,
this
->
m_position
)
;
Algo
::
Surface
::
Geometry
::
computeCurvatureVertex_NormalCycles
<
PFP
>
(
m
,
d2
,
radius
,
this
->
m_position
,
normal
,
edgeangle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
)
;
Dart
vit
=
d2
;
do
{
Dart
nVert
=
m
.
phi1
(
vit
)
;
normal
[
nVert
]
=
Algo
::
Geometry
::
vertexNormal
<
PFP
>
(
m
,
nVert
,
this
->
m_position
)
;
Algo
::
Geometry
::
computeCurvatureVertex_NormalCycles
<
PFP
>
(
m
,
nVert
,
radius
,
this
->
m_position
,
normal
,
edgeangle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
)
;
normal
[
nVert
]
=
Algo
::
Surface
::
Geometry
::
vertexNormal
<
PFP
>
(
m
,
nVert
,
this
->
m_position
)
;
Algo
::
Surface
::
Geometry
::
computeCurvatureVertex_NormalCycles
<
PFP
>
(
m
,
nVert
,
radius
,
this
->
m_position
,
normal
,
edgeangle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
)
;
updateEdgeInfo
(
m
.
phi1
(
vit
),
false
)
;
// must recompute some edge infos in the
if
(
vit
==
d2
||
vit
==
dd2
)
// neighborhood of the collapsed edge
...
...
@@ -1193,8 +1193,8 @@ void EdgeSelector_Curvature<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
this
->
m_position
[
newV
]
=
m_positionApproximator
->
getApprox
(
d
)
;
// compute things on the coarse version of the mesh
normal
[
newV
]
=
Algo
::
Geometry
::
vertexNormal
<
PFP
>
(
m
,
d2
,
this
->
m_position
)
;
Algo
::
Geometry
::
computeCurvatureVertex_NormalCycles
<
PFP
>
(
m
,
d2
,
radius
,
this
->
m_position
,
normal
,
edgeangle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
)
;
normal
[
newV
]
=
Algo
::
Surface
::
Geometry
::
vertexNormal
<
PFP
>
(
m
,
d2
,
this
->
m_position
)
;
Algo
::
Surface
::
Geometry
::
computeCurvatureVertex_NormalCycles
<
PFP
>
(
m
,
d2
,
radius
,
this
->
m_position
,
normal
,
edgeangle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
)
;
// VEC3 norm = normal[newV] ;
REAL
mCurv
=
(
kmax
[
newV
]
+
kmin
[
newV
])
/
REAL
(
2
)
;
...
...
@@ -1335,7 +1335,7 @@ void EdgeSelector_CurvatureTensor<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
{
if
(
!
eMark
.
isMarked
(
dit2
))
{
edgeangle
[
dit2
]
=
Algo
::
Geometry
::
computeAngleBetweenNormalsOnEdge
<
PFP
>
(
m
,
dit2
,
this
->
m_position
)
;
edgeangle
[
dit2
]
=
Algo
::
Surface
::
Geometry
::
computeAngleBetweenNormalsOnEdge
<
PFP
>
(
m
,
dit2
,
this
->
m_position
)
;
eMark
.
mark
(
dit2
);
}
}
...
...
@@ -1408,11 +1408,11 @@ void EdgeSelector_CurvatureTensor<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
// compute tensor before collapse
MATRIX
tens1
;
Algo
::
Selection
::
Collector_OneRing_AroundEdge
<
PFP
>
col1
(
m
);
Algo
::
Surface
::
Selection
::
Collector_OneRing_AroundEdge
<
PFP
>
col1
(
m
);
col1
.
collectAll
(
d
);
col1
.
computeNormalCyclesTensor
(
this
->
m_position
,
edgeangle
,
tens1
);
// edgeangle is up to date here
tens1
*=
col1
.
computeArea
(
this
->
m_position
);
// mean tensor * area = integral of the tensor
Algo
::
Geometry
::
normalCycles_SortTensor
<
PFP
>
(
tens1
);
Algo
::
Surface
::
Geometry
::
normalCycles_SortTensor
<
PFP
>
(
tens1
);
// temporary edge collapse
Dart
d2
=
m
.
phi2
(
m
.
phi_1
(
d
))
;
...
...
@@ -1423,11 +1423,11 @@ void EdgeSelector_CurvatureTensor<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
// compute tensor after collapse
MATRIX
tens2
;
Algo
::
Selection
::
Collector_OneRing
<
PFP
>
col2
(
m
);
Algo
::
Surface
::
Selection
::
Collector_OneRing
<
PFP
>
col2
(
m
);
col2
.
collectAll
(
d
);
col2
.
computeNormalCyclesTensor
(
this
->
m_position
,
tens2
);
// edgeangle is not up to date here
tens2
*=
col2
.
computeArea
(
this
->
m_position
);
// mean tensor * area = integral of the tensor
Algo
::
Geometry
::
normalCycles_SortTensor
<
PFP
>
(
tens2
);
Algo
::
Surface
::
Geometry
::
normalCycles_SortTensor
<
PFP
>
(
tens2
);
// vertex split to reset the initial connectivity and embeddings
m
.
insertTrianglePair
(
d
,
d2
,
dd2
)
;
...
...
include/Algo/Geometry/curvature.h
View file @
ce1186a4
...
...
@@ -181,7 +181,7 @@ void computeCurvatureVertex_NormalCycles_Projected(
template
<
typename
PFP
>
void
computeCurvatureVertices_NormalCycles
(
typename
PFP
::
MAP
&
map
,
Algo
::
Selection
::
Collector
<
PFP
>
&
neigh
,
Algo
::
Surface
::
Selection
::
Collector
<
PFP
>
&
neigh
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
normal
,
const
EdgeAttribute
<
typename
PFP
::
REAL
>&
edgeangle
,
...
...
@@ -196,7 +196,7 @@ template <typename PFP>
void
computeCurvatureVertex_NormalCycles
(
typename
PFP
::
MAP
&
map
,
Dart
dart
,
Algo
::
Selection
::
Collector
<
PFP
>
&
neigh
,
Algo
::
Surface
::
Selection
::
Collector
<
PFP
>
&
neigh
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
normal
,
const
EdgeAttribute
<
typename
PFP
::
REAL
>&
edgeangle
,
...
...
@@ -209,7 +209,7 @@ void computeCurvatureVertex_NormalCycles(
template
<
typename
PFP
>
void
computeCurvatureVertices_NormalCycles_Projected
(
typename
PFP
::
MAP
&
map
,
Algo
::
Selection
::
Collector
<
PFP
>
&
neigh
,
Algo
::
Surface
::
Selection
::
Collector
<
PFP
>
&
neigh
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
normal
,
const
EdgeAttribute
<
typename
PFP
::
REAL
>&
edgeangle
,
...
...
@@ -224,7 +224,7 @@ template <typename PFP>
void
computeCurvatureVertex_NormalCycles_Projected
(
typename
PFP
::
MAP
&
map
,
Dart
dart
,
Algo
::
Selection
::
Collector
<
PFP
>
&
neigh
,
Algo
::
Surface
::
Selection
::
Collector
<
PFP
>
&
neigh
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
normal
,
const
EdgeAttribute
<
typename
PFP
::
REAL
>&
edgeangle
,
...
...
include/Algo/Geometry/curvature.hpp
View file @
ce1186a4
...
...
@@ -80,7 +80,7 @@ void computeCurvatureVertex_QuadraticFitting(
VEC3
n
=
normal
[
dart
]
;
MATRIX33
localFrame
=
Geometry
::
vertexLocalFrame
<
PFP
>
(
map
,
dart
,
position
,
n
)
;
MATRIX33
localFrame
=
Algo
::
Geometry
::
vertexLocalFrame
<
PFP
>
(
map
,
dart
,
position
,
n
)
;
MATRIX33
invLocalFrame
;
localFrame
.
invert
(
invLocalFrame
)
;
...
...
include/Algo/Geometry/localFrame.h
View file @
ce1186a4
...
...
@@ -44,8 +44,8 @@ namespace Geometry
template
<
typename
PFP
>
void
vertexLocalFrame
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
typename
PFP
::
VEC3
&
X
,
typename
PFP
::
VEC3
&
Y
,
typename
PFP
::
VEC3
&
Z
)
{
Z
=
vertexNormal
<
PFP
>
(
map
,
d
,
position
)
;
X
=
vectorOutOfDart
<
PFP
>
(
map
,
d
,
position
)
;
Z
=
Algo
::
Surface
::
Geometry
::
vertexNormal
<
PFP
>
(
map
,
d
,
position
)
;
X
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
map
,
d
,
position
)
;
Y
=
Z
^
X
;
Y
.
normalize
()
;
X
=
Y
^
Z
;
...
...
@@ -70,7 +70,7 @@ template <typename PFP>
void
vertexLocalFrame
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
typename
PFP
::
VEC3
&
normal
,
typename
PFP
::
VEC3
&
X
,
typename
PFP
::
VEC3
&
Y
,
typename
PFP
::
VEC3
&
Z
)
{
Z
=
normal
;
X
=
vectorOutOfDart
<
PFP
>
(
map
,
d
,
position
)
;
X
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
map
,
d
,
position
)
;
Y
=
Z
^
X
;
Y
.
normalize
()
;
X
=
Y
^
Z
;
...
...
include/Algo/ProgressiveMesh/pmesh.h
View file @
ce1186a4
...
...
@@ -62,13 +62,13 @@ private:
DartMarker
&
inactiveMarker
;
SelectorUnmarked
dartSelect
;
Algo
::
Decimation
::
EdgeSelector
<
PFP
>*
m_selector
;
std
::
vector
<
Algo
::
Decimation
::
ApproximatorGen
<
PFP
>*>
m_approximators
;
std
::
vector
<
Algo
::
Decimation
::
PredictorGen
<
PFP
>*>
m_predictors
;
Algo
::
Surface
::
Decimation
::
EdgeSelector
<
PFP
>*
m_selector
;
std
::
vector
<
Algo
::
Surface
::
Decimation
::
ApproximatorGen
<
PFP
>*>
m_approximators
;
std
::
vector
<
Algo
::
Surface
::
Decimation
::
PredictorGen
<
PFP
>*>
m_predictors
;
std
::
vector
<
VSplit
<
PFP
>*>
m_splits
;
unsigned
int
m_cur
;
Algo
::
Decimation
::
Approximator
<
PFP
,
VEC3
,
EDGE
>*
m_positionApproximator
;
Algo
::
Surface
::
Decimation
::
Approximator
<
PFP
,
VEC3
,
EDGE
>*
m_positionApproximator
;
bool
m_initOk
;
...
...
@@ -77,12 +77,12 @@ private:
std
::
vector
<
VEC3
>
originalDetailVectors
;
bool
quantizationInitialized
,
quantizationApplied
;
Quantization
<
VEC3
>*
q
;
Algo
::
PMesh
::
Quantization
<
VEC3
>*
q
;
public:
ProgressiveMesh
(
MAP
&
map
,
DartMarker
&
inactive
,
Algo
::
Decimation
::
SelectorType
s
,
Algo
::
Decimation
::
ApproximatorType
a
,
Algo
::
Surface
::
Decimation
::
SelectorType
s
,
Algo
::
Surface
::
Decimation
::
ApproximatorType
a
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
)
;
~
ProgressiveMesh
()
;
...
...
@@ -92,9 +92,9 @@ public:
void
createPM
(
unsigned
int
percentWantedVertices
)
;
std
::
vector
<
VSplit
<
PFP
>*>&
splits
()
{
return
m_splits
;
}
Algo
::
Decimation
::
EdgeSelector
<
PFP
>*
selector
()
{
return
m_selector
;
}
std
::
vector
<
Algo
::
Decimation
::
ApproximatorGen
<
PFP
>*>&
approximators
()
{
return
m_approximators
;
}
std
::
vector
<
Algo
::
Decimation
::
PredictorGen
<
PFP
>*>&
predictors
()
{
return
m_predictors
;
}
Algo
::
Surface
::
Decimation
::
EdgeSelector
<
PFP
>*
selector
()
{
return
m_selector
;
}
std
::
vector
<
Algo
::
Surface
::
Decimation
::
ApproximatorGen
<
PFP
>*>&
approximators
()
{
return
m_approximators
;
}
std
::
vector
<
Algo
::
Surface
::
Decimation
::
PredictorGen
<
PFP
>*>&
predictors
()
{
return
m_predictors
;
}
void
edgeCollapse
(
VSplit
<
PFP
>*
vs
)
;
void
vertexSplit
(
VSplit
<
PFP
>*
vs
)
;
...
...
include/Algo/ProgressiveMesh/pmesh.hpp
View file @
ce1186a4
...
...
@@ -284,7 +284,7 @@ void ProgressiveMesh<PFP>::refine()
typename
PFP
::
MATRIX33
invLocalFrame
;
if
(
m_localFrameDetailVectors
)
{
typename
PFP
::
MATRIX33
localFrame
=
Algo
::
Surface
::
Geometry
::
vertexLocalFrame
<
PFP
>
(
m_map
,
dd2
,
positionsTable
)
;
typename
PFP
::
MATRIX33
localFrame
=
Algo
::
Geometry
::
vertexLocalFrame
<
PFP
>
(
m_map
,
dd2
,
positionsTable
)
;
localFrame
.
invert
(
invLocalFrame
)
;
}
...
...
@@ -381,7 +381,7 @@ void ProgressiveMesh<PFP>::localizeDetailVectors()
{
Dart
d
=
m_splits
[
m_cur
-
1
]
->
getEdge
()
;
Dart
dd2
=
m_splits
[
m_cur
-
1
]
->
getRightEdge
()
;
typename
PFP
::
MATRIX33
localFrame
=
Algo
::
Surface
::
Geometry
::
vertexLocalFrame
<
PFP
>
(
m_map
,
dd2
,
positionsTable
)
;
typename
PFP
::
MATRIX33
localFrame
=
Algo
::
Geometry
::
vertexLocalFrame
<
PFP
>
(
m_map
,
dd2
,
positionsTable
)
;
VEC3
det
=
m_positionApproximator
->
getDetail
(
d
)
;
det
=
localFrame
*
det
;
m_positionApproximator
->
setDetail
(
d
,
det
)
;
...
...
@@ -412,7 +412,7 @@ void ProgressiveMesh<PFP>::globalizeDetailVectors()
{
Dart
d
=
m_splits
[
m_cur
-
1
]
->
getEdge
()
;
Dart
dd2
=
m_splits
[
m_cur
-
1
]
->
getRightEdge
()
;
typename
PFP
::
MATRIX33
localFrame
=
Algo
::
Surface
::
Geometry
::
vertexLocalFrame
<
PFP
>
(
m_map
,
dd2
,
positionsTable
)
;
typename
PFP
::
MATRIX33
localFrame
=
Algo
::
Geometry
::
vertexLocalFrame
<
PFP
>
(
m_map
,
dd2
,
positionsTable
)
;
typename
PFP
::
MATRIX33
invLocalFrame
;
localFrame
.
invert
(
invLocalFrame
)
;
VEC3
det
=
m_positionApproximator
->
getDetail
(
d
)
;
...
...
@@ -436,7 +436,7 @@ void ProgressiveMesh<PFP>::initQuantization()
originalDetailVectors
.
resize
(
m_splits
.
size
())
;
for
(
unsigned
int
i
=
0
;
i
<
m_splits
.
size
();
++
i
)
originalDetailVectors
[
i
]
=
m_positionApproximator
->
getDetail
(
m_splits
[
i
]
->
getEdge
(),
0
)
;
q
=
new
Quantization
<
VEC3
>
(
originalDetailVectors
)
;
q
=
new
Algo
::
PMesh
::
Quantization
<
VEC3
>
(
originalDetailVectors
)
;
quantizationInitialized
=
true
;
CGoGNout
<<
" Differential Entropy -> "
<<
q
->
getDifferentialEntropy
()
<<
CGoGNendl
;
}
...
...
@@ -575,8 +575,7 @@ void ProgressiveMesh<PFP>::calculCourbeDebitDistortion()
}
*/
}
//namespace PMesh
}
// Surface
}
//namespace Algo
}
}
//namespace CGoGN
}
// namespace PMesh
}
// namespace Surface
}
// namespace Algo
}
// namespace CGoGN
include/Algo/Selection/collector.hpp
View file @
ce1186a4
...
...
@@ -150,7 +150,7 @@ typename PFP::REAL Collector_OneRing<PFP>::computeArea(const VertexAttribute<VEC
REAL
area
=
0
;
for
(
std
::
vector
<
Dart
>::
const_iterator
it
=
this
->
insideFaces
.
begin
();
it
!=
this
->
insideFaces
.
end
();
++
it
)
area
+=
Algo
::
Geometry
::
triangleArea
<
PFP
>
(
this
->
map
,
*
it
,
pos
);
area
+=
Algo
::
Surface
::
Geometry
::
triangleArea
<
PFP
>
(
this
->
map
,
*
it
,
pos
);
return
area
;
}
...
...
@@ -164,7 +164,7 @@ void Collector_OneRing<PFP>::computeNormalCyclesTensor (const VertexAttribute<VE
// collect edges inside the neighborhood
for
(
std
::
vector
<
Dart
>::
const_iterator
it
=
this
->
insideEdges
.
begin
();
it
!=
this
->
insideEdges
.
end
();
++
it
)
{
const
VEC3
e
=
Algo
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
const
VEC3
e
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
tensor
+=
Geom
::
transposed_vectors_mult
(
e
,
e
)
*
edgeangle
[
*
it
]
*
(
1
/
e
.
norm
())
;
}
...
...
@@ -180,8 +180,8 @@ void Collector_OneRing<PFP>::computeNormalCyclesTensor (const VertexAttribute<VE
// collect edges inside the neighborhood
for
(
std
::
vector
<
Dart
>::
const_iterator
it
=
this
->
insideEdges
.
begin
();
it
!=
this
->
insideEdges
.
end
();
++
it
)
{
const
VEC3
e
=
Algo
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
const
REAL
edgeangle
=
Algo
::
Geometry
::
computeAngleBetweenNormalsOnEdge
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
const
VEC3
e
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
const
REAL
edgeangle
=
Algo
::
Surface
::
Geometry
::
computeAngleBetweenNormalsOnEdge
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
tensor
+=
Geom
::
transposed_vectors_mult
(
e
,
e
)
*
edgeangle
*
(
1
/
e
.
norm
())
;
}
...
...
@@ -256,7 +256,7 @@ typename PFP::REAL Collector_OneRing_AroundEdge<PFP>::computeArea(const VertexAt
REAL
area
=
0
;
for
(
std
::
vector
<
Dart
>::
const_iterator
it
=
this
->
insideFaces
.
begin
();
it
!=
this
->
insideFaces
.
end
();
++
it
)
area
+=
Algo
::
Geometry
::
triangleArea
<
PFP
>
(
this
->
map
,
*
it
,
pos
);
area
+=
Algo
::
Surface
::
Geometry
::
triangleArea
<
PFP
>
(
this
->
map
,
*
it
,
pos
);
return
area
;
}
...
...
@@ -270,7 +270,7 @@ void Collector_OneRing_AroundEdge<PFP>::computeNormalCyclesTensor (const VertexA
// collect edges inside the neighborhood
for
(
std
::
vector
<
Dart
>::
const_iterator
it
=
this
->
insideEdges
.
begin
();
it
!=
this
->
insideEdges
.
end
();
++
it
)
{
const
VEC3
e
=
Algo
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
const
VEC3
e
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
tensor
+=
Geom
::
transposed_vectors_mult
(
e
,
e
)
*
edgeangle
[
*
it
]
*
(
1
/
e
.
norm
())
;
}
...
...
@@ -286,8 +286,8 @@ void Collector_OneRing_AroundEdge<PFP>::computeNormalCyclesTensor (const VertexA
// collect edges inside the neighborhood
for
(
std
::
vector
<
Dart
>::
const_iterator
it
=
this
->
insideEdges
.
begin
();
it
!=
this
->
insideEdges
.
end
();
++
it
)
{
const
VEC3
e
=
Algo
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
const
REAL
edgeangle
=
Algo
::
Geometry
::
computeAngleBetweenNormalsOnEdge
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
const
VEC3
e
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
const
REAL
edgeangle
=
Algo
::
Surface
::
Geometry
::
computeAngleBetweenNormalsOnEdge
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
tensor
+=
Geom
::
transposed_vectors_mult
(
e
,
e
)
*
edgeangle
*
(
1
/
e
.
norm
())
;
}
...
...
@@ -433,14 +433,14 @@ typename PFP::REAL Collector_WithinSphere<PFP>::computeArea(const VertexAttribut
typename
PFP
::
REAL
alpha
,
beta
;
Geometry
::
intersectionSphereEdge
<
PFP
>
(
this
->
map
,
centerPosition
,
this
->
radius
,
*
it
,
pos
,
alpha
);
Geometry
::
intersectionSphereEdge
<
PFP
>
(
this
->
map
,
centerPosition
,
this
->
radius
,
this
->
map
.
phi2
(
f
),
pos
,
beta
);
area
+=
(
alpha
+
beta
-
alpha
*
beta
)
*
Algo
::
Geometry
::
triangleArea
<
PFP
>
(
this
->
map
,
*
it
,
pos
);
area
+=
(
alpha
+
beta
-
alpha
*
beta
)
*
Algo
::
Surface
::
Geometry
::
triangleArea
<
PFP
>
(
this
->
map
,
*
it
,
pos
);
}
else
{
// f and g are outside
typename
PFP
::
REAL
alpha
,
beta
;
Geometry
::
intersectionSphereEdge
<
PFP
>
(
this
->
map
,
centerPosition
,
this
->
radius
,
*
it
,
pos
,
alpha
);
Geometry
::
intersectionSphereEdge
<
PFP
>
(
this
->
map
,
centerPosition
,
this
->
radius
,
this
->
map
.
phi2
(
g
),
pos
,
beta
);
area
+=
alpha
*
beta
*
Algo
::
Geometry
::
triangleArea
<
PFP
>
(
this
->
map
,
*
it
,
pos
);
area
+=
alpha
*
beta
*
Algo
::
Surface
::
Geometry
::
triangleArea
<
PFP
>
(
this
->
map
,
*
it
,
pos
);
}
}
return
area
;
...
...
@@ -456,15 +456,15 @@ void Collector_WithinSphere<PFP>::computeNormalCyclesTensor (const VertexAttribu
// collect edges inside the neighborhood
for
(
std
::
vector
<
Dart
>::
const_iterator
it
=
this
->
insideEdges
.
begin
();
it
!=
this
->
insideEdges
.
end
();
++
it
)
{
const
VEC3
e
=
Algo
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
const
VEC3
e
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
tensor
+=
Geom
::
transposed_vectors_mult
(
e
,
e
)
*
edgeangle
[
*
it
]
*
(
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
)
{
const
VEC3
e
=
Algo
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
const
VEC3
e
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
REAL
alpha
;
Algo
::
Geometry
::
intersectionSphereEdge
<
PFP
>
(
this
->
map
,
centerPosition
,
radius
,
*
it
,
pos
,
alpha
)
;
Algo
::
Surface
::
Geometry
::
intersectionSphereEdge
<
PFP
>
(
this
->
map
,
centerPosition
,
radius
,
*
it
,
pos
,
alpha
)
;
tensor
+=
Geom
::
transposed_vectors_mult
(
e
,
e
)
*
edgeangle
[
*
it
]
*
(
1
/
e
.
norm
())
*
alpha
;
}
...
...
@@ -482,17 +482,17 @@ void Collector_WithinSphere<PFP>::computeNormalCyclesTensor (const VertexAttribu
// collect edges inside the neighborhood
for
(
std
::
vector
<
Dart
>::
const_iterator
it
=
this
->
insideEdges
.
begin
();
it
!=
this
->
insideEdges
.
end
();
++
it
)
{
const
VEC3
e
=
Algo
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
const
REAL
edgeangle
=
Algo
::
Geometry
::
computeAngleBetweenNormalsOnEdge
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
const
VEC3
e
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
const
REAL
edgeangle
=
Algo
::
Surface
::
Geometry
::
computeAngleBetweenNormalsOnEdge
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
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
)
{
const
VEC3
e
=
Algo
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
const
VEC3
e
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
REAL
alpha
;
Algo
::
Geometry
::
intersectionSphereEdge
<
PFP
>
(
this
->
map
,
centerPosition
,
radius
,
*
it
,
pos
,
alpha
)
;
const
REAL
edgeangle
=
Algo
::
Geometry
::
computeAngleBetweenNormalsOnEdge
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
Algo
::
Surface
::
Geometry
::
intersectionSphereEdge
<
PFP
>
(
this
->
map
,
centerPosition
,
radius
,
*
it
,
pos
,
alpha
)
;
const
REAL
edgeangle
=
Algo
::
Surface
::
Geometry
::
computeAngleBetweenNormalsOnEdge
<
PFP
>
(
this
->
map
,
*
it
,
pos
)
;
tensor
+=
Geom
::
transposed_vectors_mult
(
e
,
e
)
*
edgeangle
*
(
1
/
e
.
norm
())
*
alpha
;
}
...
...
include/Topology/generic/functor.h
View file @
ce1186a4
...
...
@@ -120,6 +120,29 @@ inline SelectorOr operator||(const FunctorSelect& fs1, const FunctorSelect& fs2)
return
SelectorOr
(
fs1
,
fs2
);
}
template
<
typename
MAP
>
class
SelectorVertexBoundary
:
public
FunctorSelect
{
public:
protected:
MAP
&
m_map
;
public:
SelectorVertexBoundary
(
MAP
&
m
)
:
m_map
(
m
)
{}
bool
operator
()(
Dart
d
)
const
{
return
m_map
.
isBoundaryVertex
(
d
);
}
FunctorSelect
*
copy
()
const
{
return
new
SelectorVertexBoundary
(
m_map
);}
};
template
<
typename
MAP
>
class
SelectorVertexNoBoundary
:
public
FunctorSelect
{
public:
protected:
MAP
&
m_map
;
public:
SelectorVertexNoBoundary
(
MAP
&
m
)
:
m_map
(
m
)
{}
bool
operator
()(
Dart
d
)
const
{
return
!
m_map
.
isBoundaryVertex
(
d
);
}
FunctorSelect
*
copy
()
const
{
return
new
SelectorVertexNoBoundary
(
m_map
);}
};
template
<
typename
MAP
>
class
SelectorEdgeBoundary
:
public
FunctorSelect
...
...
src/Topology/map/map3.cpp
View file @
ce1186a4
...
...
@@ -1234,25 +1234,40 @@ unsigned int Map3::closeMap()
void
Map3
::
reverseOrientation
()
{
DartAttribute
<
unsigned
int
>
emb0
(
this
,
getEmbeddingAttributeVector
<
VERTEX
>
())
;
if
(
emb0
.
isValid
())
{
DartAttribute
<
unsigned
int
>
new_emb0
=
addAttribute
<
unsigned
int
,
DART
>
(
"new_EMB_0"
)
;
for
(
Dart
d
=
begin
();
d
!=
end
();
next
(
d
))
new_emb0
[
d
]
=
emb0
[
phi1
(
d
)]
;
swapAttributes
<
unsigned
int
>
(
emb0
,
new_emb0
)
;
removeAttribute
(
new_emb0
)
;
}
DartAttribute
<
Dart
>
n_phi1
=
getAttribute
<
Dart
,
DART
>
(
"phi1"
)
;
DartAttribute
<
Dart
>
n_phi_1
=
getAttribute
<
Dart
,
DART
>
(
"phi_1"
)
;
swapAttributes
<
Dart
>
(
n_phi1
,
n_phi_1
)
;
}
void
Map3
::
computeDual
()
{
// unsigned int count = 0;
// CellMarkerNoUnmark<VERTEX> cv(*this);
// std::vector<Dart> v;
// for(Dart d = begin(); d != end(); next(d))
// {
// if(!cv.isMarked(d) && isBoundaryMarked3(d))
// {
// ++count;
// v.push_back(d);
// cv.mark(d);
// }
// }
//
// std::cout << "boundary vertices : " << count << std::endl;
unsigned
int
count
=
0
;
CellMarkerNoUnmark
<
VERTEX
>
cv
(
*
this
);
std
::
vector
<
Dart
>
v
;
for
(
Dart
d
=
begin
();
d
!=
end
();
next
(
d
))
{
if
(
!
cv
.
isMarked
(
d
)
&&
isBoundaryMarked3
(
d
))
{
++
count
;
v
.
push_back
(
d
);
cv
.
mark
(
d
);
}
}
cv
.
unmarkAll
();
std
::
cout
<<
"boundary vertices : "
<<
count
<<
std
::
endl
;
DartAttribute
<
Dart
>
old_phi1
=
getAttribute
<
Dart
,
DART
>
(
"phi1"
)
;
DartAttribute
<
Dart
>
old_phi_1
=
getAttribute
<
Dart
,
DART
>
(
"phi_1"
)
;
...
...
@@ -1268,6 +1283,7 @@ void Map3::computeDual()
new_phi1
[
d
]
=
dd
;
new_phi_1
[
dd
]
=
d
;
//Dart ddd = phi3(phi_1(d));
Dart
ddd
=
phi1
(
phi3
(
d
));
new_phi2
[
d
]
=
ddd
;
new_phi2
[
ddd
]
=
d
;
...
...
@@ -1283,29 +1299,43 @@ void Map3::computeDual()
swapEmbeddingContainers
(
VERTEX
,
VOLUME
)
;
// for(std::vector<Dart>::iterator it = v.begin() ; it != v.end() ; ++it)
// {
// boundaryUnmarkOrbit<VOLUME,3>(*it);
// }
//
// for(std::vector<Dart>::iterator it = v.begin() ; it != v.end() ; ++it)
// {
// deleteVolume(*it);
// }
//
// closeMap();
// reverseOrientation();
//boundary management
for
(
Dart
d
=
begin
();
d
!=
end
();
next
(
d
))
{
if
(
isBoundaryMarked3
(
d
))
for
(
std
::
vector
<
Dart
>::
iterator
it
=
v
.
begin
()
;
it
!=
v
.
end
()
;
++
it
)
{
boundaryMarkOrbit
<
VOLUME
,
3
>
(
deleteVertex
(
phi1
(
d
)));
// boundaryUnmarkOrbit<VOLUME,3>(d);
// deleteVolume(d);
boundaryUnmarkOrbit
<
VOLUME
,
3
>
(
*
it
);
}
}
// closeMap();
for
(
std
::
vector
<
Dart
>::
iterator
it
=
v
.
begin
()
;
it
!=
v
.
end
()
;
++
it
)
{
deleteVolume
(
*
it
);
}
// std::cout << "boundary faces : " << closeMap() << std::endl;
// //boundary management
// for(Dart d = begin(); d != end(); next(d))
// {
// if(isBoundaryMarked3(d))
// {
// //Dart dit = deleteVertex(phi3(d));
// //deleteVolume(phi3(d));
// //if(dit == NIL)
// //{
// // std::cout << "ploooooooooooooooooooop" << std::endl;
// // return;
// //}
// //else
// //{
// // std::cout << "gooooooooooooooooooooood" << std::endl;
// // boundaryMarkOrbit<VOLUME,3>(dit);
// // return;
// //}
// //boundaryUnmarkOrbit<VOLUME,3>(d);
// //deleteVolume(d);
// }
// }
}
}
// namespace CGoGN
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment