Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Etienne Schmitt
CGoGN
Commits
68dfe535
Commit
68dfe535
authored
Mar 21, 2011
by
Kenneth Vanhoey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some phi2 -> ph1 corrections
parent
969ec0fd
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
46 additions
and
31 deletions
+46
-31
include/Algo/Decimation/approximator.h
include/Algo/Decimation/approximator.h
+1
-1
include/Algo/Decimation/decimation.hpp
include/Algo/Decimation/decimation.hpp
+8
-5
include/Algo/Decimation/geometryApproximator.h
include/Algo/Decimation/geometryApproximator.h
+4
-4
include/Algo/Decimation/geometryApproximator.hpp
include/Algo/Decimation/geometryApproximator.hpp
+8
-2
include/Algo/Decimation/halfEdgeSelector.hpp
include/Algo/Decimation/halfEdgeSelector.hpp
+6
-5
include/Algo/Decimation/lightfieldApproximator.hpp
include/Algo/Decimation/lightfieldApproximator.hpp
+9
-9
include/Algo/Render/vbo_MapRender.hpp
include/Algo/Render/vbo_MapRender.hpp
+1
-1
include/Geometry/vector_gen.hpp
include/Geometry/vector_gen.hpp
+2
-0
include/Utils/qem.h
include/Utils/qem.h
+3
-0
include/Utils/quadricRGBfunctions.hpp
include/Utils/quadricRGBfunctions.hpp
+4
-4
No files found.
include/Algo/Decimation/approximator.h
View file @
68dfe535
...
...
@@ -39,7 +39,7 @@ namespace Decimation
enum
ApproximatorType
{
A_QEM
,
A_QEMhalf
,
A_QEMhalf
Edge
,
A_MidEdge
,
A_HalfCollapse
,
A_CornerCutting
,
...
...
include/Algo/Decimation/decimation.hpp
View file @
68dfe535
...
...
@@ -45,8 +45,8 @@ void decimate(
case
A_QEM
:
approximators
.
push_back
(
new
Approximator_QEM
<
PFP
>
(
map
,
position
))
;
break
;
case
A_QEMhalf
:
approximators
.
push_back
(
new
Approximator_QEMhalf
<
PFP
>
(
map
,
position
))
;
case
A_QEMhalf
Edge
:
approximators
.
push_back
(
new
Approximator_QEMhalf
Edge
<
PFP
>
(
map
,
position
))
;
break
;
case
A_MidEdge
:
approximators
.
push_back
(
new
Approximator_MidEdge
<
PFP
>
(
map
,
position
))
;
...
...
@@ -65,7 +65,7 @@ void decimate(
break
;
case
A_LightfieldFull
:
{
approximators
.
push_back
(
new
Approximator_QEMhalf
<
PFP
>
(
map
,
position
))
;
approximators
.
push_back
(
new
Approximator_QEMhalf
Edge
<
PFP
>
(
map
,
position
))
;
/*
PFP::TVEC3 frame[3] ;
frame[0] = map.template getAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "frame_T") ; // Tangent
...
...
@@ -148,8 +148,11 @@ void decimate(
while
(
!
finished
)
{
std
::
cout
<<
"Countdown : "
;
std
::
cout
<<
std
::
setprecision
(
8
)
<<
(
nbVertices
-
nbWantedVertices
)
<<
"
\r
"
<<
std
::
flush
;
if
(
!
selector
->
nextEdge
(
d
))
{
std
::
cout
<<
"out"
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
<<
"out"
<<
std
::
endl
;
break
;
}
...
...
@@ -175,7 +178,7 @@ void decimate(
if
(
nbVertices
<=
nbWantedVertices
)
{
finished
=
true
;
std
::
cout
<<
"done"
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
<<
"done"
<<
std
::
endl
;
}
}
...
...
include/Algo/Decimation/geometryApproximator.h
View file @
68dfe535
...
...
@@ -59,7 +59,7 @@ public:
}
;
template
<
typename
PFP
>
class
Approximator_QEMhalf
:
public
Approximator
<
PFP
,
typename
PFP
::
VEC3
>
class
Approximator_QEMhalf
Edge
:
public
Approximator
<
PFP
,
typename
PFP
::
VEC3
>
{
public:
typedef
typename
PFP
::
MAP
MAP
;
...
...
@@ -70,12 +70,12 @@ protected:
AttributeHandler
<
Quadric
<
REAL
>
>
m_quadric
;
public:
Approximator_QEMhalf
(
MAP
&
m
,
AttributeHandler
<
VEC3
>&
pos
,
Predictor
<
PFP
,
VEC3
>*
pred
=
NULL
)
:
Approximator_QEMhalf
Edge
(
MAP
&
m
,
AttributeHandler
<
VEC3
>&
pos
,
Predictor
<
PFP
,
VEC3
>*
pred
=
NULL
)
:
Approximator
<
PFP
,
VEC3
>
(
m
,
pos
,
EDGE_ORBIT
,
pred
)
{}
~
Approximator_QEMhalf
()
~
Approximator_QEMhalf
Edge
()
{}
ApproximatorType
getType
()
const
{
return
A_QEMhalf
;
}
ApproximatorType
getType
()
const
{
return
A_QEMhalf
Edge
;
}
bool
init
()
;
void
approximate
(
Dart
d
)
;
}
;
...
...
include/Algo/Decimation/geometryApproximator.hpp
View file @
68dfe535
...
...
@@ -110,7 +110,7 @@ void Approximator_QEM<PFP>::approximate(Dart d)
************************************************************************************/
template
<
typename
PFP
>
bool
Approximator_QEMhalf
<
PFP
>::
init
()
bool
Approximator_QEMhalf
Edge
<
PFP
>::
init
()
{
m_quadric
=
this
->
m_map
.
template
getAttribute
<
Quadric
<
REAL
>
>
(
VERTEX_ORBIT
,
"QEMquadric"
)
;
...
...
@@ -122,7 +122,7 @@ bool Approximator_QEMhalf<PFP>::init()
}
template
<
typename
PFP
>
void
Approximator_QEMhalf
<
PFP
>::
approximate
(
Dart
d
)
void
Approximator_QEMhalf
Edge
<
PFP
>::
approximate
(
Dart
d
)
{
MAP
&
m
=
this
->
m_map
;
...
...
@@ -166,6 +166,12 @@ void Approximator_QEMhalf<PFP>::approximate(Dart d)
this
->
m_approx
[
d
]
=
this
->
m_attrV
[
d
]
;
else
this
->
m_approx
[
d
]
=
res
;
if
(
isnan
((
res
[
0
])))
{
std
::
cout
<<
"res("
<<
opt
<<
") = "
<<
this
->
m_approx
[
d
]
<<
std
::
endl
;
std
::
cout
<<
q1
<<
std
::
endl
;
std
::
cout
<<
q2
<<
std
::
endl
;
}
}
/************************************************************************************
...
...
include/Algo/Decimation/halfEdgeSelector.hpp
View file @
68dfe535
...
...
@@ -159,11 +159,11 @@ void HalfEdgeSelector_QEMml<PFP>::recomputeQuadric(const Dart d, const bool reco
do
{
// Make step
dBack
=
this
->
m_map
.
phi
2
(
dFront
)
;
dBack
=
this
->
m_map
.
phi
1
(
dFront
)
;
dFront
=
this
->
m_map
.
alpha1
(
dFront
)
;
if
(
dBack
!=
dFront
)
{
// if dFront is no border
quadric
[
d
]
+=
Quadric
<
REAL
>
(
this
->
m_position
[
d
],
this
->
m_position
[
this
->
m_map
.
phi
2
(
dFront
)],
this
->
m_position
[
dBack
])
;
quadric
[
d
]
+=
Quadric
<
REAL
>
(
this
->
m_position
[
d
],
this
->
m_position
[
this
->
m_map
.
phi
1
(
dFront
)],
this
->
m_position
[
dBack
])
;
}
if
(
recomputeNeighbors
)
recomputeQuadric
(
dBack
,
false
)
;
...
...
@@ -404,11 +404,13 @@ void HalfEdgeSelector_Lightfield<PFP>::recomputeQuadric(const Dart d, const bool
do
{
// Make step
dBack
=
this
->
m_map
.
phi
2
(
dFront
)
;
dBack
=
this
->
m_map
.
phi
1
(
dFront
)
;
dFront
=
this
->
m_map
.
alpha1
(
dFront
)
;
if
(
dBack
!=
dFront
)
{
// if dFront is no border
quadric
[
d
]
+=
Quadric
<
REAL
>
(
this
->
m_position
[
d
],
this
->
m_position
[
this
->
m_map
.
phi2
(
dFront
)],
this
->
m_position
[
dBack
])
;
quadric
[
d
]
+=
Quadric
<
REAL
>
(
this
->
m_position
[
d
],
this
->
m_position
[
this
->
m_map
.
phi1
(
dFront
)],
this
->
m_position
[
dBack
])
;
if
(
isnan
(
this
->
m_position
[
d
][
0
]))
std
::
cout
<<
"NaaaaN"
<<
std
::
endl
;
}
if
(
recomputeNeighbors
)
recomputeQuadric
(
dBack
,
false
)
;
...
...
@@ -416,7 +418,6 @@ void HalfEdgeSelector_Lightfield<PFP>::recomputeQuadric(const Dart d, const bool
}
while
(
dFront
!=
dInit
)
;
}
template
<
typename
PFP
>
void
HalfEdgeSelector_Lightfield
<
PFP
>::
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
{
...
...
include/Algo/Decimation/lightfieldApproximator.hpp
View file @
68dfe535
...
...
@@ -264,7 +264,7 @@ void Approximator_RGBfunctions<PFP>::approximate(Dart d)
if
(
!
m_quadricRGBfunctions
[
d
].
findOptimizedRGBfunctions
(
this
->
m_approx
[
d
]))
{
this
->
m_approx
[
d
]
=
this
->
m_attrV
[
d
];
// if fail take first one
}
// if (gamma2 < -
1
) {
// if (gamma2 < -
3
) {
// std::cout << "Approx of : " <<std::endl ;
// std::cout << "Frame1 : " << m_frame[d] << std::endl ;
// std::cout << "Function1 : "<< this->m_attrV[d] << std::endl ;
...
...
include/Algo/Render/vbo_MapRender.hpp
View file @
68dfe535
...
...
@@ -308,7 +308,7 @@ void MapRender_VBO::initLines(typename PFP::MAP& map, const FunctorSelect& good,
if
(
!
m
.
isMarked
(
d
)
&&
good
(
d
))
{
tableIndices
.
push_back
(
map
.
getEmbedding
(
d
,
VERTEX_ORBIT
));
tableIndices
.
push_back
(
map
.
getEmbedding
(
map
.
phi
2
(
d
),
VERTEX_ORBIT
));
tableIndices
.
push_back
(
map
.
getEmbedding
(
map
.
phi
1
(
d
),
VERTEX_ORBIT
));
m
.
markOrbit
(
EDGE_ORBIT
,
d
);
}
}
...
...
include/Geometry/vector_gen.hpp
View file @
68dfe535
...
...
@@ -242,6 +242,8 @@ template <unsigned int DIM, typename T>
inline
double
Vector
<
DIM
,
T
>::
normalize
()
{
double
n
=
norm
()
;
if
(
n
==
T
(
0.0
))
n
=
T
(
0.0001
)
;
for
(
unsigned
int
i
=
0
;
i
<
DIM
;
++
i
)
m_data
[
i
]
/=
T
(
n
)
;
return
n
;
...
...
include/Utils/qem.h
View file @
68dfe535
...
...
@@ -153,6 +153,9 @@ private:
bool
optimize
(
VEC4
&
v
)
const
{
if
(
isnan
(
A
(
0
,
0
)))
return
false
;
MATRIX44
A2
(
A
)
;
for
(
int
i
=
0
;
i
<
3
;
++
i
)
A2
(
3
,
i
)
=
0.0
f
;
...
...
include/Utils/quadricRGBfunctions.hpp
View file @
68dfe535
...
...
@@ -68,18 +68,19 @@ QuadricRGBfunctions<REAL>::QuadricRGBfunctions(const QuadricRGBfunctions& q) {
template
<
typename
REAL
>
QuadricRGBfunctions
<
REAL
>::
QuadricRGBfunctions
(
const
RGBFUNCTIONS
&
cf
,
const
REAL
gamma
,
const
REAL
alpha
)
{
MATRIX66
R1
,
R2_b
,
R2_c
;
MATRIX66
R1
,
R2_b
,
R2_c
;
buildRotateMatrix
(
R1
,
gamma
);
// Rotation 1
R1
.
transpose
()
;
buildIntegralMatrix_A
(
A
,
alpha
);
// Parameterized integral matrix A
buildIntegralMatrix_b
(
R2_b
,
alpha
);
// Parameterized integral matrix b
buildIntegralMatrix_c
(
R2_c
,
alpha
);
// Parameterized integral matrix c
// Quadric (A,b,c) => L*A*Lt - 2*b*Lt + c = ERROR
for
(
unsigned
col
=
RED
;
col
<
BLUE
+
1
;
++
col
)
{
Geom
::
Vector
<
6
,
REAL
>
function
;
// get function coefficients
for
(
unsigned
col
=
RED
;
col
<
BLUE
+
1
;
++
col
)
{
Geom
::
Vector
<
6
,
REAL
>
function
;
// get function coefficients
if
(
!
cf
.
getSubVectorH
(
col
,
0
,
function
))
assert
(
!
"QuadricRGBfunctions::constructor"
)
;
...
...
@@ -373,7 +374,6 @@ void QuadricRGBfunctions<REAL>::buildRotateMatrix(MATRIX66 &N, const REAL gamma)
N
(
5
,
3
)
=
REAL
(
0
);
N
(
5
,
4
)
=
REAL
(
0
);
N
(
5
,
5
)
=
REAL
(
1
);
}
template
<
typename
REAL
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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