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
07b36674
Commit
07b36674
authored
May 07, 2015
by
Sylvain Thery
Browse files
Merge branch 'develop' of icube-forge.unistra.fr:thery/cgogn into develop
parents
54ad00eb
517a6df8
Changes
13
Hide whitespace changes
Inline
Side-by-side
Apps/Benches/bench_compact.cpp
View file @
07b36674
...
...
@@ -72,7 +72,7 @@ int main(int argc, char **argv)
std
::
vector
<
VertexAttribute
<
typename
PFP
::
VEC3
,
MAP
>
>
attr
;
attr
.
push_back
(
position
);
Algo
::
Surface
::
Decimation
::
decimate
<
PFP
>
(
myMap
,
Algo
::
Surface
::
Decimation
::
S_QEM
,
Algo
::
Surface
::
Decimation
::
A_QEM
,
attr
,
nbVertices
*
0.05
)
;
Algo
::
Surface
::
Decimation
::
decimate
<
PFP
>
(
myMap
,
Algo
::
Surface
::
Decimation
::
S_QEM
,
Algo
::
Surface
::
Decimation
::
A_QEM
,
attr
,
nbVertices
/
20
)
;
VertexAttribute
<
PFP
::
VEC3
,
MAP
>
normal
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
,
MAP
>
(
"normal"
)
;
VertexAttribute
<
PFP
::
VEC3
,
MAP
>
position2
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
,
MAP
>
(
"pos2"
)
;
...
...
Apps/Benches/bench_remesh.cpp
View file @
07b36674
...
...
@@ -54,19 +54,19 @@ int main(int argc, char **argv)
std
::
vector
<
VertexAttribute
<
typename
PFP
::
VEC3
,
MAP
>
>
attr
;
attr
.
push_back
(
position
);
Algo
::
Surface
::
Decimation
::
decimate
<
PFP
>
(
myMap
,
Algo
::
Surface
::
Decimation
::
S_QEM
,
Algo
::
Surface
::
Decimation
::
A_QEM
,
attr
,
nbVertices
*
0.1
)
;
Algo
::
Surface
::
Decimation
::
decimate
<
PFP
>
(
myMap
,
Algo
::
Surface
::
Decimation
::
S_QEM
,
Algo
::
Surface
::
Decimation
::
A_QEM
,
attr
,
nbVertices
/
10
)
;
Algo
::
Surface
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
)
;
Algo
::
Surface
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
)
;
nbVertices
=
Algo
::
Topo
::
getNbOrbits
<
VERTEX
>
(
myMap
)
;
Algo
::
Surface
::
Decimation
::
decimate
<
PFP
>
(
myMap
,
Algo
::
Surface
::
Decimation
::
S_QEM
,
Algo
::
Surface
::
Decimation
::
A_QEM
,
attr
,
nbVertices
*
0.1
)
;
Algo
::
Surface
::
Decimation
::
decimate
<
PFP
>
(
myMap
,
Algo
::
Surface
::
Decimation
::
S_QEM
,
Algo
::
Surface
::
Decimation
::
A_QEM
,
attr
,
nbVertices
/
10
)
;
Algo
::
Surface
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
)
;
Algo
::
Surface
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
)
;
nbVertices
=
Algo
::
Topo
::
getNbOrbits
<
VERTEX
>
(
myMap
)
;
Algo
::
Surface
::
Decimation
::
decimate
<
PFP
>
(
myMap
,
Algo
::
Surface
::
Decimation
::
S_QEM
,
Algo
::
Surface
::
Decimation
::
A_QEM
,
attr
,
nbVertices
*
0.1
)
;
Algo
::
Surface
::
Decimation
::
decimate
<
PFP
>
(
myMap
,
Algo
::
Surface
::
Decimation
::
S_QEM
,
Algo
::
Surface
::
Decimation
::
A_QEM
,
attr
,
nbVertices
/
10
)
;
Algo
::
Surface
::
Modelisation
::
CatmullClarkSubdivision
<
PFP
>
(
myMap
,
position
)
;
Algo
::
Surface
::
Modelisation
::
CatmullClarkSubdivision
<
PFP
>
(
myMap
,
position
)
;
...
...
Apps/Benches/bench_trav.cpp
View file @
07b36674
...
...
@@ -81,9 +81,11 @@ int main()
});
centerFace
/=
nbVert
;
centerVol
+=
centerFace
;
nbFaces
++
;
});
centerVol
/=
nbFaces
;
centerMesh
+=
centerVol
;
nbVols
++
;
});
centerMesh
/=
nbVols
;
CGoGNout
<<
"Traverse with foreach in "
<<
ch
.
elapsed
()
<<
" ms"
<<
CGoGNendl
;
...
...
@@ -110,9 +112,11 @@ int main()
}
centerFace
/=
nbVert
;
centerVol
+=
centerFace
;
nbFaces
++
;
}
centerVol
/=
nbFaces
;
centerMesh
+=
centerVol
;
nbVols
++
;
}
CGoGNout
<<
"Traverse with traversor in "
<<
ch
.
elapsed
()
<<
" ms"
<<
CGoGNendl
;
...
...
Apps/SandBox/testPlaneCutting.cpp
View file @
07b36674
...
...
@@ -204,7 +204,7 @@ void Viewer::cb_keyPress(int keycode)
{
std
::
cout
<<
"PlaneCut"
<<
std
::
endl
;
Geom
::
Vec3f
n
(
0.1
,
0.1
,
1.0
);
Geom
::
Vec3f
n
(
0.1
f
,
0.1
f
,
1.0
f
);
Geom
::
Vec3f
o
=
bb
.
center
();
Geom
::
Plane3D
<
PFP
::
REAL
>
plan
(
n
,
o
);
...
...
@@ -239,7 +239,7 @@ void Viewer::cb_keyPress(int keycode)
{
std
::
cout
<<
"PlaneCut"
<<
std
::
endl
;
Geom
::
Vec3f
n
(
0.1
,
0.1
,
1.0
);
Geom
::
Vec3f
n
(
0.1
f
,
0.1
f
,
1.0
f
);
Geom
::
Vec3f
o
=
bb
.
center
();
Geom
::
Plane3D
<
PFP
::
REAL
>
plan
(
n
,
o
);
...
...
Apps/SandBox/tilings.cpp
View file @
07b36674
...
...
@@ -119,7 +119,7 @@ void MyQT::squareTiling(int code)
{
std
::
cout
<<
"square grid twisted strip tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Grid
<
PFP
>
g
(
myMap
,
10
,
10
,
true
);
g
.
embedIntoTwistedStrip
(
position
,
0.2
,
0.7
,
5
);
g
.
embedIntoTwistedStrip
(
position
,
0.2
f
,
0.7
f
,
5
);
Geom
::
Matrix44f
trf
;
trf
.
identity
();
...
...
@@ -151,11 +151,11 @@ void MyQT::squareTiling(int code)
{
std
::
cout
<<
"square cylinder tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
embedIntoCylinder
(
position
,
0.5
,
0.7
,
1.0
);
c
.
embedIntoCylinder
(
position
,
0.5
f
,
0.7
f
,
1.0
f
);
Geom
::
Matrix44f
trf
;
trf
.
identity
();
Geom
::
translate
<
float
>
(
0.5
,
0.5
,
0.0
,
trf
);
Geom
::
translate
<
float
>
(
0.5
f
,
0.5
f
,
0.0
f
,
trf
);
c
.
transform
(
position
,
trf
);
...
...
@@ -169,7 +169,7 @@ void MyQT::squareTiling(int code)
Algo
::
Surface
::
Tilings
::
Square
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
triangleBottom
();
c
.
triangleTop
();
c
.
embedIntoCylinder
(
position
,
0.5
,
0.7
,
1.0
);
c
.
embedIntoCylinder
(
position
,
0.5
f
,
0.7
f
,
1.0
f
);
break
;
}
...
...
@@ -212,7 +212,7 @@ void MyQT::squareTiling(int code)
{
std
::
cout
<<
"square tore tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Tore
<
PFP
>
c
(
myMap
,
20
,
10
);
c
.
embedIntoTore
(
position
,
0.9
,
0.5
);
c
.
embedIntoTore
(
position
,
0.9
f
,
0.5
f
);
c
.
exportPositions
(
position
,
"tore.bs"
);
break
;
...
...
@@ -244,7 +244,7 @@ void MyQT::triangularTiling(int code)
{
std
::
cout
<<
"triangle grid twisted strip tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Triangular
::
Grid
<
PFP
>
g
(
myMap
,
10
,
10
,
true
);
g
.
embedIntoTwistedStrip
(
position
,
0.3
,
0.8
,
5
);
g
.
embedIntoTwistedStrip
(
position
,
0.3
f
,
0.8
f
,
5
);
break
;
}
...
...
@@ -252,7 +252,7 @@ void MyQT::triangularTiling(int code)
{
std
::
cout
<<
"triangle grid helocoid tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Triangular
::
Grid
<
PFP
>
g
(
myMap
,
20
,
20
,
true
);
g
.
embedIntoHelicoid
(
position
,
0.3
,
0.8
,
5.0
,
2.0
);
g
.
embedIntoHelicoid
(
position
,
0.3
f
,
0.8
f
,
5.0
f
,
2.0
f
);
break
;
}
...
...
@@ -260,7 +260,7 @@ void MyQT::triangularTiling(int code)
{
std
::
cout
<<
"triangle cylinder tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Triangular
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
embedIntoCylinder
(
position
,
0.5
,
0.7
,
5.0
);
c
.
embedIntoCylinder
(
position
,
0.5
f
,
0.7
f
,
5.0
f
);
break
;
}
...
...
@@ -270,7 +270,7 @@ void MyQT::triangularTiling(int code)
Algo
::
Surface
::
Tilings
::
Triangular
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
triangleBottom
();
c
.
triangleTop
();
c
.
embedIntoCylinder
(
position
,
0.5
,
0.7
,
5.0
);
c
.
embedIntoCylinder
(
position
,
0.5
f
,
0.7
f
,
5.0
f
);
break
;
}
...
...
@@ -280,7 +280,7 @@ void MyQT::triangularTiling(int code)
Algo
::
Surface
::
Tilings
::
Triangular
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
triangleTop
();
c
.
triangleBottom
();
c
.
embedIntoSphere
(
position
,
0.5
);
c
.
embedIntoSphere
(
position
,
0.5
f
);
break
;
}
...
...
@@ -290,7 +290,7 @@ void MyQT::triangularTiling(int code)
Algo
::
Surface
::
Tilings
::
Triangular
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
triangleTop
();
c
.
triangleBottom
();
c
.
embedIntoCone
(
position
,
0.5
,
5.0
);
c
.
embedIntoCone
(
position
,
0.5
f
,
5.0
f
);
break
;
}
...
...
@@ -298,7 +298,7 @@ void MyQT::triangularTiling(int code)
{
std
::
cout
<<
"triangle cube tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Triangular
::
Cube
<
PFP
>
c
(
myMap
,
4
,
4
,
4
);
c
.
embedIntoCube
(
position
,
5.0
,
5.0
,
5.0
);
c
.
embedIntoCube
(
position
,
5.0
f
,
5.0
f
,
5.0
f
);
break
;
}
...
...
@@ -306,7 +306,7 @@ void MyQT::triangularTiling(int code)
{
std
::
cout
<<
"triangle tore tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Triangular
::
Tore
<
PFP
>
c
(
myMap
,
20
,
10
);
c
.
embedIntoTore
(
position
,
5.0
,
2.0
);
c
.
embedIntoTore
(
position
,
5.0
f
,
2.0
f
);
break
;
}
...
...
Apps/Tests/Geom_inclusion.cpp
View file @
07b36674
...
...
@@ -82,7 +82,7 @@ int main()
std
::
cout
<<
"Check arePointsEquals : Start"
<<
std
::
endl
;
VEC3
p1
(
0
,
0
,
0
);
VEC3
p2
(
0.1
,
0.1
,
0.1
);
VEC3
p2
(
0.1
f
,
0.1
f
,
0.1
f
);
if
(
!
Geom
::
arePointsEquals
<
VEC3
>
(
p1
,
p1
)
||
!
Geom
::
arePointsEquals
<
VEC3
>
(
p2
,
p2
)
||
Geom
::
arePointsEquals
<
VEC3
>
(
p1
,
p2
)
||
Geom
::
arePointsEquals
<
VEC3
>
(
p2
,
p1
))
{
...
...
CGoGN/include/Algo/Decimation/edgeSelector.h
View file @
07b36674
...
...
@@ -375,7 +375,7 @@ public:
m_positionApproximator
(
posApprox
)
{
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
m
,
pos
)
;
radius
=
bb
.
diagSize
()
*
0.003
;
radius
=
bb
.
diagSize
()
*
0.003
f
;
normal
=
m
.
template
getAttribute
<
VEC3
,
VERTEX
,
MAP
>(
"normal"
)
;
if
(
!
normal
.
isValid
())
...
...
CGoGN/include/Algo/Decimation/edgeSelector.hpp
View file @
07b36674
...
...
@@ -84,8 +84,8 @@ bool EdgeSelector_Random<PFP>::init()
for
(
Dart
d
=
m
.
begin
();
d
!=
m
.
end
();
m
.
next
(
d
))
darts
.
push_back
(
d
)
;
srand
(
time
(
NULL
))
;
int
remains
=
darts
.
size
()
;
srand
(
(
unsigned
int
)(
time
(
NULL
))
)
;
int
remains
=
int
(
darts
.
size
()
)
;
for
(
unsigned
int
i
=
0
;
i
<
darts
.
size
()
-
1
;
++
i
)
// generate the random permutation
{
int
r
=
(
rand
()
%
remains
)
+
i
;
...
...
@@ -1979,11 +1979,10 @@ void EdgeSelector_GeomColOptGradient<PFP>::computeEdgeInfo(Dart d, EdgeInfo& ein
const
VEC3
&
newCol
=
m_colorApproximator
.
getApprox
(
d
)
;
// sum of QEM metric and color gradient metric
const
REAL
t
=
0.01
;
const
REAL
t
=
0.01
f
;
const
REAL
err
=
t
*
quad
(
newPos
)
+
(
1
-
t
)
*
(
computeEdgeGradientColorError
(
d
,
newPos
,
newCol
)
+
computeEdgeGradientColorError
(
m
.
phi2
(
d
),
newPos
,
newCol
)).
norm
()
/
sqrt
(
3
)
;
(
1
-
t
)
*
(
computeEdgeGradientColorError
(
d
,
newPos
,
newCol
)
+
computeEdgeGradientColorError
(
m
.
phi2
(
d
),
newPos
,
newCol
)).
norm
()
/
sqrt
(
3.0
)
;
einfo
.
it
=
edges
.
insert
(
std
::
make_pair
(
err
,
d
))
;
einfo
.
valid
=
true
;
...
...
CGoGN/include/Algo/Decimation/halfEdgeSelector.hpp
View file @
07b36674
...
...
@@ -1031,10 +1031,10 @@ void HalfEdgeSelector_ColorGradient<PFP>::computeHalfEdgeInfo(Dart d, HalfEdgeIn
//std::cout << quadGeom(newPos) / (alpha/M_PI + quadHF(newHF)) << std::endl ;
// sum of QEM metric and color gradient metric
const
REAL
t
=
0.01
;
const
REAL
t
=
0.01
f
;
const
REAL
&
err
=
t
*
quadGeom
(
newPos
)
+
// geom
(
1
-
t
)
*
computeGradientColorError
(
v0
,
v1
).
norm
()
/
sqrt
(
3
)
// color
(
1
-
t
)
*
computeGradientColorError
(
v0
,
v1
).
norm
()
/
sqrt
(
3
.0
)
// color
;
/*std::cout << quadGeom(newPos) << std::endl ;
...
...
CGoGN/include/Algo/Geometry/basic.h
View file @
07b36674
...
...
@@ -77,7 +77,7 @@ typename PFP::REAL meanEdgeLength(typename PFP::MAP& map, const VertexAttribute<
typename
PFP
::
REAL
length
(
0
);
unsigned
int
nbe
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
CGoGN
::
Parallel
::
NumberOfThreads
;
++
i
)
for
(
int
i
=
0
;
i
<
CGoGN
::
Parallel
::
NumberOfThreads
;
++
i
)
{
length
+=
lengths
[
i
];
nbe
+=
nbedges
[
i
];
...
...
CGoGN/include/Algo/Geometry/curvature.hpp
View file @
07b36674
...
...
@@ -547,7 +547,7 @@ void normalCycles_computeTensor(
{
typename
PFP
::
REAL
edgeangle
=
Algo
::
Surface
::
Geometry
::
computeAngleBetweenNormalsOnEdge
<
PFP
>
(
col
.
getMap
(),
e
,
position
);
typename
PFP
::
VEC3
ev
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
col
.
getMap
(),
e
,
position
);
tensor
+=
Geom
::
transposed_vectors_mult
(
ev
,
ev
)
*
edgeangle
*
(
1
/
ev
.
norm
());
tensor
+=
Geom
::
transposed_vectors_mult
(
ev
,
ev
)
*
edgeangle
*
(
1
.0
/
ev
.
norm
());
}
// collect edges on the border
...
...
@@ -556,7 +556,7 @@ void normalCycles_computeTensor(
typename
PFP
::
REAL
edgeangle
=
Algo
::
Surface
::
Geometry
::
computeAngleBetweenNormalsOnEdge
<
PFP
>
(
col
.
getMap
(),
d
,
position
);
typename
PFP
::
REAL
alpha
=
col
.
borderEdgeRatio
(
d
,
position
);
typename
PFP
::
VEC3
ev
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
col
.
getMap
(),
d
,
position
);
tensor
+=
Geom
::
transposed_vectors_mult
(
ev
,
ev
)
*
edgeangle
*
(
1
/
ev
.
norm
())
*
alpha
;
tensor
+=
Geom
::
transposed_vectors_mult
(
ev
,
ev
)
*
edgeangle
*
(
1
.0
/
ev
.
norm
())
*
alpha
;
}
tensor
/=
col
.
computeArea
(
position
);
...
...
@@ -575,7 +575,7 @@ void normalCycles_computeTensor(
for
(
Edge
e
:
col
.
getInsideEdges
())
{
typename
PFP
::
VEC3
ev
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
col
.
getMap
(),
e
,
position
);
tensor
+=
Geom
::
transposed_vectors_mult
(
ev
,
ev
)
*
edgeangle
[
e
]
*
(
1
/
ev
.
norm
());
tensor
+=
Geom
::
transposed_vectors_mult
(
ev
,
ev
)
*
edgeangle
[
e
]
*
(
1
.0
/
ev
.
norm
());
}
// collect edges on the border
...
...
@@ -583,7 +583,7 @@ void normalCycles_computeTensor(
{
typename
PFP
::
REAL
alpha
=
col
.
borderEdgeRatio
(
d
,
position
);
typename
PFP
::
VEC3
ev
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
col
.
getMap
(),
d
,
position
);
tensor
+=
Geom
::
transposed_vectors_mult
(
ev
,
ev
)
*
edgeangle
[
d
]
*
(
1
/
ev
.
norm
())
*
alpha
;
tensor
+=
Geom
::
transposed_vectors_mult
(
ev
,
ev
)
*
edgeangle
[
d
]
*
(
1
.0
/
ev
.
norm
())
*
alpha
;
}
tensor
/=
col
.
computeArea
(
position
);
...
...
@@ -603,7 +603,7 @@ void normalCycles_computeTensor(
for
(
Edge
e
:
col
.
getInsideEdges
())
{
typename
PFP
::
VEC3
ev
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
col
.
getMap
(),
e
,
position
);
tensor
+=
Geom
::
transposed_vectors_mult
(
ev
,
ev
)
*
edgeangle
[
e
]
*
(
1
/
ev
.
norm
());
tensor
+=
Geom
::
transposed_vectors_mult
(
ev
,
ev
)
*
edgeangle
[
e
]
*
(
1
.0
/
ev
.
norm
());
}
// collect edges on the border
...
...
@@ -611,7 +611,7 @@ void normalCycles_computeTensor(
{
typename
PFP
::
REAL
alpha
=
col
.
borderEdgeRatio
(
d
,
position
);
typename
PFP
::
VEC3
ev
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
col
.
getMap
(),
d
,
position
);
tensor
+=
Geom
::
transposed_vectors_mult
(
ev
,
ev
)
*
edgeangle
[
d
]
*
(
1
/
ev
.
norm
())
*
alpha
;
tensor
+=
Geom
::
transposed_vectors_mult
(
ev
,
ev
)
*
edgeangle
[
d
]
*
(
1
.0
/
ev
.
norm
())
*
alpha
;
}
tensor
/=
col
.
computeArea
(
position
,
edgearea
);
...
...
CGoGN/include/Geometry/bounding_box.hpp
View file @
07b36674
...
...
@@ -116,7 +116,7 @@ template <typename VEC>
typename
VEC
::
DATA_TYPE
BoundingBox
<
VEC
>::
diagSize
()
const
{
assert
(
m_initialized
||
!
"Bounding box not initialized"
);
return
(
m_pMax
-
m_pMin
).
norm
()
;
return
VEC
::
DATA_TYPE
(
(
m_pMax
-
m_pMin
).
norm
()
)
;
}
template
<
typename
VEC
>
...
...
CGoGN/include/Utils/qem.hpp
View file @
07b36674
...
...
@@ -285,7 +285,7 @@ REAL
QuadricNd
<
REAL
,
N
>::
evaluate
(
const
VECN
&
v
)
const
{
Geom
::
Vector
<
N
,
double
>
v_d
=
v
;
return
v_d
*
A
*
v_d
+
2.
*
(
b
*
v_d
)
+
c
;
return
v_d
*
(
A
*
v_d
)
+
2.
0
*
(
b
*
v_d
)
+
c
;
}
template
<
typename
REAL
,
unsigned
int
N
>
...
...
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