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
897b97cb
Commit
897b97cb
authored
Mar 12, 2012
by
Kenneth Vanhoey
Browse files
binary import/export for SLF
parent
877cde77
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/Algo/Export/export.hpp
View file @
897b97cb
...
...
@@ -530,9 +530,13 @@ bool exportPlySLFgenericBin(typename PFP::MAP& map, const typename PFP::TVEC3& p
size_t
pos
=
file
.
rfind
(
"."
)
;
// position of "." in filename
std
::
string
extension
=
file
.
substr
(
pos
)
;
std
::
string
tmp
;
tmp
=
std
::
string
(
"ply"
)
;
out
.
write
(
tmp
,
tmp
.
length
()
*
sizeof
(
char
))
;
tmp
=
std
::
string
(
"format binary_little_endian 1.0"
)
;
out
.
write
(
tmp
,
tmp
.
length
()
*
sizeof
(
char
))
;
std
::
stringstream
header
;
header
<<
"ply"
<<
std
::
endl
;
header
<<
"format binary_little_endian 1.0"
<<
std
::
endl
;
header
<<
"comment ply SLF (K. Vanhoey generic format): SLF_"
<<
((
extension
==
".plyPTMext"
)
?
"PTMext"
:
"SHreal"
)
<<
std
::
endl
;
header
<<
"element vertex "
<<
vertices
.
size
()
<<
std
::
endl
;
header
<<
"property float x"
<<
std
::
endl
;
...
...
include/Algo/Import/import2tablesSurface.hpp
View file @
897b97cb
...
...
@@ -805,25 +805,28 @@ bool MeshTablesSurface<PFP>::importPlySLFgenericBin(const std::string& filename,
return
false
;
}
// read "ply"
char
*
buff
=
new
char
[
3
]
;
fp
.
read
(
buff
,
3
)
;
std
::
string
tag
(
buff
)
;
delete
[]
buff
;
if
(
tag
!=
std
::
string
(
"ply"
))
// verify file type
{
CGoGNerr
<<
filename
<<
" is not a ply file !"
<<
CGoGNout
;
return
false
;
}
// read CHNum
unsigned
int
CHNum
;
fp
.
read
((
char
*
)
&
CHNum
,
sizeof
(
unsigned
int
))
;
char
*
headerTab
=
new
char
[
CHNum
]
;
std
::
cout
<<
fp
.
read
(
headerTab
,
CHNum
)
<<
std
::
endl
;
fp
.
read
(
headerTab
,
CHNum
)
;
std
::
stringstream
header
(
headerTab
)
;
std
::
cout
<<
std
::
string
(
headerTab
)
<<
std
::
endl
;
// Read quantities : #vertices, #faces, #properties, degree of polynomials
std
::
string
tag
;
header
>>
tag
;
if
(
tag
!=
std
::
string
(
"ply"
))
// verify file type
{
CGoGNerr
<<
filename
<<
" is not a ply file !"
<<
CGoGNout
;
return
false
;
}
do
// go to #vertices
{
...
...
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