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
Thomas Pitiot
CGoGN
Commits
58d544ae
Commit
58d544ae
authored
May 23, 2012
by
Sylvain Thery
Browse files
Merge branch 'master' of cgogn:~untereiner/CGoGN
Conflicts: src/Algo/Import/ply.c
parents
b8525572
bab01f8a
Changes
19
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/viewer.cpp
View file @
58d544ae
...
...
@@ -185,7 +185,7 @@ void Viewer::cb_Open()
void
Viewer
::
cb_Save
()
{
std
::
string
filters
(
"all (*.*);; map (*.map);; off (*.off);; ply (*.ply)
;; plygen (*.plygen)
"
)
;
std
::
string
filters
(
"all (*.*);; map (*.map);; off (*.off);; ply (*.ply)"
)
;
std
::
string
filename
=
selectFileSave
(
"Save Mesh"
,
""
,
filters
)
;
exportMesh
(
filename
)
;
...
...
@@ -237,7 +237,7 @@ void Viewer::importMesh(std::string& filename)
updateGLMatrices
()
;
}
void
Viewer
::
exportMesh
(
std
::
string
&
filename
)
void
Viewer
::
exportMesh
(
std
::
string
&
filename
,
bool
askExportMode
)
{
size_t
pos
=
filename
.
rfind
(
"."
)
;
// position of "." in filename
std
::
string
extension
=
filename
.
substr
(
pos
)
;
...
...
@@ -246,9 +246,13 @@ void Viewer::exportMesh(std::string& filename)
Algo
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
filename
.
c_str
(),
allDarts
)
;
else
if
(
extension
.
compare
(
0
,
4
,
std
::
string
(
".ply"
))
==
0
)
{
int
ascii
=
0
;
if
(
askExportMode
)
Utils
::
QT
::
inputValues
(
Utils
::
QT
::
VarCombo
(
"binary mode;ascii mode"
,
ascii
,
"Save in"
))
;
std
::
vector
<
PFP
::
TVEC3
*>
attributes
;
attributes
.
push_back
(
&
position
)
;
Algo
::
Export
::
exportPLYnew
<
PFP
>
(
myMap
,
attributes
,
filename
.
c_str
(),
true
,
allDarts
)
;
Algo
::
Export
::
exportPLYnew
<
PFP
>
(
myMap
,
attributes
,
filename
.
c_str
(),
!
ascii
,
allDarts
)
;
}
else
if
(
extension
==
std
::
string
(
".map"
))
myMap
.
saveMapBin
(
filename
)
;
...
...
@@ -305,6 +309,21 @@ void Viewer::slot_normalsSize(int i)
updateGL
()
;
}
void
Viewer
::
cb_keyPress
(
int
keycode
)
{
switch
(
keycode
)
{
case
'c'
:
myMap
.
check
();
break
;
default:
break
;
}
updateGLMatrices
()
;
updateGL
();
}
/**********************************************************************************************
* MAIN FUNCTION *
**********************************************************************************************/
...
...
@@ -325,7 +344,7 @@ int main(int argc, char **argv)
{
std
::
string
filenameExp
(
argv
[
2
])
;
std
::
cout
<<
"Exporting "
<<
filename
<<
" as "
<<
filenameExp
<<
" ... "
<<
std
::
flush
;
sqt
.
exportMesh
(
filenameExp
)
;
sqt
.
exportMesh
(
filenameExp
,
false
)
;
std
::
cout
<<
"done!"
<<
std
::
endl
;
return
(
0
)
;
...
...
Apps/Examples/viewer.h
View file @
58d544ae
...
...
@@ -46,6 +46,7 @@
#include
"Utils/Shaders/shaderVectorPerVertex.h"
#include
"Utils/pointSprite.h"
#include
"Utils/text3d.h"
#include
"Utils/qtInputs.h"
#include
"Algo/Geometry/boundingbox.h"
#include
"Algo/Geometry/normal.h"
...
...
@@ -116,8 +117,10 @@ public:
void
cb_Open
()
;
void
cb_Save
()
;
void
cb_keyPress
(
int
keycode
);
void
importMesh
(
std
::
string
&
filename
)
;
void
exportMesh
(
std
::
string
&
filename
);
void
exportMesh
(
std
::
string
&
filename
,
bool
askExportMode
=
true
);
public
slots
:
void
slot_drawVertices
(
bool
b
)
;
...
...
Apps/Examples/volumeExplorer.cpp
View file @
58d544ae
...
...
@@ -319,6 +319,18 @@ int main(int argc, char **argv)
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
attrNames
[
0
])
;
}
if
(
extension
==
std
::
string
(
".node"
))
{
if
(
!
Algo
::
Import
::
importMeshV
<
PFP
>
(
myMap
,
argv
[
1
],
attrNames
,
Algo
::
Import
::
ImportVolumique
::
NODE
))
{
std
::
cerr
<<
"could not import "
<<
argv
[
1
]
<<
std
::
endl
;
return
1
;
}
else
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
attrNames
[
0
])
;
}
if
(
extension
==
std
::
string
(
".off"
))
{
if
(
!
Algo
::
Import
::
importMeshToExtrude
<
PFP
>
(
myMap
,
argv
[
1
],
attrNames
))
...
...
Apps/Tuto/tuto_oper3.cpp
View file @
58d544ae
...
...
@@ -25,8 +25,10 @@
#include
"tuto_oper3.h"
#include
"Algo/Geometry/boundingbox.h"
#include
"Algo/Modelisation/polyhedron.h"
#include
"Algo/Modelisation/tetrahedralization.h"
#include
"Algo/Modelisation/primitives3d.h"
#include
"Algo/Geometry/centroid.h"
#include
"Algo/Geometry/normal.h"
#include
"Algo/Import/import.h"
#include
"Algo/Export/export.h"
...
...
@@ -148,7 +150,14 @@ void MyQT::operation(int x)
CGoGNout
<<
"split volume"
<<
CGoGNendl
;
if
(
!
m_selecteds
.
empty
())
{
std
::
cout
<<
"start"
<<
std
::
endl
;
for
(
std
::
vector
<
Dart
>::
iterator
it
=
m_selecteds
.
begin
()
;
it
!=
m_selecteds
.
end
()
;
++
it
)
std
::
cout
<<
*
it
<<
" et phi2() = "
<<
myMap
.
phi2
(
*
it
)
<<
std
::
endl
;
std
::
cout
<<
"end"
<<
std
::
endl
;
myMap
.
splitVolume
(
m_selecteds
);
m_selecteds
.
clear
();
dm
.
markAll
();
updateMap
();
}
...
...
@@ -177,6 +186,24 @@ void MyQT::operation(int x)
updateMap
();
}
break
;
case
10
:
CGoGNout
<<
"split vertex"
<<
CGoGNendl
;
if
(
!
m_selecteds
.
empty
()
&&
m_selected
!=
NIL
)
{
Dart
dit
=
m_selecteds
.
front
();
PFP
::
VEC3
Q
=
(
position
[
myMap
.
phi1
(
m_selected
)]
+
position
[
m_selected
])
/
2.0
f
;
//PFP::VEC3 c1 = Algo::Geometry::volumeCentroid<PFP>(myMap, dit, position);
//Dart dres = myMap.splitVertex(m_selecteds);
Dart
dres
=
Algo
::
Modelisation
::
Tetrahedralization
::
splitVertex
<
PFP
>
(
myMap
,
m_selecteds
);
position
[
dres
]
=
position
[
dit
]
+
Q
*
0.25
f
;
//position[dit] = position[dit] - c1*0.5f;
m_selecteds
.
clear
();
m_selected
=
NIL
;
dm
.
markAll
();
updateMap
();
std
::
cout
<<
"nb darts after = "
<<
myMap
.
getNbDarts
()
<<
std
::
endl
;
}
break
;
default:
break
;
}
...
...
@@ -195,6 +222,15 @@ void MyQT::createMap(int n)
prim
.
hexaGrid_topo
(
n
,
n
,
n
);
prim
.
embedHexaGrid
(
1.0
f
,
1.0
f
,
1.0
f
);
// Dart d = Algo::Modelisation::createTetrahedron<PFP>(myMap);
// myMap.closeMap();
//
// position[d] = typename PFP::VEC3(0.0f, 0.0f, 0.0f);
// position[myMap.phi1(d)] = typename PFP::VEC3(0.0f, 1.0f, 0.0f);
// position[myMap.phi1(myMap.phi1(d))] = typename PFP::VEC3(1.0f, 0.5f, 0.0f);
// position[myMap.phi_1(myMap.phi2(d))] = typename PFP::VEC3(0.5f, 0.5f, 1.0f);
// bounding box of scene
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
setParamObject
(
bb
.
maxSize
(),
bb
.
center
().
data
())
;
...
...
Apps/Tuto/tuto_oper3.ui
View file @
58d544ae
...
...
@@ -71,7 +71,7 @@
</item>
<item>
<property
name=
"text"
>
<string>
collapsedge
</string>
<string>
collapse
E
dge
</string>
</property>
</item>
<item>
...
...
@@ -99,6 +99,11 @@
<string>
collapseVolume
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
splitVertex
</string>
</property>
</item>
</widget>
</item>
<item>
...
...
include/Algo/Export/export.h
View file @
58d544ae
...
...
@@ -134,6 +134,16 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
template
<
typename
PFP
>
bool
exportPLYPTM
(
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
FunctorSelect
&
good
=
allDarts
)
;
/**
* export meshes used at the workbench
* export just a list of vertices and edges connectivity
* @param map
* @param position
* @return
*/
template
<
typename
PFP
>
bool
exportChoupi
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
char
*
filename
,
const
FunctorSelect
&
good
=
allDarts
)
;
}
// namespace Export
}
// namespace Algo
...
...
include/Algo/Export/export.hpp
View file @
58d544ae
...
...
@@ -918,6 +918,39 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
return
true
;
}
template
<
typename
PFP
>
bool
exportChoupi
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
char
*
filename
,
const
FunctorSelect
&
good
)
{
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
std
::
ofstream
out
(
filename
,
std
::
ios
::
out
)
;
if
(
!
out
.
good
())
{
CGoGNerr
<<
"Unable to open file "
<<
CGoGNendl
;
return
false
;
}
out
<<
map
.
getNbOrbits
(
VERTEX
)
<<
" "
<<
map
.
getNbOrbits
(
EDGE
)
<<
std
::
endl
;
TraversorV
<
typename
PFP
::
MAP
>
travV
(
map
);
for
(
Dart
dit
=
travV
.
begin
()
;
dit
!=
travV
.
end
()
;
dit
=
travV
.
next
())
{
out
<<
map
.
getEmbedding
(
VERTEX
,
dit
)
<<
" "
<<
position
[
dit
]
<<
std
::
endl
;
}
TraversorE
<
typename
PFP
::
MAP
>
travE
(
map
);
unsigned
int
indexE
=
0
;
for
(
Dart
dit
=
travE
.
begin
()
;
dit
!=
travE
.
end
()
;
dit
=
travE
.
next
())
{
out
<<
indexE
<<
" "
<<
map
.
getEmbedding
(
VERTEX
,
dit
)
<<
" "
<<
map
.
getEmbedding
(
VERTEX
,
map
.
phi2
(
dit
))
<<
std
::
endl
;
++
indexE
;
}
out
.
close
()
;
return
true
;
}
}
// namespace Export
}
// namespace Algo
...
...
include/Algo/Import/import.h
View file @
58d544ae
...
...
@@ -83,6 +83,15 @@ template <typename PFP>
bool
importMoka
(
typename
PFP
::
MAP
&
gmap
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
);
/**
* import a Choupi file
* @param map
* @param filename
* @return
*/
template
<
typename
PFP
>
bool
importChoupi
(
const
std
::
string
&
filename
,
const
std
::
vector
<
typename
PFP
::
VEC3
>&
tabV
,
const
std
::
vector
<
unsigned
int
>&
tabE
);
/*
* TODO a transformer en utilisant un MeshTableVolume.
*/
...
...
@@ -117,4 +126,6 @@ bool importTs(typename PFP::MAP& the_map, const std::string& filename, std::vect
#include
"Algo/Import/importTs.hpp"
#include
"Algo/Import/importNodeEle.hpp"
#include
"Algo/Import/importChoupi.hpp"
#endif
include/
Topology/map/map2MR/map2MR_PM.h
→
include/
Algo/Import/importChoupi.hpp
View file @
58d544ae
...
...
@@ -22,56 +22,96 @@
* *
*******************************************************************************/
#ifndef __MAP2MR_PM__
#define __MAP2MR_PM__
#include
"Topology/map/embeddedMap2.h"
#include
"Topology/generic/traversorCell.h"
#include
"Topology/generic/traversor2.h"
#include
"Topology/map/map2MR/filters_Primal.h"
#include
"Algo/Modelisation/subdivision.h"
namespace
CGoGN
{
class
SelectorCollapsingEdges
:
public
FunctorSelect
namespace
Algo
{
protected:
const
DartMarker
&
m_dm
;
public:
SelectorCollapsingEdges
(
const
DartMarker
&
dm
)
:
m_dm
(
dm
)
{}
bool
operator
()(
Dart
d
)
const
{
return
m_dm
.
isMarked
(
d
);
}
FunctorSelect
*
copy
()
const
{
return
new
SelectorCollapsingEdges
(
m_dm
);}
};
class
Map2MR_PM
:
public
EmbeddedMap2
namespace
Import
{
protected:
bool
shareVertexEmbeddings
;
std
::
vector
<
Multiresolution
::
MRFilter
*>
synthesisFilters
;
std
::
vector
<
Multiresolution
::
MRFilter
*>
analysisFilters
;
template
<
typename
PFP
>
bool
importChoupi
(
const
std
::
string
&
filename
,
std
::
vector
<
typename
PFP
::
VEC3
>&
tabV
,
std
::
vector
<
unsigned
int
>&
tabE
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
//open file
std
::
ifstream
fp
(
filename
.
c_str
(),
std
::
ios
::
in
);
if
(
!
fp
.
good
())
{
CGoGNerr
<<
"Unable to open file "
<<
filename
<<
CGoGNendl
;
return
false
;
}
std
::
string
ligne
;
unsigned
int
nbv
,
nbe
;
std
::
getline
(
fp
,
ligne
);
std
::
stringstream
oss
(
ligne
);
oss
>>
nbv
;
oss
>>
nbe
;
std
::
vector
<
unsigned
int
>
index
;
index
.
reserve
(
1024
);
//read vertices
unsigned
int
id
=
0
;
for
(
unsigned
int
j
=
0
;
j
<
nbv
;
++
j
)
{
do
{
std
::
getline
(
fp
,
ligne
);
}
while
(
ligne
.
size
()
==
0
);
std
::
stringstream
oss
(
ligne
);
float
i
,
x
,
y
,
z
;
oss
>>
i
;
oss
>>
x
;
oss
>>
y
;
oss
>>
z
;
VEC3
pos
(
x
,
y
,
z
);
index
[
i
]
=
id
;
tabV
.
push_back
(
pos
);
++
id
;
}
std
::
stringstream
oss2
(
ligne
);
for
(
unsigned
int
i
=
0
;
i
<
nbe
;
++
i
)
{
do
{
std
::
getline
(
fp
,
ligne
);
}
while
(
ligne
.
size
()
==
0
);
std
::
stringstream
oss
(
ligne
);
unsigned
int
x
,
y
;
oss
>>
x
;
oss
>>
x
;
oss
>>
y
;
DartMarkerStore
*
selectedEdges
;
tabE
.
push_back
(
index
[
x
]);
tabE
.
push_back
(
index
[
y
]);
}
public:
Map2MR_PM
()
;
//for(typename std::vector<VEC3>::iterator it = tabV.begin() ; it < tabV.end() ; ++it)
// std::cout << *it << std::endl
;
virtual
std
::
string
mapTypeName
()
const
{
return
"Map2MR_PM"
;
}
void
addNewLevel
(
bool
embedNewVertices
=
true
)
;
//for(std::vector<unsigned int>::iterator it = tabE.begin() ; it < tabE.end() ; it = it + 2)
// std::cout << *it << " " << *(it + 1) << std::endl
;
void
addSynthesisFilter
(
Multiresolution
::
MRFilter
*
f
)
{
synthesisFilters
.
push_back
(
f
)
;
}
void
addAnalysisFilter
(
Multiresolution
::
MRFilter
*
f
)
{
analysisFilters
.
push_back
(
f
)
;
}
return
true
;
}
void
clearSynthesisFilters
()
{
synthesisFilters
.
clear
()
;
}
void
clearAnalysisFilters
()
{
analysisFilters
.
clear
()
;
}
}
// namespace Import
void
analysis
()
;
void
synthesis
()
;
}
;
}
// namespace Algo
}
// namespace CGoGN
#endif
include/Algo/Modelisation/tetrahedralization.h
View file @
58d544ae
...
...
@@ -44,6 +44,13 @@ namespace Tetrahedralization
template
<
typename
PFP
>
void
hexahedronToTetrahedron
(
typename
PFP
::
MAP
&
map
,
Dart
d
);
/************************************************************************************************
* Collapse / Split Operators
************************************************************************************************/
template
<
typename
PFP
>
Dart
splitVertex
(
typename
PFP
::
MAP
&
map
,
std
::
vector
<
Dart
>&
vd
);
/************************************************************************************************
* Tetrahedron functions *
************************************************************************************************/
...
...
@@ -56,6 +63,14 @@ void hexahedronToTetrahedron(typename PFP::MAP& map, Dart d);
template
<
typename
PFP
>
bool
isTetrahedron
(
typename
PFP
::
MAP
&
the_map
,
Dart
d
);
/**
* test if a mesh (or submesh) is a tetrahedral mesh
* @param map
* @param selected
*/
template
<
typename
PFP
>
bool
isTetrahedralization
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
selected
=
allDarts
);
/************************************************************************************************
* Swap Functions *
************************************************************************************************/
...
...
include/Algo/Modelisation/tetrahedralization.hpp
View file @
58d544ae
...
...
@@ -55,7 +55,44 @@ void hexahedronToTetrahedron(typename PFP::MAP& map, Dart d)
/************************************************************************************************
* Tetrahedron functions *
* Collapse / Split Operators
************************************************************************************************/
template
<
typename
PFP
>
Dart
splitVertex
(
typename
PFP
::
MAP
&
map
,
std
::
vector
<
Dart
>&
vd
)
{
//split the vertex
Dart
dres
=
map
.
splitVertex
(
vd
);
//split the faces incident to the new vertex
Dart
dbegin
=
map
.
phi1
(
map
.
phi2
(
vd
.
front
()));
Dart
dit
=
dbegin
;
do
{
map
.
splitFace
(
map
.
phi1
(
dit
),
map
.
phi_1
(
dit
));
dit
=
map
.
alpha2
(
dit
);
}
while
(
dbegin
!=
dit
);
//split the volumes incident to the new vertex
for
(
unsigned
int
i
=
0
;
i
<
vd
.
size
();
++
i
)
{
Dart
dit
=
vd
[
i
];
std
::
vector
<
Dart
>
v
;
v
.
push_back
(
map
.
phi1
(
map
.
phi1
(
map
.
phi2
(
dit
))));
std
::
cout
<<
"["
<<
v
.
back
();
v
.
push_back
(
map
.
phi1
(
dit
));
std
::
cout
<<
" - "
<<
v
.
back
();
v
.
push_back
(
map
.
phi1
(
map
.
phi2
(
map
.
phi_1
(
dit
))));
std
::
cout
<<
" - "
<<
v
.
back
()
<<
"]"
<<
std
::
endl
;
//map.splitVolume(v);
}
return
dres
;
}
/************************************************************************************************
* Tetrahedron functions *
************************************************************************************************/
template
<
typename
PFP
>
...
...
@@ -80,8 +117,21 @@ bool isTetrahedron(typename PFP::MAP& the_map, Dart d)
return
true
;
}
template
<
typename
PFP
>
bool
isTetrahedralization
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
selected
)
{
TraversorV
<
typename
PFP
::
MAP
>
travV
(
map
,
selected
);
for
(
Dart
dit
=
travV
.
begin
()
;
dit
!=
travV
.
end
()
;
dit
=
travV
.
next
())
{
if
(
!
isTetrahedron
<
PFP
>
(
map
,
dit
))
return
false
;
}
return
true
;
}
/************************************************************************************************
*
Topological functions *
* Topological functions *
************************************************************************************************/
//sew a face into the edge
...
...
@@ -380,7 +430,7 @@ void swap5To4(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positions)
}
/************************************************************************************************
*
Flip Functions *
* Flip Functions *
************************************************************************************************/
template
<
typename
PFP
>
...
...
include/Topology/map/embeddedMap3.h
View file @
58d544ae
...
...
@@ -37,6 +37,12 @@ class EmbeddedMap3 : public Map3
public:
typedef
Map3
TOPO_MAP
;
//!
/*!
*
*/
virtual
Dart
splitVertex
(
std
::
vector
<
Dart
>&
vd
);
//!
/*!
*/
...
...
include/Topology/map/map2MR/filters_Primal.h
View file @
58d544ae
...
...
@@ -26,6 +26,7 @@
#define __MR_FILTERS_PRIMAL__
#include
<cmath>
//#include "Algo/Decimation/decimation.h"
namespace
CGoGN
{
...
...
@@ -546,6 +547,7 @@ public:
}
}
;
}
// namespace Multiresolution
}
// namespace CGoGN
...
...
include/Topology/map/map3.h
View file @
58d544ae
...
...
@@ -137,6 +137,14 @@ public:
*************************************************************************/
//@{
//! Split the vertex along a permutation of faces
/*! \per Darts d & e MUST belong to the same vertex
* \per Darts d & e MUST belong to different volumes
* \per Works only on the boundary
* @param vd a vector of darts
*/
virtual
Dart
splitVertex
(
std
::
vector
<
Dart
>&
vd
);
//! Delete the vertex of d
/*! All the volumes around the vertex are merged into one volume
* @param d a dart of the vertex to delete
...
...
src/Algo/Import/ply.c
View file @
58d544ae
...
...
@@ -1642,9 +1642,11 @@ void binary_get_element(PlyFile *plyfile, char *elem_ptr)
else
if
(
prop
->
is_list
==
PLY_STRING
)
{
/* string */
int
len
;
char
*
str
;
fread
(
&
len
,
sizeof
(
int
),
1
,
fp
);
if
(
fread
(
&
len
,
sizeof
(
int
),
1
,
fp
)
!=
sizeof
(
int
))
fprintf
(
stderr
,
"binary_get_element: problem occured in fread
\n
"
);
str
=
(
char
*
)
myalloc
(
len
);
fread
(
str
,
len
,
1
,
fp
);
if
(
fread
(
str
,
len
,
1
,
fp
)
!=
len
)
fprintf
(
stderr
,
"binary_get_element: problem occured in fread
\n
"
);
if
(
store_it
)
{
char
**
str_ptr
;
item
=
elem_data
+
prop
->
offset
;
...
...
@@ -2079,13 +2081,15 @@ void get_binary_item(
switch
(
type
)
{
case
PLY_Int8
:
fread
(
ptr
,
1
,
1
,
fp
);
if
(
fread
(
ptr
,
1
,
1
,
fp
)
!=
1
)
fprintf
(
stderr
,
"get_binary_item: problem occured in fread in switch(%d)
\n
"
,
type
);
*
int_val
=
*
((
char
*
)
ptr
);
*
uint_val
=
*
int_val
;
*
double_val
=
*
int_val
;
break
;
case
PLY_Uint8
:
fread
(
ptr
,
1
,
1
,
fp
);
if
(
fread
(
ptr
,
1
,
1
,
fp
)
!=
1
)
fprintf
(
stderr
,
"get_binary_item: problem occured in fread in switch(%d)
\n
"
,
type
);
*
uint_val
=
*
((
unsigned
char
*
)
ptr
);
*
int_val
=
*
uint_val
;
*
double_val
=
*
uint_val
;
...
...
@@ -2095,11 +2099,14 @@ void get_binary_item(
{
unsigned
char
*
cptr
;
cptr
=
(
unsigned
char
*
)
ptr
;
fread
(
cptr
+
1
,
1
,
1
,
fp
);
fread
(
cptr
+
0
,
1
,
1
,
fp
);
if
(
fread
(
cptr
+
1
,
1
,
1
,
fp
)
!=
1
)
fprintf
(
stderr
,
"get_binary_item: problem occured in fread in switch(%d)
\n
"
,
type
);
if
(
fread
(
cptr
,
1
,
1
,
fp
)
!=
1
)
fprintf
(
stderr
,
"get_binary_item: problem occured in fread in switch(%d)
\n
"
,
type
);
}
else
fread
(
ptr
,
2
,
1
,
fp
);
if
(
fread
(
ptr
,
1
,
2
,
fp
)
!=
2
)