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
David Cazier
CGoGN
Commits
e3b35f88
Commit
e3b35f88
authored
Jan 28, 2011
by
Pierre Kraemer
Browse files
debut correction meshTableVolume
parent
a4d40b86
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/Algo/Import/import.h
View file @
e3b35f88
...
...
@@ -66,10 +66,10 @@ template <typename PFP>
bool
importOFFWithELERegions
(
typename
PFP
::
MAP
&
the_map
,
const
std
::
string
&
filenameOFF
,
const
std
::
string
&
filenameELE
,
std
::
vector
<
std
::
string
>&
attrNames
);
template
<
typename
PFP
>
bool
importTet
(
typename
PFP
::
MAP
&
the_map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
float
scaleFactor
=
1.0
f
);
bool
importTet
(
typename
PFP
::
MAP
&
the_map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
float
scaleFactor
=
1.0
f
);
template
<
typename
PFP
>
bool
importTs
(
typename
PFP
::
MAP
&
the_map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
float
scaleFactor
=
1.0
f
);
bool
importTs
(
typename
PFP
::
MAP
&
the_map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
float
scaleFactor
=
1.0
f
);
template
<
typename
PFP
>
bool
importInESS
(
typename
PFP
::
MAP
&
the_map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
);
...
...
include/Algo/Import/import2tables.h
View file @
e3b35f88
...
...
@@ -130,10 +130,9 @@ public:
template
<
typename
PFP
>
class
MeshTablesVolume
{
public:
protected:
typename
PFP
::
MAP
&
m_map
;
unsigned
m_nbVertices
;
unsigned
m_nbFaces
;
...
...
@@ -150,16 +149,6 @@ protected:
*/
std
::
vector
<
unsigned
int
>
m_emb
;
/**
* we need direct access to container itself to insert new lines while reading points
*/
AttribContainer
&
m_container
;
/**
* table of positions
*/
typename
PFP
::
TVEC3
&
m_positions
;
static
ImportVolumique
::
ImportType
getFileType
(
const
std
::
string
&
filename
);
public:
...
...
@@ -170,7 +159,7 @@ public:
typedef
Geom
::
Matrix
<
3
,
3
,
DATA_TYPE
>
MAT33
;
typedef
Geom
::
Matrix
<
3
,
6
,
DATA_TYPE
>
MAT36
;
inline
short
getNbEdgesFace
(
int
i
)
const
{
return
m_nbEdges
[
i
];}
inline
short
getNbEdgesFace
(
int
i
)
const
{
return
m_nbEdges
[
i
];
}
inline
unsigned
getNbVolumes
()
const
{
return
m_nbVolumes
;
}
...
...
@@ -184,23 +173,17 @@ public:
inline
unsigned
int
getEmbIdx
(
int
i
)
{
return
m_emb
[
i
];
}
bool
import
Tet
(
const
std
::
string
&
filename
,
float
scaleFactor
);
bool
import
Mesh
(
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
ImportVolumique
::
ImportType
kind
,
float
scaleFactor
);
bool
import
Ply
(
const
std
::
string
&
filename
);
bool
import
Tet
(
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
float
scaleFactor
);
bool
importTrianBinGz
(
const
std
::
string
&
filename
);
bool
importMesh
(
const
std
::
string
&
filename
,
ImportVolumique
::
ImportType
kind
,
float
scaleFactor
);
bool
importPly
(
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
);
MeshTablesVolume
(
AttribContainer
&
container
,
typename
PFP
::
TVEC3
&
pos
)
:
m_container
(
container
),
m_positions
(
pos
)
{
}
bool
importTrianBinGz
(
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
);
MeshTablesVolume
(
AttribContainer
&
container
,
typename
PFP
::
TVEC3
&
pos
,
const
std
::
string
&
filename
)
:
m_
container
(
container
),
m_positions
(
pos
)
MeshTablesVolume
(
typename
PFP
::
MAP
&
map
)
:
m_
map
(
map
)
{
importMesh
(
filename
);
}
};
...
...
include/Algo/Import/import2tablesVolume.hpp
View file @
e3b35f88
...
...
@@ -36,8 +36,10 @@ ImportVolumique::ImportType MeshTablesVolume<PFP>::getFileType(const std::string
{
if
((
filename
.
rfind
(
".tet"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".TET"
)
!=
std
::
string
::
npos
))
return
ImportVolumique
::
TET
;
if
((
filename
.
rfind
(
".trianbgz"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".TRIANBGZ"
)
!=
std
::
string
::
npos
))
return
ImportVolumique
::
TRIANBGZ
;
if
((
filename
.
rfind
(
".ply"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".PLY"
)
!=
std
::
string
::
npos
))
return
ImportVolumique
::
PLY
;
...
...
@@ -45,7 +47,7 @@ ImportVolumique::ImportType MeshTablesVolume<PFP>::getFileType(const std::string
}
template
<
typename
PFP
>
bool
MeshTablesVolume
<
PFP
>::
importMesh
(
const
std
::
string
&
filename
,
ImportVolumique
::
ImportType
kind
,
float
scaleFactor
=
1.0
f
)
bool
MeshTablesVolume
<
PFP
>::
importMesh
(
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
ImportVolumique
::
ImportType
kind
,
float
scaleFactor
=
1.0
f
)
{
if
(
kind
==
ImportVolumique
::
UNKNOWNVOLUME
)
kind
=
getFileType
(
filename
);
...
...
@@ -53,13 +55,13 @@ bool MeshTablesVolume<PFP>::importMesh(const std::string& filename, ImportVolumi
switch
(
kind
)
{
case
ImportVolumique
::
PLY
:
return
importPly
(
filename
);
return
importPly
(
filename
,
attrNames
);
break
;
case
ImportVolumique
::
TET
:
return
importTet
(
filename
,
scaleFactor
);
return
importTet
(
filename
,
attrNames
,
scaleFactor
);
break
;
case
ImportVolumique
::
TRIANBGZ
:
return
importTrianBinGz
(
filename
);
return
importTrianBinGz
(
filename
,
attrNames
);
break
;
default:
std
::
cerr
<<
"Not yet supported"
<<
std
::
endl
;
...
...
@@ -69,8 +71,12 @@ bool MeshTablesVolume<PFP>::importMesh(const std::string& filename, ImportVolumi
}
template
<
typename
PFP
>
bool
MeshTablesVolume
<
PFP
>::
importTet
(
const
std
::
string
&
filename
,
float
scaleFactor
=
1.0
f
)
bool
MeshTablesVolume
<
PFP
>::
importTet
(
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
float
scaleFactor
=
1.0
f
)
{
AttribContainer
&
container
=
m_map
.
getAttributeContainer
(
VERTEX_CELL
)
;
AttributeHandler
<
typename
PFP
::
VEC3
>
positions
=
m_map
.
template
addAttribute
<
typename
PFP
::
VEC3
>(
VERTEX_ORBIT
,
"position"
)
;
attrNames
.
push_back
(
positions
.
name
())
;
// open file
std
::
ifstream
fp
(
filename
.
c_str
(),
std
::
ios
::
in
);
if
(
!
fp
.
good
())
...
...
@@ -79,7 +85,6 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename,float scaleFac
return
false
;
}
std
::
string
ligne
;
int
nbv
,
nbt
;
// lecture des nombres de sommets/tetra
...
...
@@ -116,8 +121,8 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename,float scaleFac
//std::cout << "VEC3 = " << pos << std::endl;
unsigned
int
id
=
m_
container
.
insertLine
();
m_
positions
[
id
]
=
pos
;
unsigned
int
id
=
container
.
insertLine
();
positions
[
id
]
=
pos
;
verticesID
.
push_back
(
id
);
}
...
...
@@ -133,7 +138,7 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename,float scaleFac
m_nbFaces
=
nbt
*
4
;
m_emb
.
reserve
(
nbt
*
12
);
for
(
unsigned
i
=
0
;
i
<
m_nbVolumes
;
++
i
)
for
(
unsigned
i
nt
i
=
0
;
i
<
m_nbVolumes
;
++
i
)
{
do
{
...
...
@@ -183,7 +188,7 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename,float scaleFac
}
template
<
typename
PFP
>
bool
MeshTablesVolume
<
PFP
>::
importTrianBinGz
(
const
std
::
string
&
filename
)
bool
MeshTablesVolume
<
PFP
>::
importTrianBinGz
(
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
)
{
// // open file
// igzstream fs(filename.c_str(), std::ios::in|std::ios::binary);
...
...
@@ -246,7 +251,7 @@ bool MeshTablesVolume<PFP>::importTrianBinGz(const std::string& filename)
}
template
<
typename
PFP
>
bool
MeshTablesVolume
<
PFP
>::
importPly
(
const
std
::
string
&
filename
)
bool
MeshTablesVolume
<
PFP
>::
importPly
(
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
)
{
// PlyImportData pid;
//
...
...
@@ -286,7 +291,6 @@ bool MeshTablesVolume<PFP>::importPly(const std::string& filename)
// m_emb.push_back(vertices[ indices[j] ]);
// }
// }
return
true
;
}
...
...
include/Algo/Import/importMesh.hpp
View file @
e3b35f88
...
...
@@ -439,13 +439,11 @@ bool importMesh(typename PFP::MAP& map, const std::string& filename, std::vector
}
template
<
typename
PFP
>
bool
importMesh
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
typename
PFP
::
TVEC3
&
position
s
,
ImportVolumique
::
ImportType
kind
)
bool
importMesh
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrName
s
,
ImportVolumique
::
ImportType
kind
)
{
AttribContainer
&
vertexContainer
=
map
.
getAttributeContainer
(
VERTEX_ORBIT
);
MeshTablesVolume
<
PFP
>
mtv
(
map
);
MeshTablesVolume
<
PFP
>
mtv
(
vertexContainer
,
positions
);
if
(
!
mtv
.
importMesh
(
filename
,
kind
))
if
(
!
mtv
.
importMesh
(
filename
,
attrNames
,
kind
))
return
false
;
return
importMesh
<
PFP
>
(
map
,
mtv
);
...
...
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