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
KennethVanhoey
CGoGN
Commits
6e7f22fc
Commit
6e7f22fc
authored
Oct 07, 2011
by
Thomas
Browse files
Merge branch 'master' of cgogn.u-strasbg.fr:~cgogn/CGoGN
parents
033d38b8
97d7a2de
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/Algo/Decimation/decimation.hpp
View file @
6e7f22fc
...
...
@@ -67,26 +67,26 @@ void decimate(
{
approximators
.
push_back
(
new
Approximator_QEMhalfEdge
<
PFP
>
(
map
,
position
))
;
/*
PFP::TVEC3 frame[3] ;
frame[0] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "frame_T") ; // Tangent
frame[1] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "frame_B") ; // Bitangent
frame[2] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "frame_N") ; // Normal
for (unsigned int i = 0 ; i < 3 ; ++i)
if (!frame[i].isValid()) {
CGoGNerr << "In function decimate : frame[" << i << "] is not valid" << CGoGNendl ;
}
AttributeHandler<typename PFP::VEC3> colorPTM[6] ;
colorPTM[0] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_a") ;
colorPTM[1] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_b") ;
colorPTM[2] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_c") ;
colorPTM[3] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_d") ;
colorPTM[4] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_e") ;
colorPTM[5] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_f") ;
for (unsigned int i = 0 ; i < 6 ; ++i)
if (!colorPTM[i].isValid()) {
CGoGNerr << "In function decimate : colorPTM[" << i << "] is not valid" << CGoGNendl ;
}
PFP::TVEC3 frame[3] ;
frame[0] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "frame_T") ; // Tangent
frame[1] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "frame_B") ; // Bitangent
frame[2] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "frame_N") ; // Normal
for (unsigned int i = 0 ; i < 3 ; ++i)
if (!frame[i].isValid()) {
CGoGNerr << "In function decimate : frame[" << i << "] is not valid" << CGoGNendl ;
}
AttributeHandler<typename PFP::VEC3> colorPTM[6] ;
colorPTM[0] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_a") ;
colorPTM[1] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_b") ;
colorPTM[2] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_c") ;
colorPTM[3] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_d") ;
colorPTM[4] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_e") ;
colorPTM[5] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_f") ;
for (unsigned int i = 0 ; i < 6 ; ++i)
if (!colorPTM[i].isValid()) {
CGoGNerr << "In function decimate : colorPTM[" << i << "] is not valid" << CGoGNendl ;
}
*/
AttributeHandler
<
Geom
::
Matrix
<
3
,
3
,
typename
PFP
::
REAL
>
>
frame
=
map
.
template
getAttribute
<
Geom
::
Matrix
<
3
,
3
,
typename
PFP
::
REAL
>
>
(
VERTEX
,
"frame"
)
;
AttributeHandler
<
Geom
::
Matrix
<
3
,
6
,
typename
PFP
::
REAL
>
>
RGBfunctions
=
map
.
template
getAttribute
<
Geom
::
Matrix
<
3
,
6
,
typename
PFP
::
REAL
>
>
(
VERTEX
,
"colorPTM"
)
;
...
...
@@ -108,31 +108,31 @@ void decimate(
switch
(
s
)
{
case
S_MapOrder
:
selector
=
new
EdgeSelector_MapOrder
<
PFP
>
(
map
,
position
,
approximators
)
;
selector
=
new
EdgeSelector_MapOrder
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
break
;
case
S_Random
:
selector
=
new
EdgeSelector_Random
<
PFP
>
(
map
,
position
,
approximators
)
;
selector
=
new
EdgeSelector_Random
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
break
;
case
S_EdgeLength
:
selector
=
new
EdgeSelector_Length
<
PFP
>
(
map
,
position
,
approximators
)
;
selector
=
new
EdgeSelector_Length
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
break
;
case
S_QEMml
:
selector
=
new
EdgeSelector_QEMml
<
PFP
>
(
map
,
position
,
approximators
)
;
selector
=
new
EdgeSelector_QEMml
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
break
;
case
S_QEM
:
selector
=
new
EdgeSelector_QEM
<
PFP
>
(
map
,
position
,
approximators
)
;
selector
=
new
EdgeSelector_QEM
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
break
;
case
S_Curvature
:
selector
=
new
EdgeSelector_Curvature
<
PFP
>
(
map
,
position
,
approximators
)
;
selector
=
new
EdgeSelector_Curvature
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
break
;
case
S_MinDetail
:
selector
=
new
EdgeSelector_Random
<
PFP
>
(
map
,
position
,
approximators
)
;
selector
=
new
EdgeSelector_Random
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
break
;
case
S_hLightfield
:
selector
=
new
HalfEdgeSelector_Lightfield
<
PFP
>
(
map
,
position
,
approximators
)
;
selector
=
new
HalfEdgeSelector_Lightfield
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
break
;
case
S_hQEMml
:
selector
=
new
HalfEdgeSelector_QEMml
<
PFP
>
(
map
,
position
,
approximators
)
;
selector
=
new
HalfEdgeSelector_QEMml
<
PFP
>
(
map
,
position
,
approximators
,
selected
)
;
break
;
}
...
...
include/Algo/Decimation/edgeSelector.h
View file @
6e7f22fc
...
...
@@ -54,7 +54,7 @@ private:
Dart
cur
;
public:
EdgeSelector_MapOrder
(
MAP
&
m
,
typename
PFP
::
TVEC3
&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
=
SelectorTrue
()
)
:
EdgeSelector_MapOrder
(
MAP
&
m
,
typename
PFP
::
TVEC3
&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
)
:
EdgeSelector
<
PFP
>
(
m
,
pos
,
approx
,
select
)
{}
~
EdgeSelector_MapOrder
()
...
...
@@ -81,7 +81,7 @@ private:
bool
allSkipped
;
public:
EdgeSelector_Random
(
MAP
&
m
,
typename
PFP
::
TVEC3
&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
=
SelectorTrue
()
)
:
EdgeSelector_Random
(
MAP
&
m
,
typename
PFP
::
TVEC3
&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
)
:
EdgeSelector
<
PFP
>
(
m
,
pos
,
approx
,
select
)
{}
~
EdgeSelector_Random
()
...
...
@@ -121,7 +121,7 @@ private:
void
computeEdgeInfo
(
Dart
d
,
EdgeInfo
&
einfo
)
;
public:
EdgeSelector_Length
(
MAP
&
m
,
typename
PFP
::
TVEC3
&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
=
SelectorTrue
()
)
:
EdgeSelector_Length
(
MAP
&
m
,
typename
PFP
::
TVEC3
&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
)
:
EdgeSelector
<
PFP
>
(
m
,
pos
,
approx
,
select
)
{
edgeInfo
=
m
.
template
addAttribute
<
EdgeInfo
>(
EDGE
,
"edgeInfo"
)
;
...
...
@@ -168,7 +168,7 @@ private:
void
computeEdgeInfo
(
Dart
d
,
EdgeInfo
&
einfo
)
;
public:
EdgeSelector_QEM
(
MAP
&
m
,
typename
PFP
::
TVEC3
&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
=
SelectorTrue
()
)
:
EdgeSelector_QEM
(
MAP
&
m
,
typename
PFP
::
TVEC3
&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
)
:
EdgeSelector
<
PFP
>
(
m
,
pos
,
approx
,
select
)
{
edgeInfo
=
m
.
template
addAttribute
<
EdgeInfo
>(
EDGE
,
"edgeInfo"
)
;
...
...
@@ -217,7 +217,7 @@ private:
void
recomputeQuadric
(
const
Dart
d
,
const
bool
recomputeNeighbors
=
false
)
;
public:
EdgeSelector_QEMml
(
MAP
&
m
,
typename
PFP
::
TVEC3
&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
=
SelectorTrue
()
)
:
EdgeSelector_QEMml
(
MAP
&
m
,
typename
PFP
::
TVEC3
&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
)
:
EdgeSelector
<
PFP
>
(
m
,
pos
,
approx
,
select
)
{
edgeInfo
=
m
.
template
addAttribute
<
EdgeInfo
>(
EDGE
,
"edgeInfo"
)
;
...
...
@@ -274,7 +274,7 @@ private:
void
computeEdgeInfo
(
Dart
d
,
EdgeInfo
&
einfo
)
;
public:
EdgeSelector_Curvature
(
MAP
&
m
,
typename
PFP
::
TVEC3
&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
=
SelectorTrue
()
)
:
EdgeSelector_Curvature
(
MAP
&
m
,
typename
PFP
::
TVEC3
&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
)
:
EdgeSelector
<
PFP
>
(
m
,
pos
,
approx
,
select
)
{
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
m
,
pos
)
;
...
...
@@ -330,7 +330,6 @@ public:
void
updateAfterCollapse
(
Dart
d2
,
Dart
dd2
)
;
}
;
template
<
typename
PFP
>
class
EdgeSelector_MinDetail
:
public
EdgeSelector
<
PFP
>
{
...
...
@@ -360,7 +359,7 @@ private:
void
computeEdgeInfo
(
Dart
d
,
EdgeInfo
&
einfo
)
;
public:
EdgeSelector_MinDetail
(
MAP
&
m
,
typename
PFP
::
TVEC3
&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
=
SelectorTrue
()
)
:
EdgeSelector_MinDetail
(
MAP
&
m
,
typename
PFP
::
TVEC3
&
pos
,
std
::
vector
<
ApproximatorGen
<
PFP
>*>&
approx
,
const
FunctorSelect
&
select
)
:
EdgeSelector
<
PFP
>
(
m
,
pos
,
approx
,
select
)
{
edgeInfo
=
m
.
template
addAttribute
<
EdgeInfo
>(
EDGE
,
"edgeInfo"
)
;
...
...
include/Container/fakeAttribute.h
View file @
6e7f22fc
...
...
@@ -43,8 +43,8 @@ public:
NoMathAttribute
(
int
i
)
:
T
()
{}
NoMathAttribute
(
const
T
&
att
)
:
T
(
att
)
{}
NoMathAttribute
<
T
>&
operator
=
(
const
T
&
fa
)
{
*
this
=
NoMathAttribute
<
T
>
(
fa
);
}
void
operator
+=
(
const
NoMathAttribute
<
T
>&
fa
)
{}
void
operator
-=
(
const
NoMathAttribute
<
T
>&
fa
)
{}
void
operator
*=
(
double
v
)
{}
...
...
@@ -54,6 +54,12 @@ public:
static
std
::
string
CGoGNnameOfType
()
{
return
nameOfType
(
T
());
}
};
template
<
typename
T
>
NoMathAttribute
<
T
>
operator
*
(
T
a
,
const
NoMathAttribute
<
T
>&
v
)
{
return
T
();
}
/**
* Ajoute tout ce qu'il faut a un type (std::string par exemple)
* qui n'a pas les operateurs += -= *= /=
...
...
@@ -68,8 +74,8 @@ public:
NoMathNameAttribute
(
int
i
)
:
T
()
{}
NoMathNameAttribute
(
const
T
&
att
)
:
T
(
att
)
{}
NoMathNameAttribute
<
T
>&
operator
=
(
const
T
&
fa
)
{
return
*
this
=
NoMathNameAttribute
<
T
>
(
fa
);
}
void
operator
+=
(
const
NoMathNameAttribute
<
T
>&
fa
)
{}
void
operator
-=
(
const
NoMathNameAttribute
<
T
>&
fa
)
{}
void
operator
*=
(
double
v
)
{}
...
...
@@ -79,11 +85,23 @@ public:
static
std
::
string
CGoGNnameOfType
()
{
return
""
;
}
};
/**
* Ajoute tout ce qu'il faut a un type
* qui n'a pas de nom
* pour qu'il soit utilisable (ca compile!)
*/
template
<
typename
T
>
NoMathAttribute
<
T
>
operator
*
(
T
a
,
const
NoMathAttribute
<
T
>&
v
)
class
NoNameAttribute
:
public
T
{
return
T
();
}
public:
NoNameAttribute
()
:
T
()
{}
NoNameAttribute
(
int
i
)
:
T
()
{}
NoNameAttribute
(
const
T
&
att
)
:
T
(
att
)
{}
NoNameAttribute
<
T
>&
operator
=
(
const
T
&
fa
)
{
return
*
this
=
NoNameAttribute
<
T
>
(
fa
);
}
static
std
::
string
CGoGNnameOfType
()
{
return
""
;
}
};
/**
* Ajoute tout ce qu'il faut a un type
...
...
@@ -98,7 +116,7 @@ public:
NoIOAttribute
(
int
i
)
:
T
()
{}
NoIOAttribute
(
const
T
&
att
)
:
T
(
att
)
{}
NoIOAttribute
<
T
>&
operator
=
(
const
T
&
fa
)
{
*
this
=
NoIOAttribute
<
T
>
(
fa
);
}
NoIOAttribute
<
T
>&
operator
=
(
const
T
&
fa
)
{
return
*
this
=
NoIOAttribute
<
T
>
(
fa
);
}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
NoIOAttribute
<
T
>&
fa
)
{
return
out
;
}
friend
const
std
::
istream
&
operator
>>
(
const
std
::
istream
&
in
,
NoIOAttribute
<
T
>&
fa
)
{
return
in
;
}
...
...
@@ -106,6 +124,27 @@ public:
static
std
::
string
CGoGNnameOfType
()
{
return
nameOfType
(
T
());
}
};
/**
* Ajoute tout ce qu'il faut a un type
* qui n'a pas de nom ni les operateurs << et >>
* pour qu'il soit utilisable (ca compile!)
*/
template
<
typename
T
>
class
NoNameIOAttribute
:
public
T
{
public:
NoNameIOAttribute
()
:
T
()
{}
NoNameIOAttribute
(
int
i
)
:
T
()
{}
NoNameIOAttribute
(
const
T
&
att
)
:
T
(
att
)
{}
NoNameIOAttribute
<
T
>&
operator
=
(
const
T
&
fa
)
{
return
*
this
=
NoNameIOAttribute
<
T
>
(
fa
);
}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
NoNameIOAttribute
<
T
>&
fa
)
{
return
out
;
}
friend
const
std
::
istream
&
operator
>>
(
const
std
::
istream
&
in
,
NoNameIOAttribute
<
T
>&
fa
)
{
return
in
;
}
static
std
::
string
CGoGNnameOfType
()
{
return
""
;
}
};
/**
* Ajoute tout ce qu'il faut a un type (std::string par exemple)
* qui n'a pas les operateurs += -= *= /= et << , >>
...
...
@@ -119,12 +158,11 @@ public:
NoMathIOAttribute
(
int
i
)
:
T
()
{}
NoMathIOAttribute
(
const
T
&
att
)
:
T
(
att
)
{}
NoMathIOAttribute
<
T
>&
operator
=
(
const
T
&
fa
)
{
return
*
this
=
NoMathIOAttribute
<
T
>
(
fa
);
}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
NoMathIOAttribute
<
T
>&
fa
)
{
return
out
;
}
friend
const
std
::
istream
&
operator
>>
(
const
std
::
istream
&
in
,
NoMathIOAttribute
<
T
>&
fa
)
{
return
in
;
}
NoMathIOAttribute
<
T
>&
operator
=
(
const
T
&
fa
)
{
return
*
this
=
NoMathIOAttribute
<
T
>
(
fa
);
}
void
operator
+=
(
const
NoMathIOAttribute
<
T
>&
fa
)
{}
void
operator
-=
(
const
NoMathIOAttribute
<
T
>&
fa
)
{}
void
operator
*=
(
double
v
)
{}
...
...
@@ -147,12 +185,11 @@ public:
NoMathIONameAttribute
(
int
i
)
:
T
()
{}
NoMathIONameAttribute
(
const
T
&
att
)
:
T
(
att
)
{}
NoMathIONameAttribute
<
T
>&
operator
=
(
const
T
&
fa
)
{
return
*
this
=
NoMathIONameAttribute
<
T
>
(
fa
);
}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
NoMathIONameAttribute
<
T
>&
fa
)
{
return
out
;
}
friend
const
std
::
istream
&
operator
>>
(
const
std
::
istream
&
in
,
NoMathIONameAttribute
<
T
>&
fa
)
{
return
in
;
}
NoMathIONameAttribute
<
T
>&
operator
=
(
const
T
&
fa
)
{
return
*
this
=
NoMathIONameAttribute
<
T
>
(
fa
);
}
void
operator
+=
(
const
NoMathIONameAttribute
<
T
>&
fa
)
{}
void
operator
-=
(
const
NoMathIONameAttribute
<
T
>&
fa
)
{}
void
operator
*=
(
double
v
)
{}
...
...
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