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
66f26c13
Commit
66f26c13
authored
Apr 18, 2012
by
Kenneth Vanhoey
Browse files
exportPly is now generic for PFP::REAL
parent
b5e50597
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/Algo/Export/export.hpp
View file @
66f26c13
...
...
@@ -117,13 +117,13 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
// Position property
if
(
position
.
isValid
())
{
out
<<
"property
float32
x"
<<
std
::
endl
;
out
<<
"property
float32
y"
<<
std
::
endl
;
out
<<
"property
float32
z"
<<
std
::
endl
;
out
<<
"property
"
<<
nameOfTypePly
(
position
[
0
][
0
])
<<
8
*
sizeof
(
position
[
0
][
0
])
<<
"
x"
<<
std
::
endl
;
out
<<
"property
"
<<
nameOfTypePly
(
position
[
0
][
1
])
<<
8
*
sizeof
(
position
[
0
][
1
])
<<
"
y"
<<
std
::
endl
;
out
<<
"property
"
<<
nameOfTypePly
(
position
[
0
][
2
])
<<
8
*
sizeof
(
position
[
0
][
2
])
<<
"
z"
<<
std
::
endl
;
}
// Face element
out
<<
"element face "
<<
facesSize
.
size
()
<<
std
::
endl
;
out
<<
"property list uint8 uint
32
vertex_indices"
<<
std
::
endl
;
out
<<
"property list uint8 uint
"
<<
8
*
sizeof
(
facesIdx
[
0
][
0
])
<<
"
vertex_indices"
<<
std
::
endl
;
out
<<
"end_header"
<<
std
::
endl
;
if
(
!
binary
)
// ascii
...
...
@@ -147,7 +147,7 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
for
(
unsigned
int
i
=
0
;
i
<
vertices
.
size
();
++
i
)
{
Geom
::
Vec3f
v
=
position
[
vertices
[
i
]]
;
out
.
write
((
char
*
)(
&
(
v
[
0
])),
3
*
sizeof
(
float
))
;
out
.
write
((
char
*
)(
&
(
v
[
0
])),
sizeof
(
v
))
;
}
// binary faces
...
...
@@ -155,7 +155,7 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
{
unsigned
char
nbe
=
facesSize
[
i
]
;
out
.
write
((
char
*
)(
&
nbe
),
sizeof
(
unsigned
char
))
;
out
.
write
((
char
*
)(
&
(
facesIdx
[
i
][
0
])),
facesSize
[
i
]
*
sizeof
(
f
loat
))
;
out
.
write
((
char
*
)(
&
(
facesIdx
[
i
][
0
])),
facesSize
[
i
]
*
sizeof
(
f
acesIdx
[
i
][
0
]
))
;
}
}
...
...
include/Utils/nameTypes.h
View file @
66f26c13
...
...
@@ -60,6 +60,35 @@ template <> inline std::string nameOfType(const double& v) { return "double"; }
template
<
>
inline
std
::
string
nameOfType
(
const
std
::
string
&
v
)
{
return
"std::string"
;
}
// Ply compatibility
template
<
typename
T
>
std
::
string
nameOfTypePly
(
const
T
&
v
)
{
return
v
.
CGoGNnameOfType
();
}
template
<
>
inline
std
::
string
nameOfTypePly
(
const
char
&
v
)
{
return
"int8"
;
}
template
<
>
inline
std
::
string
nameOfTypePly
(
const
short
int
&
v
)
{
return
"int16"
;
}
template
<
>
inline
std
::
string
nameOfTypePly
(
const
int
&
v
)
{
return
"int32"
;
}
template
<
>
inline
std
::
string
nameOfTypePly
(
const
long
int
&
v
)
{
return
"invalid"
;
}
template
<
>
inline
std
::
string
nameOfTypePly
(
const
unsigned
char
&
v
)
{
return
"uint8"
;
}
template
<
>
inline
std
::
string
nameOfType
(
const
unsigned
short
int
&
v
)
{
return
"uint16"
;
}
template
<
>
inline
std
::
string
nameOfTypePly
(
const
unsigned
int
&
v
)
{
return
"uint32"
;
}
template
<
>
inline
std
::
string
nameOfTypePly
(
const
unsigned
long
int
&
v
)
{
return
"invalid"
;
}
template
<
>
inline
std
::
string
nameOfTypePly
(
const
float
&
v
)
{
return
"float32"
;
}
template
<
>
inline
std
::
string
nameOfTypePly
(
const
double
&
v
)
{
return
"float64"
;
}
template
<
>
inline
std
::
string
nameOfTypePly
(
const
std
::
string
&
v
)
{
return
"invalid"
;
}
}
#endif
/* NAMETYPES_H_ */
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