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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hurstel
CGoGN
Commits
a6d0a247
Commit
a6d0a247
authored
Apr 17, 2012
by
Kenneth Vanhoey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added ply binary export (boolean in function call)
parent
0edf4e04
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
18 deletions
+65
-18
Apps/Examples/viewer.cpp
Apps/Examples/viewer.cpp
+1
-1
include/Algo/Export/export.h
include/Algo/Export/export.h
+1
-1
include/Algo/Export/export.hpp
include/Algo/Export/export.hpp
+63
-16
No files found.
Apps/Examples/viewer.cpp
View file @
a6d0a247
...
...
@@ -234,7 +234,7 @@ void Viewer::exportMesh(std::string& filename)
if
(
extension
==
std
::
string
(
".off"
))
Algo
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
filename
.
c_str
(),
allDarts
)
;
else
if
(
extension
.
compare
(
0
,
4
,
std
::
string
(
".ply"
))
==
0
)
Algo
::
Export
::
exportPLY
<
PFP
>
(
myMap
,
position
,
filename
.
c_str
(),
allDarts
)
;
Algo
::
Export
::
exportPLY
<
PFP
>
(
myMap
,
position
,
filename
.
c_str
(),
true
,
allDarts
)
;
else
if
(
extension
==
std
::
string
(
".map"
))
myMap
.
saveMapBin
(
filename
)
;
else
...
...
include/Algo/Export/export.h
View file @
a6d0a247
...
...
@@ -43,7 +43,7 @@ namespace Export
* @return true
*/
template
<
typename
PFP
>
bool
exportPLY
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
char
*
filename
,
const
FunctorSelect
&
good
=
allDarts
)
;
bool
exportPLY
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
char
*
filename
,
const
bool
binary
,
const
FunctorSelect
&
good
=
allDarts
)
;
/**
* export the map into a OFF file
...
...
include/Algo/Export/export.hpp
View file @
a6d0a247
...
...
@@ -38,12 +38,16 @@ namespace Export
{
template
<
typename
PFP
>
bool
exportPLY
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
char
*
filename
,
const
FunctorSelect
&
good
)
bool
exportPLY
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
char
*
filename
,
bool
binary
,
const
FunctorSelect
&
good
)
{
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
std
::
ofstream
out
(
filename
,
std
::
ios
::
out
)
;
std
::
ofstream
out
;
//if (!binary)
out
.
open
(
filename
,
std
::
ios
::
out
)
;
//else
//out.open(filename, std::ios::out | std::ios::binary) ;
if
(
!
out
.
good
())
{
CGoGNerr
<<
"Unable to open file "
<<
CGoGNendl
;
...
...
@@ -85,30 +89,73 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
}
out
<<
"ply"
<<
std
::
endl
;
out
<<
"format ascii 1.0"
<<
std
::
endl
;
out
<<
"comment no comment"
<<
std
::
endl
;
if
(
!
binary
)
out
<<
"format ascii 1.0"
<<
std
::
endl
;
else
{
// test endianness
union
{
uint32_t
i
;
char
c
[
4
]
;
}
bint
=
{
0x01020304
}
;
if
(
bint
.
c
[
0
]
==
1
)
// big endian
out
<<
"format binary_big_endian 1.0"
<<
std
::
endl
;
else
out
<<
"format binary_little_endian 1.0"
<<
std
::
endl
;
}
out
<<
"comment File generated by the CGoGN library"
<<
std
::
endl
;
out
<<
"comment See : http://cgogn.unistra.fr/"
<<
std
::
endl
;
out
<<
"comment Or contact : cgogn@unistra.fr"
<<
std
::
endl
;
out
<<
"element vertex "
<<
vertices
.
size
()
<<
std
::
endl
;
out
<<
"property float x"
<<
std
::
endl
;
out
<<
"property float y"
<<
std
::
endl
;
out
<<
"property float z"
<<
std
::
endl
;
if
(
position
.
isValid
())
{
out
<<
"property float32 x"
<<
std
::
endl
;
out
<<
"property float32 y"
<<
std
::
endl
;
out
<<
"property float32 z"
<<
std
::
endl
;
}
out
<<
"element face "
<<
facesSize
.
size
()
<<
std
::
endl
;
out
<<
"property list u
char int
vertex_indices"
<<
std
::
endl
;
out
<<
"property list u
int8 uint32
vertex_indices"
<<
std
::
endl
;
out
<<
"end_header"
<<
std
::
endl
;
for
(
unsigned
int
i
=
0
;
i
<
vertices
.
size
();
++
i
)
if
(
!
binary
)
{
const
VEC3
&
v
=
position
[
vertices
[
i
]]
;
out
<<
v
[
0
]
<<
" "
<<
v
[
1
]
<<
" "
<<
v
[
2
]
<<
std
::
endl
;
for
(
unsigned
int
i
=
0
;
i
<
vertices
.
size
();
++
i
)
out
<<
position
[
vertices
[
i
]]
<<
std
::
endl
;
for
(
unsigned
int
i
=
0
;
i
<
facesSize
.
size
();
++
i
)
{
out
<<
facesSize
[
i
]
;
for
(
unsigned
int
j
=
0
;
j
<
facesIdx
[
i
].
size
();
++
j
)
out
<<
" "
<<
facesIdx
[
i
][
j
]
;
out
<<
std
::
endl
;
}
}
for
(
unsigned
int
i
=
0
;
i
<
facesSize
.
size
();
++
i
)
else
{
out
<<
facesSize
[
i
]
;
for
(
unsigned
int
j
=
0
;
j
<
facesIdx
[
i
].
size
();
++
j
)
out
<<
" "
<<
facesIdx
[
i
][
j
]
;
out
<<
std
::
endl
;
for
(
unsigned
int
i
=
0
;
i
<
vertices
.
size
();
++
i
)
{
Geom
::
Vec3f
v
=
position
[
vertices
[
i
]]
;
for
(
unsigned
int
c
=
0
;
c
<
3
;
++
c
)
{
const
float
&
floatofdouble
=
v
[
c
]
;
out
.
write
((
char
*
)(
&
floatofdouble
),
sizeof
(
float
))
;
}
}
for
(
unsigned
int
i
=
0
;
i
<
facesSize
.
size
();
++
i
)
{
unsigned
char
nbe
=
facesSize
[
i
]
;
out
.
write
((
char
*
)(
&
nbe
),
sizeof
(
unsigned
char
))
;
for
(
unsigned
int
j
=
0
;
j
<
facesIdx
[
i
].
size
()
;
++
j
)
out
.
write
((
char
*
)(
&
(
facesIdx
[
i
][
j
])),
sizeof
(
unsigned
int
))
;
}
}
out
.
close
()
;
return
true
;
}
...
...
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