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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KennethVanhoey
CGoGN
Commits
c21de25f
Commit
c21de25f
authored
Apr 26, 2011
by
untereiner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Derniere changements
parent
67ac3d0d
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1373 additions
and
127 deletions
+1373
-127
Apps/Examples/miniTest.cpp
Apps/Examples/miniTest.cpp
+5
-0
Apps/Tuto/tuto5.cpp
Apps/Tuto/tuto5.cpp
+18
-1
include/Algo/Export/exportPov.h
include/Algo/Export/exportPov.h
+3
-3
include/Algo/ImplicitHierarchicalMesh/ihm3.h
include/Algo/ImplicitHierarchicalMesh/ihm3.h
+60
-0
include/Algo/ImplicitHierarchicalMesh/ihm3.hpp
include/Algo/ImplicitHierarchicalMesh/ihm3.hpp
+228
-36
include/Algo/ImplicitHierarchicalMesh/subdivision3.h
include/Algo/ImplicitHierarchicalMesh/subdivision3.h
+19
-2
include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp
include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp
+920
-83
include/Algo/Import/import.h
include/Algo/Import/import.h
+5
-1
include/Algo/Import/importInESS.hpp
include/Algo/Import/importInESS.hpp
+96
-1
include/Algo/Render/vbo_MapRender.hpp
include/Algo/Render/vbo_MapRender.hpp
+3
-0
include/Topology/generic/embeddedMap3.hpp
include/Topology/generic/embeddedMap3.hpp
+1
-0
include/Topology/generic/mapBrowser.h
include/Topology/generic/mapBrowser.h
+8
-0
src/Algo/ImplicitHierarchicalMesh/ihm3.cpp
src/Algo/ImplicitHierarchicalMesh/ihm3.cpp
+7
-0
No files found.
Apps/Examples/miniTest.cpp
View file @
c21de25f
...
...
@@ -639,6 +639,11 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
Algo::Export::exportOFF<PFP>(myMap, position, "export.off") ;
break ;
}
case 'n':
{
myMap.saveMapBin("plop");
}
}
}
...
...
Apps/Tuto/tuto5.cpp
View file @
c21de25f
...
...
@@ -437,6 +437,23 @@ int main(int argc, char **argv)
// Algo::Import::importInESS<PFP>(myMap, argv[1], attrNames);
// position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, attrNames[0]) ;
if
(
argc
==
3
)
{
std
::
cout
<<
argv
[
2
]
<<
std
::
endl
;
std
::
vector
<
std
::
string
>
attrNames
;
if
(
!
Algo
::
Import
::
importMesh
<
PFP
>
(
myMap
,
argv
[
2
],
attrNames
))
{
std
::
cerr
<<
"could not import "
<<
std
::
endl
;
return
1
;
}
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
attrNames
[
0
])
;
// std::cout << argv[2] << std::endl;
// myMap.loadMapXml(argv[2]);
dglobal
=
myMap
.
begin
();
}
else
{
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"position"
);
...
...
@@ -446,7 +463,7 @@ int main(int argc, char **argv)
nb
=
atoi
(
argv
[
1
]);
dglobal
=
prim
.
hexaGrid_topo
(
nb
,
nb
,
nb
);
prim
.
embedHexaGrid
(
1.0
f
,
1.0
f
,
1.0
f
);
}
// Geom::Matrix44f mat;
// mat.identity();
...
...
include/Algo/Export/exportPov.h
View file @
c21de25f
...
...
@@ -146,8 +146,8 @@ bool exportScenePov(typename PFP::MAP& map, typename PFP::TVEC3& position, const
out
<<
"object {myMesh"
<<
std
::
endl
;
out
<<
"translate <"
<<
translate
[
0
]
<<
","
<<
translate
[
1
]
<<
","
<<
translate
[
2
]
<<
">"
<<
std
::
endl
;
out
<<
"rotate <"
<<
angleX
<<
","
<<
angleY
<<
","
<<
angleZ
<<
"> "
<<
std
::
endl
;
out
<<
"texture{ pigment{ color rgb<1.0,1.0,1>} finish { ambient rgb 0.05 brilliance 0.5 } } }"
<<
std
::
endl
;
out
<<
"texture{ pigment{ color rgb<1.0,1.0,1
,0.7
>} finish { ambient rgb 0.05 brilliance 0.5 } } }"
<<
std
::
endl
;
//rajouter f avec coeff
out
.
close
();
return
true
;
}
...
...
@@ -158,4 +158,4 @@ bool exportScenePov(typename PFP::MAP& map, typename PFP::TVEC3& position, const
}
#endif
\ No newline at end of file
#endif
include/Algo/ImplicitHierarchicalMesh/ihm3.h
View file @
c21de25f
...
...
@@ -37,8 +37,11 @@ namespace Algo
namespace
IHM
{
template
<
typename
T
>
class
AttributeHandler_IHM
;
class
ImplicitHierarchicalMap3
:
public
EmbeddedMap3
<
Map3
>
{
template
<
typename
T
>
friend
class
AttributeHandler_IHM
;
public:
unsigned
int
m_curLevel
;
...
...
@@ -59,6 +62,17 @@ public:
void
init
()
;
/***************************************************
* ATTRIBUTES MANAGEMENT *
***************************************************/
template
<
typename
T
>
AttributeHandler_IHM
<
T
>
addAttribute
(
unsigned
int
orbit
,
const
std
::
string
&
nameAttr
)
;
template
<
typename
T
>
AttributeHandler_IHM
<
T
>
getAttribute
(
unsigned
int
orbit
,
const
std
::
string
&
nameAttr
)
;
/***************************************************
* MAP TRAVERSAL *
***************************************************/
...
...
@@ -103,6 +117,16 @@ public:
virtual
bool
foreach_dart_of_cc
(
Dart
d
,
FunctorType
&
f
)
;
/****************************************************
* EMBEDDED FUNCTIONS *
****************************************************/
// virtual void cutEdge(Dart d);
//
// virtual void splitFace(Dart d, Dart e);
//
// virtual void sewVolumes(Dart d, Dart e);
/***************************************************
* LEVELS MANAGEMENT *
***************************************************/
...
...
@@ -222,6 +246,42 @@ public:
bool
volumeIsSubdivided
(
Dart
d
);
}
;
template
<
typename
T
>
class
AttributeHandler_IHM
:
public
AttributeHandler
<
T
>
{
public:
typedef
T
DATA_TYPE
;
AttributeHandler_IHM
()
:
AttributeHandler
<
T
>
()
{}
AttributeHandler_IHM
(
GenericMap
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
AttributeHandler
<
T
>
(
m
,
amv
)
{}
AttributeMultiVector
<
T
>*
getDataVector
()
const
{
return
AttributeHandler
<
T
>::
getDataVector
()
;
}
bool
isValid
()
const
{
return
AttributeHandler
<
T
>::
isValid
()
;
}
T
&
operator
[](
Dart
d
)
;
const
T
&
operator
[](
Dart
d
)
const
;
T
&
operator
[](
unsigned
int
a
)
{
return
AttributeHandler
<
T
>::
operator
[](
a
)
;
}
const
T
&
operator
[](
unsigned
int
a
)
const
{
return
AttributeHandler
<
T
>::
operator
[](
a
)
;
}
}
;
}
//namespace IHM
...
...
include/Algo/ImplicitHierarchicalMesh/ihm3.hpp
View file @
c21de25f
...
...
@@ -31,6 +31,38 @@ namespace Algo
namespace
IHM
{
/***************************************************
* ATTRIBUTES MANAGEMENT *
***************************************************/
template
<
typename
T
>
AttributeHandler_IHM
<
T
>
ImplicitHierarchicalMap3
::
addAttribute
(
unsigned
int
orbit
,
const
std
::
string
&
nameAttr
)
{
bool
addNextLevelCell
=
false
;
if
(
!
isOrbitEmbedded
(
orbit
))
addNextLevelCell
=
true
;
AttributeHandler
<
T
>
h
=
Map3
::
addAttribute
<
T
>
(
orbit
,
nameAttr
)
;
if
(
addNextLevelCell
)
{
AttributeContainer
&
cellCont
=
m_attribs
[
orbit
]
;
AttributeMultiVector
<
unsigned
int
>*
amv
=
cellCont
.
addAttribute
<
unsigned
int
>
(
"nextLevelCell"
)
;
m_nextLevelCell
[
orbit
]
=
amv
;
for
(
unsigned
int
i
=
cellCont
.
begin
();
i
<
cellCont
.
end
();
cellCont
.
next
(
i
))
amv
->
operator
[](
i
)
=
EMBNULL
;
}
return
AttributeHandler_IHM
<
T
>
(
this
,
h
.
getDataVector
())
;
}
template
<
typename
T
>
AttributeHandler_IHM
<
T
>
ImplicitHierarchicalMap3
::
getAttribute
(
unsigned
int
orbit
,
const
std
::
string
&
nameAttr
)
{
AttributeHandler
<
T
>
h
=
Map2
::
getAttribute
<
T
>
(
orbit
,
nameAttr
)
;
return
AttributeHandler_IHM
<
T
>
(
this
,
h
.
getDataVector
())
;
}
/***************************************************
* MAP TRAVERSAL *
***************************************************/
...
...
@@ -51,8 +83,10 @@ inline Dart ImplicitHierarchicalMap3::phi1(Dart d)
unsigned
int
edgeId
=
m_edgeId
[
d
]
;
Dart
it
=
d
;
do
{
it
=
Map3
::
phi1
(
it
)
;
if
(
m_dartLevel
[
it
]
<=
m_curLevel
)
finished
=
true
;
...
...
@@ -60,6 +94,7 @@ inline Dart ImplicitHierarchicalMap3::phi1(Dart d)
{
while
(
m_edgeId
[
it
]
!=
edgeId
)
it
=
Map3
::
phi1
(
phi2bis
(
it
));
}
}
while
(
!
finished
)
;
...
...
@@ -81,7 +116,7 @@ inline Dart ImplicitHierarchicalMap3::phi_1(Dart d)
{
it
=
Map3
::
phi_1
(
it
)
;
while
(
m_edgeId
[
it
]
!=
edgeId
)
it
=
Map3
::
phi_1
(
phi2bis
(
it
))
;
it
=
Map3
::
phi_1
(
phi2bis
(
it
));
}
}
while
(
!
finished
)
;
...
...
@@ -92,16 +127,19 @@ inline Dart ImplicitHierarchicalMap3::phi_1(Dart d)
inline
Dart
ImplicitHierarchicalMap3
::
phi2bis
(
Dart
d
)
{
unsigned
int
faceId
=
m_faceId
[
d
];
Dart
it
=
d
;
it
=
Map3
::
phi2
(
it
)
;
if
(
m_faceId
[
it
]
==
faceId
)
return
it
;
else
{
while
(
m_faceId
[
it
]
!=
faceId
)
do
{
it
=
Map3
::
phi2
(
Map3
::
phi3
(
it
));
}
while
(
m_faceId
[
it
]
!=
faceId
);
return
it
;
}
...
...
@@ -138,45 +176,45 @@ inline Dart ImplicitHierarchicalMap3::alpha1(Dart d)
inline
Dart
ImplicitHierarchicalMap3
::
alpha2
(
Dart
d
)
{
// assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
//
// Dart e = phi2(d);
// Dart f = phi3(e);
//
// if (f != e)
// return f;
//
// f = d;
// e = phi3(f);
// while (e != f)
// {
// f = phi2(e);
// e = phi3(f);
// }
// return f;
assert
(
m_dartLevel
[
d
]
<=
m_curLevel
||
!
"Access to a dart introduced after current level"
)
;
Dart
e
=
phi2
(
d
);
Dart
f
=
phi3
(
e
);
if
(
f
!=
e
)
return
f
;
return
Map3
::
alpha2
(
d
);
f
=
d
;
e
=
phi3
(
f
);
while
(
e
!=
f
)
{
f
=
phi2
(
e
);
e
=
phi3
(
f
);
}
return
f
;
//return Map3::alpha2(d);
}
inline
Dart
ImplicitHierarchicalMap3
::
alpha_2
(
Dart
d
)
{
//
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
//
//
Dart e = phi3(d);
//
//
if (e != d)
//
return phi2(e);
//
//
e = d;
//
Dart f = phi2(d);
//
while (phi3(f) != f)
//
{
//
e = phi3(f);
//
f = phi2(e);
//
}
//
return e;
assert
(
m_dartLevel
[
d
]
<=
m_curLevel
||
!
"Access to a dart introduced after current level"
)
;
Dart
e
=
phi3
(
d
);
if
(
e
!=
d
)
return
phi2
(
e
);
e
=
d
;
Dart
f
=
phi2
(
d
);
while
(
phi3
(
f
)
!=
f
)
{
e
=
phi3
(
f
);
f
=
phi2
(
e
);
}
return
e
;
return
Map3
::
alpha_2
(
d
);
//
return Map3::alpha_2(d);
}
inline
Dart
ImplicitHierarchicalMap3
::
begin
()
...
...
@@ -325,6 +363,99 @@ inline bool ImplicitHierarchicalMap3::foreach_dart_of_cc(Dart d, FunctorType& f)
return
foreach_dart_of_oriented_volume
(
d
,
f
)
;
}
/**************************************************
* EMBEDDED FUNCTIONS *
**************************************************/
//void ImplicitHierarchicalMap3::cutEdge(Dart d)
//{
// Dart dd = phi2(d) ;
// EmbeddedMap3<Map3>::cutEdge(d);
//
// //
// //mise a jour de l'id d'arrete sur chaque moitie d'arete
// //
// unsigned int eId;
//
// //Test si id existe
// if(m_edgeId[d] == EMBNULL)
// {
// eId = getNewEdgeId();
// }
// else
// {
// eId = getEdgeId(d) ;
// }
//
// //tour de la 1ere moitie de l'arete avec modification
// Dart e = d;
// do
// {
// m_edgeId[e] = eId; //cas ou l'arete n'est pas du tout plonge
// m_edgeId[Map3::phi2(e)] = eId;
//
// e = Map3::alpha2(e);
// } while(e != d);
//
//
// e = dd;
// do
// {
// m_edgeId[e] = eId;
// m_edgeId[Map3::phi2(e)] = eId;
//
// e = Map3::alpha2(e);
// } while(e != dd);
//
//
// //
// //mise a jour de l'id de face sur chaque brin de chaque moitie d'arete
// //
//
//}
//
//void ImplicitHierarchicalMap3::splitFace(Dart d, Dart e)
//{
// //
// //Verification que les brins precedents ceux que l'on split n'ont pas le meme id
// //
// if(m_edgeId[d] == m_edgeId[Map3::phi_1(d)])
// {
// unsigned int eId = getNewEdgeId() ;
//
// Dart e = d;
// do
// {
// m_edgeId[e] = eId; //cas ou l'arete n'est pas du tout plonge
// m_edgeId[Map3::phi2(e)] = eId;
//
// e = Map3::alpha2(e);
// } while(e != d);
// }
//
// EmbeddedMap3<Map3>::splitFace(d,e);
//
// //
// //creation d'un id d'arete sur la nouvelle arete
// //
//
// unsigned int eId = getNewEdgeId() ;
// Dart a =Map3:: phi_1(d);
//
// do
// {
// m_edgeId[a] = eId;
// m_edgeId[Map3::phi2(a)] = eId;
//
// a = Map3::alpha2(a);
// } while(a != Map3::phi_1(d));
//
//}
//
//void ImplicitHierarchicalMap3::sewVolumes(Dart d, Dart e)
//{
//
//}
/***************************************************
* LEVELS MANAGEMENT *
***************************************************/
...
...
@@ -484,6 +615,67 @@ inline unsigned int ImplicitHierarchicalMap3::edgeLevel(Dart d)
return
r
;
}
/***************************************************
* ATTRIBUTE HANDLER *
***************************************************/
template
<
typename
T
>
T
&
AttributeHandler_IHM
<
T
>::
operator
[](
Dart
d
)
{
ImplicitHierarchicalMap3
*
m
=
reinterpret_cast
<
ImplicitHierarchicalMap3
*>
(
this
->
m_map
)
;
assert
(
m
->
m_dartLevel
[
d
]
<=
m
->
m_curLevel
||
!
"Access to a dart introduced after current level"
)
;
assert
(
m
->
vertexInsertionLevel
(
d
)
<=
m
->
m_curLevel
||
!
"Access to the embedding of a vertex inserted after current level"
)
;
unsigned
int
orbit
=
this
->
getOrbit
()
;
unsigned
int
nbSteps
=
m
->
m_curLevel
-
m
->
vertexInsertionLevel
(
d
)
;
unsigned
int
index
=
m
->
getEmbedding
(
d
,
orbit
)
;
if
(
index
==
EMBNULL
)
{
index
=
m
->
embedNewCell
(
orbit
,
d
)
;
m
->
m_nextLevelCell
[
orbit
]
->
operator
[](
index
)
=
EMBNULL
;
}
AttributeContainer
&
cont
=
m
->
getAttributeContainer
(
orbit
)
;
unsigned
int
step
=
0
;
while
(
step
<
nbSteps
)
{
step
++
;
unsigned
int
nextIdx
=
m
->
m_nextLevelCell
[
orbit
]
->
operator
[](
index
)
;
if
(
nextIdx
==
EMBNULL
)
{
nextIdx
=
m
->
newCell
(
orbit
)
;
m
->
copyCell
(
orbit
,
nextIdx
,
index
)
;
m
->
m_nextLevelCell
[
orbit
]
->
operator
[](
index
)
=
nextIdx
;
m
->
m_nextLevelCell
[
orbit
]
->
operator
[](
nextIdx
)
=
EMBNULL
;
cont
.
refLine
(
index
)
;
}
index
=
nextIdx
;
}
return
this
->
m_attrib
->
operator
[](
index
);
}
template
<
typename
T
>
const
T
&
AttributeHandler_IHM
<
T
>::
operator
[](
Dart
d
)
const
{
ImplicitHierarchicalMap3
*
m
=
reinterpret_cast
<
ImplicitHierarchicalMap3
*>
(
this
->
m_map
)
;
assert
(
m
->
m_dartLevel
[
d
]
<=
m
->
m_curLevel
||
!
"Access to a dart introduced after current level"
)
;
assert
(
m
->
vertexInsertionLevel
(
d
)
<=
m
->
m_curLevel
||
!
"Access to the embedding of a vertex inserted after current level"
)
;
unsigned
int
orbit
=
this
->
getOrbit
()
;
unsigned
int
nbSteps
=
m
->
m_curLevel
-
m
->
vertexInsertionLevel
(
d
)
;
unsigned
int
index
=
m
->
getEmbedding
(
d
,
orbit
)
;
unsigned
int
step
=
0
;
while
(
step
<
nbSteps
)
{
step
++
;
unsigned
int
next
=
m
->
m_nextLevelCell
[
orbit
]
->
operator
[](
index
)
;
if
(
next
!=
EMBNULL
)
index
=
next
;
else
break
;
}
return
this
->
m_attrib
->
operator
[](
index
);
}
}
//namespace IHM
...
...
include/Algo/ImplicitHierarchicalMesh/subdivision3.h
View file @
c21de25f
...
...
@@ -48,9 +48,19 @@ template <typename PFP>
void
subdivideFace
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
,
SubdivideType
sType
=
S_QUAD
);
template
<
typename
PFP
>
void
subdivideVolume
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
,
SubdivideType
sType
=
S_QUAD
);
void
subdivideVolume
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
template
<
typename
PFP
>
void
subdivideLoop
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
/*******************************************************
*
*/
template
<
typename
PFP
>
void
subdivideVolume
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
,
SubdivideType
sType
);
template
<
typename
PFP
>
Dart
subdivideFaceTri
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
...
...
@@ -59,7 +69,14 @@ template <typename PFP>
void
subdivideVolumeTri
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
template
<
typename
PFP
>
void
catmullClarck
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
void
macCrackenJoy
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
template
<
typename
PFP
>
void
bajaj
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
template
<
typename
PFP
>
typename
PFP
::
VEC3
bajajMask
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
}
//namespace IHM
...
...
include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp
View file @
c21de25f
This diff is collapsed.
Click to expand it.
include/Algo/Import/import.h
View file @
c21de25f
...
...
@@ -72,7 +72,11 @@ template <typename PFP>
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
);
bool
importInESSSurfacique
(
typename
PFP
::
MAP
&
the_map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
);
template
<
typename
PFP
>
bool
importInESSVolumique
(
typename
PFP
::
MAP
&
the_map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
);
}
// namespace Import
...
...
include/Algo/Import/importInESS.hpp
View file @
c21de25f
...
...
@@ -73,7 +73,7 @@ unsigned int gcd(unsigned int a, unsigned int b)
}
template
<
typename
PFP
>
bool
importInESS
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
)
bool
importInESS
Surfacique
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
...
...
@@ -455,6 +455,101 @@ bool importInESS(typename PFP::MAP& map, const std::string& filename, std::vecto
return
true
;
}
template
<
typename
PFP
>
bool
importInESSVolumique
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
AttributeHandler
<
VEC3
>
position
=
map
.
template
addAttribute
<
VEC3
>(
VERTEX_ORBIT
,
"position"
)
;
attrNames
.
push_back
(
position
.
name
())
;
AttributeHandler
<
int
>
objects
=
map
.
template
addAttribute
<
int
>(
FACE_ORBIT
,
"objects"
)
;
attrNames
.
push_back
(
objects
.
name
())
;
//stocker les boundingbox contenu dans le fichier
std
::
vector
<
std
::
pair
<
VEC3
,
VEC3
>
>
coordonnees
;
//tableau de paires (x,y)
coordonnees
.
reserve
(
50
);
//classer les coordonnees en x
std
::
multimap
<
int
,
unsigned
int
>
coordonneesX
;
//classer les coordonnees en y
std
::
multimap
<
int
,
unsigned
int
>
coordonneesY
;
std
::
set
<
int
>
sx
;
std
::
set
<
int
>
sy
;
// open file
std
::
ifstream
fp
(
filename
.
c_str
(),
std
::
ios
::
in
);
if
(
!
fp
.
good
())
{
std
::
cerr
<<
"Unable to open file "
<<
filename
<<
std
::
endl
;
return
false
;
}
//
// Lecture du fichier
//
std
::
string
line
;
size_t
posData
,
posCoord
;
std
::
string
bg
;
unsigned
int
size
=
0
;
//two columns cutted
std
::
getline
(
fp
,
line
);
posData
=
line
.
find
(
"
\t
"
);
// First column
//Bounding box : first coord & second coord
bg
=
line
.
substr
(
0
,
posData
);
posCoord
=
bg
.
find
(
") ("
);
VEC3
c1
=
stringToEmb
<
PFP
>
(
bg
.
substr
(
0
,
posCoord
));
VEC3
c2
=
stringToEmb
<
PFP
>
(
bg
.
substr
(
posCoord
+
3
));
std
::
cout
<<
std
::
endl
;
//coordonnees.push_back(std::pair<VEC3,VEC3>(c1,c2));
// coordonneesX.insert(std::pair<int, unsigned int >(c1[0],size));
// coordonneesY.insert(std::pair<int, unsigned int >(c1[1],size));
sx
.
insert
(
c1
[
0
]);
sx
.
insert
(
c2
[
0
]);
sy
.
insert
(
c1
[
1
]);
sy
.
insert
(
c2
[
1
]);
size
++
;
while
(
std
::
getline
(
fp
,
line
)
)
{
posData
=
line
.
find
(
"
\t
"
);
// First column
//Bounding box : first coord & second coord
bg
=
line
.
substr
(
0
,
posData
);
posCoord
=
bg
.
find
(
") ("
);
VEC3
c1
=
stringToEmb
<
PFP
>
(
bg
.
substr
(
0
,
posCoord
));
VEC3
c2
=
stringToEmb
<
PFP
>
(
bg
.
substr
(
posCoord
+
3
));
std
::
cout
<<
std
::
endl
;
coordonnees
.
push_back
(
std
::
pair
<
VEC3
,
VEC3
>
(
c1
,
c2
));