Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
e00b0f46
Commit
e00b0f46
authored
Jul 11, 2011
by
Kenneth Vanhoey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qqs modifs :-)
parent
dd61384e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
130 additions
and
49 deletions
+130
-49
include/Algo/Export/export.h
include/Algo/Export/export.h
+2
-4
include/Algo/Export/export.hpp
include/Algo/Export/export.hpp
+128
-45
No files found.
include/Algo/Export/export.h
View file @
e00b0f46
...
@@ -74,15 +74,13 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position,
...
@@ -74,15 +74,13 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position,
/**
/**
* export the map into a PLYPTM file
* export the map into a PLYPTM file
* @param
the_
map map to be exported
* @param map map to be exported
* @param filename filename of ply file
* @param filename filename of ply file
* @param position the position container
* @param position the position container
* @param frame[3] table of 3 vectors representing the local frame
* @param colorPTM[6] function coefficients (6) for each color channel (3)
* @return true
* @return true
*/
*/
template
<
typename
PFP
>
template
<
typename
PFP
>
bool
exportP
LYPTM
(
typename
PFP
::
MAP
&
map
,
const
char
*
filename
,
const
typename
PFP
::
TVEC3
&
position
,
const
typename
PFP
::
TVEC3
frame
[
3
],
const
typename
PFP
::
TVEC3
colorPTM
[
6
],
const
typename
PFP
::
TREAL
errL2
=
AttributeHandler
<
typename
PFP
::
REAL
>
(),
const
typename
PFP
::
TREAL
errLmax
=
AttributeHandler
<
typename
PFP
::
REAL
>
(),
const
typename
PFP
::
TREAL
stdDev
=
AttributeHandler
<
typename
PFP
::
REAL
>
()
,
const
FunctorSelect
&
good
=
SelectorTrue
())
;
bool
exportP
lyPTMgeneric
(
typename
PFP
::
MAP
&
map
,
const
char
*
filename
,
const
typename
PFP
::
TVEC3
&
position
,
const
FunctorSelect
&
good
=
SelectorTrue
())
;
/**
/**
...
...
include/Algo/Export/export.hpp
View file @
e00b0f46
...
@@ -248,10 +248,13 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position,
...
@@ -248,10 +248,13 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position,
}
}
template
<
typename
PFP
>
template
<
typename
PFP
>
bool
exportP
LYPTM
(
typename
PFP
::
MAP
&
map
,
const
char
*
filename
,
const
typename
PFP
::
TVEC3
&
position
,
const
typename
PFP
::
TVEC3
frame
[
3
],
const
typename
PFP
::
TVEC3
colorPTM
[
15
],
const
typename
PFP
::
TREAL
errL2
,
const
typename
PFP
::
TREAL
errLmax
,
const
typename
PFP
::
TREAL
stdDev
,
const
FunctorSelect
&
good
)
bool
exportP
lyPTMgeneric
(
typename
PFP
::
MAP
&
map
,
const
char
*
filename
,
const
typename
PFP
::
TVEC3
&
position
,
const
FunctorSelect
&
good
)
{
{
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
TVEC3
TVEC3
;
typedef
typename
PFP
::
REAL
REAL
;
typedef
typename
PFP
::
TREAL
TREAL
;
std
::
ofstream
out
(
filename
,
std
::
ios
::
out
)
;
std
::
ofstream
out
(
filename
,
std
::
ios
::
out
)
;
if
(
!
out
.
good
())
if
(
!
out
.
good
())
...
@@ -303,6 +306,21 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
...
@@ -303,6 +306,21 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
}
}
}
}
TVEC3
frame
[
3
]
;
TVEC3
colorPTM
[
15
]
;
frame
[
0
]
=
map
.
template
getAttribute
<
VEC3
>(
VERTEX
,
"frame_T"
)
;
frame
[
1
]
=
map
.
template
getAttribute
<
VEC3
>(
VERTEX
,
"frame_B"
)
;
frame
[
2
]
=
map
.
template
getAttribute
<
VEC3
>(
VERTEX
,
"frame_N"
)
;
for
(
unsigned
i
=
0
;
i
<
15
;
++
i
)
{
std
::
stringstream
name
;
name
<<
"colorPTM_a"
<<
i
;
colorPTM
[
i
]
=
map
.
template
getAttribute
<
VEC3
>(
VERTEX
,
name
.
str
())
;
}
const
unsigned
int
degree
=
colorPTM
[
14
].
isValid
()
?
4
:
(
colorPTM
[
9
].
isValid
()
?
3
:
2
)
;
out
<<
"ply"
<<
std
::
endl
;
out
<<
"ply"
<<
std
::
endl
;
out
<<
"format ascii 1.0"
<<
std
::
endl
;
out
<<
"format ascii 1.0"
<<
std
::
endl
;
out
<<
"comment ply PTM"
<<
std
::
endl
;
out
<<
"comment ply PTM"
<<
std
::
endl
;
...
@@ -325,45 +343,61 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
...
@@ -325,45 +343,61 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
out
<<
"property float L1_a3"
<<
std
::
endl
;
out
<<
"property float L1_a3"
<<
std
::
endl
;
out
<<
"property float L1_a4"
<<
std
::
endl
;
out
<<
"property float L1_a4"
<<
std
::
endl
;
out
<<
"property float L1_a5"
<<
std
::
endl
;
out
<<
"property float L1_a5"
<<
std
::
endl
;
if
(
degree
>
2
)
{
out
<<
"property float L1_a6"
<<
std
::
endl
;
out
<<
"property float L1_a6"
<<
std
::
endl
;
out
<<
"property float L1_a7"
<<
std
::
endl
;
out
<<
"property float L1_a7"
<<
std
::
endl
;
out
<<
"property float L1_a8"
<<
std
::
endl
;
out
<<
"property float L1_a8"
<<
std
::
endl
;
out
<<
"property float L1_a9"
<<
std
::
endl
;
out
<<
"property float L1_a9"
<<
std
::
endl
;
if
(
degree
>
3
)
{
out
<<
"property float L1_a10"
<<
std
::
endl
;
out
<<
"property float L1_a10"
<<
std
::
endl
;
out
<<
"property float L1_a11"
<<
std
::
endl
;
out
<<
"property float L1_a11"
<<
std
::
endl
;
out
<<
"property float L1_a12"
<<
std
::
endl
;
out
<<
"property float L1_a12"
<<
std
::
endl
;
out
<<
"property float L1_a13"
<<
std
::
endl
;
out
<<
"property float L1_a13"
<<
std
::
endl
;
out
<<
"property float L1_a14"
<<
std
::
endl
;
out
<<
"property float L1_a14"
<<
std
::
endl
;
}
}
out
<<
"property float L2_a0"
<<
std
::
endl
;
out
<<
"property float L2_a0"
<<
std
::
endl
;
out
<<
"property float L2_a1"
<<
std
::
endl
;
out
<<
"property float L2_a1"
<<
std
::
endl
;
out
<<
"property float L2_a2"
<<
std
::
endl
;
out
<<
"property float L2_a2"
<<
std
::
endl
;
out
<<
"property float L2_a3"
<<
std
::
endl
;
out
<<
"property float L2_a3"
<<
std
::
endl
;
out
<<
"property float L2_a4"
<<
std
::
endl
;
out
<<
"property float L2_a4"
<<
std
::
endl
;
out
<<
"property float L2_a5"
<<
std
::
endl
;
out
<<
"property float L2_a5"
<<
std
::
endl
;
if
(
degree
>
2
)
{
out
<<
"property float L2_a6"
<<
std
::
endl
;
out
<<
"property float L2_a6"
<<
std
::
endl
;
out
<<
"property float L2_a7"
<<
std
::
endl
;
out
<<
"property float L2_a7"
<<
std
::
endl
;
out
<<
"property float L2_a8"
<<
std
::
endl
;
out
<<
"property float L2_a8"
<<
std
::
endl
;
out
<<
"property float L2_a9"
<<
std
::
endl
;
out
<<
"property float L2_a9"
<<
std
::
endl
;
if
(
degree
>
3
)
{
out
<<
"property float L2_a10"
<<
std
::
endl
;
out
<<
"property float L2_a10"
<<
std
::
endl
;
out
<<
"property float L2_a11"
<<
std
::
endl
;
out
<<
"property float L2_a11"
<<
std
::
endl
;
out
<<
"property float L2_a12"
<<
std
::
endl
;
out
<<
"property float L2_a12"
<<
std
::
endl
;
out
<<
"property float L2_a13"
<<
std
::
endl
;
out
<<
"property float L2_a13"
<<
std
::
endl
;
out
<<
"property float L2_a14"
<<
std
::
endl
;
out
<<
"property float L2_a14"
<<
std
::
endl
;
}
}
out
<<
"property float L3_a0"
<<
std
::
endl
;
out
<<
"property float L3_a0"
<<
std
::
endl
;
out
<<
"property float L3_a1"
<<
std
::
endl
;
out
<<
"property float L3_a1"
<<
std
::
endl
;
out
<<
"property float L3_a2"
<<
std
::
endl
;
out
<<
"property float L3_a2"
<<
std
::
endl
;
out
<<
"property float L3_a3"
<<
std
::
endl
;
out
<<
"property float L3_a3"
<<
std
::
endl
;
out
<<
"property float L3_a4"
<<
std
::
endl
;
out
<<
"property float L3_a4"
<<
std
::
endl
;
out
<<
"property float L3_a5"
<<
std
::
endl
;
out
<<
"property float L3_a5"
<<
std
::
endl
;
if
(
degree
>
2
)
{
out
<<
"property float L3_a6"
<<
std
::
endl
;
out
<<
"property float L3_a6"
<<
std
::
endl
;
out
<<
"property float L3_a7"
<<
std
::
endl
;
out
<<
"property float L3_a7"
<<
std
::
endl
;
out
<<
"property float L3_a8"
<<
std
::
endl
;
out
<<
"property float L3_a8"
<<
std
::
endl
;
out
<<
"property float L3_a9"
<<
std
::
endl
;
out
<<
"property float L3_a9"
<<
std
::
endl
;
if
(
degree
>
3
)
{
out
<<
"property float L3_a10"
<<
std
::
endl
;
out
<<
"property float L3_a10"
<<
std
::
endl
;
out
<<
"property float L3_a11"
<<
std
::
endl
;
out
<<
"property float L3_a11"
<<
std
::
endl
;
out
<<
"property float L3_a12"
<<
std
::
endl
;
out
<<
"property float L3_a12"
<<
std
::
endl
;
out
<<
"property float L3_a13"
<<
std
::
endl
;
out
<<
"property float L3_a13"
<<
std
::
endl
;
out
<<
"property float L3_a14"
<<
std
::
endl
;
out
<<
"property float L3_a14"
<<
std
::
endl
;
}
}
TREAL
errL2
=
map
.
template
getAttribute
<
REAL
>(
VERTEX
,
"errL2"
)
;
TREAL
errLmax
=
map
.
template
getAttribute
<
REAL
>(
VERTEX
,
"errLmax"
)
;
TREAL
stdDev
=
map
.
template
getAttribute
<
REAL
>(
VERTEX
,
"StdDev"
)
;
if
(
errL2
.
isValid
())
if
(
errL2
.
isValid
())
out
<<
"property float errL2"
<<
std
::
endl
;
out
<<
"property float errL2"
<<
std
::
endl
;
if
(
errLmax
.
isValid
())
if
(
errLmax
.
isValid
())
...
@@ -375,6 +409,49 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
...
@@ -375,6 +409,49 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
out
<<
"property list uchar int vertex_indices"
<<
std
::
endl
;
out
<<
"property list uchar int vertex_indices"
<<
std
::
endl
;
out
<<
"end_header"
<<
std
::
endl
;
out
<<
"end_header"
<<
std
::
endl
;
switch
(
degree
)
{
case
(
2
)
:
for
(
unsigned
int
i
=
0
;
i
<
vertices
.
size
();
++
i
)
{
unsigned
int
vi
=
vertices
[
i
];
out
<<
position
[
vi
][
0
]
<<
" "
<<
position
[
vi
][
1
]
<<
" "
<<
position
[
vi
][
2
]
<<
" "
;
out
<<
frame
[
0
][
vi
][
0
]
<<
" "
<<
frame
[
0
][
vi
][
1
]
<<
" "
<<
frame
[
0
][
vi
][
2
]
<<
" "
;
out
<<
frame
[
1
][
vi
][
0
]
<<
" "
<<
frame
[
1
][
vi
][
1
]
<<
" "
<<
frame
[
1
][
vi
][
2
]
<<
" "
;
out
<<
frame
[
2
][
vi
][
0
]
<<
" "
<<
frame
[
2
][
vi
][
1
]
<<
" "
<<
frame
[
2
][
vi
][
2
]
<<
" "
;
out
<<
colorPTM
[
0
][
vi
][
0
]
<<
" "
<<
colorPTM
[
1
][
vi
][
0
]
<<
" "
<<
colorPTM
[
2
][
vi
][
0
]
<<
" "
<<
colorPTM
[
3
][
vi
][
0
]
<<
" "
<<
colorPTM
[
4
][
vi
][
0
]
<<
" "
<<
colorPTM
[
5
][
vi
][
0
]
<<
" "
;
out
<<
colorPTM
[
0
][
vi
][
1
]
<<
" "
<<
colorPTM
[
1
][
vi
][
1
]
<<
" "
<<
colorPTM
[
2
][
vi
][
1
]
<<
" "
<<
colorPTM
[
3
][
vi
][
1
]
<<
" "
<<
colorPTM
[
4
][
vi
][
1
]
<<
" "
<<
colorPTM
[
5
][
vi
][
1
]
<<
" "
;
out
<<
colorPTM
[
0
][
vi
][
2
]
<<
" "
<<
colorPTM
[
1
][
vi
][
2
]
<<
" "
<<
colorPTM
[
2
][
vi
][
2
]
<<
" "
<<
colorPTM
[
3
][
vi
][
2
]
<<
" "
<<
colorPTM
[
4
][
vi
][
2
]
<<
" "
<<
colorPTM
[
5
][
vi
][
2
]
<<
" "
;
if
(
errL2
.
isValid
())
out
<<
errL2
[
vi
]
<<
" "
;
if
(
errLmax
.
isValid
())
out
<<
errLmax
[
vi
]
<<
" "
;
if
(
stdDev
.
isValid
())
out
<<
stdDev
[
vi
]
<<
" "
;
out
<<
std
::
endl
;
}
break
;
case
(
3
)
:
for
(
unsigned
int
i
=
0
;
i
<
vertices
.
size
();
++
i
)
{
unsigned
int
vi
=
vertices
[
i
];
out
<<
position
[
vi
][
0
]
<<
" "
<<
position
[
vi
][
1
]
<<
" "
<<
position
[
vi
][
2
]
<<
" "
;
out
<<
frame
[
0
][
vi
][
0
]
<<
" "
<<
frame
[
0
][
vi
][
1
]
<<
" "
<<
frame
[
0
][
vi
][
2
]
<<
" "
;
out
<<
frame
[
1
][
vi
][
0
]
<<
" "
<<
frame
[
1
][
vi
][
1
]
<<
" "
<<
frame
[
1
][
vi
][
2
]
<<
" "
;
out
<<
frame
[
2
][
vi
][
0
]
<<
" "
<<
frame
[
2
][
vi
][
1
]
<<
" "
<<
frame
[
2
][
vi
][
2
]
<<
" "
;
out
<<
colorPTM
[
0
][
vi
][
0
]
<<
" "
<<
colorPTM
[
1
][
vi
][
0
]
<<
" "
<<
colorPTM
[
2
][
vi
][
0
]
<<
" "
<<
colorPTM
[
3
][
vi
][
0
]
<<
" "
<<
colorPTM
[
4
][
vi
][
0
]
<<
" "
<<
colorPTM
[
5
][
vi
][
0
]
<<
" "
<<
colorPTM
[
6
][
vi
][
0
]
<<
" "
<<
colorPTM
[
7
][
vi
][
0
]
<<
" "
<<
colorPTM
[
8
][
vi
][
0
]
<<
" "
<<
colorPTM
[
9
][
vi
][
0
]
<<
" "
;
out
<<
colorPTM
[
0
][
vi
][
1
]
<<
" "
<<
colorPTM
[
1
][
vi
][
1
]
<<
" "
<<
colorPTM
[
2
][
vi
][
1
]
<<
" "
<<
colorPTM
[
3
][
vi
][
1
]
<<
" "
<<
colorPTM
[
4
][
vi
][
1
]
<<
" "
<<
colorPTM
[
5
][
vi
][
1
]
<<
" "
<<
colorPTM
[
6
][
vi
][
1
]
<<
" "
<<
colorPTM
[
7
][
vi
][
1
]
<<
" "
<<
colorPTM
[
8
][
vi
][
1
]
<<
" "
<<
colorPTM
[
9
][
vi
][
1
]
<<
" "
;
out
<<
colorPTM
[
0
][
vi
][
2
]
<<
" "
<<
colorPTM
[
1
][
vi
][
2
]
<<
" "
<<
colorPTM
[
2
][
vi
][
2
]
<<
" "
<<
colorPTM
[
3
][
vi
][
2
]
<<
" "
<<
colorPTM
[
4
][
vi
][
2
]
<<
" "
<<
colorPTM
[
5
][
vi
][
2
]
<<
" "
<<
colorPTM
[
6
][
vi
][
2
]
<<
" "
<<
colorPTM
[
7
][
vi
][
2
]
<<
" "
<<
colorPTM
[
8
][
vi
][
2
]
<<
" "
<<
colorPTM
[
9
][
vi
][
2
]
<<
" "
;
if
(
errL2
.
isValid
())
out
<<
errL2
[
vi
]
<<
" "
;
if
(
errLmax
.
isValid
())
out
<<
errLmax
[
vi
]
<<
" "
;
if
(
stdDev
.
isValid
())
out
<<
stdDev
[
vi
]
<<
" "
;
out
<<
std
::
endl
;
}
break
;
case
(
4
)
:
for
(
unsigned
int
i
=
0
;
i
<
vertices
.
size
();
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
vertices
.
size
();
++
i
)
{
{
unsigned
int
vi
=
vertices
[
i
];
unsigned
int
vi
=
vertices
[
i
];
...
@@ -394,6 +471,12 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
...
@@ -394,6 +471,12 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
out
<<
std
::
endl
;
out
<<
std
::
endl
;
}
}
break
;
default
:
assert
(
false
||
!
"exportPlyPTM : degree not in {2,3,4} unhandled"
)
;
break
;
}
std
::
vector
<
unsigned
int
>::
iterator
it
=
faces
.
begin
();
std
::
vector
<
unsigned
int
>::
iterator
it
=
faces
.
begin
();
while
(
it
!=
faces
.
end
())
while
(
it
!=
faces
.
end
())
{
{
...
...
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