Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
David Cazier
CGoGN
Commits
6a57cabf
Commit
6a57cabf
authored
Jun 06, 2012
by
untereiner
Browse files
Options
Browse Files
Download
Plain Diff
Merge cgogn:~jund/CGoGN
parents
c6ae9bb5
b70ccab9
Changes
45
Hide whitespace changes
Inline
Side-by-side
Showing
45 changed files
with
964 additions
and
424 deletions
+964
-424
Apps/Examples/simpleGMap3.cpp
Apps/Examples/simpleGMap3.cpp
+27
-18
Apps/Examples/simpleGMap3.h
Apps/Examples/simpleGMap3.h
+2
-0
Apps/Examples/volumeExplorer.h
Apps/Examples/volumeExplorer.h
+1
-1
Apps/deprecated/polyhedronsView.cpp
Apps/deprecated/polyhedronsView.cpp
+4
-4
README.TXT
README.TXT
+1
-1
include/Algo/Export/export.h
include/Algo/Export/export.h
+9
-0
include/Algo/Export/export.hpp
include/Algo/Export/export.hpp
+66
-0
include/Algo/Export/exportPov.h
include/Algo/Export/exportPov.h
+20
-47
include/Algo/Geometry/normal.hpp
include/Algo/Geometry/normal.hpp
+2
-2
include/Algo/Geometry/volume.hpp
include/Algo/Geometry/volume.hpp
+1
-1
include/Algo/Import/import.h
include/Algo/Import/import.h
+10
-13
include/Algo/Import/import2tables.h
include/Algo/Import/import2tables.h
+1
-2
include/Algo/Import/import2tablesVolume.hpp
include/Algo/Import/import2tablesVolume.hpp
+9
-1
include/Algo/Import/importMesh.hpp
include/Algo/Import/importMesh.hpp
+110
-2
include/Algo/Import/importMoka.hpp
include/Algo/Import/importMoka.hpp
+1
-1
include/Algo/Import/importTet.hpp
include/Algo/Import/importTet.hpp
+4
-5
include/Algo/Modelisation/polyhedron.h
include/Algo/Modelisation/polyhedron.h
+2
-3
include/Algo/Modelisation/primitives3d.h
include/Algo/Modelisation/primitives3d.h
+0
-2
include/Algo/Modelisation/primitives3d.hpp
include/Algo/Modelisation/primitives3d.hpp
+4
-34
include/Algo/Modelisation/subdivision.hpp
include/Algo/Modelisation/subdivision.hpp
+1
-1
include/Algo/Modelisation/subdivision3.h
include/Algo/Modelisation/subdivision3.h
+32
-0
include/Algo/Modelisation/subdivision3.hpp
include/Algo/Modelisation/subdivision3.hpp
+351
-189
include/Algo/Modelisation/tetrahedralization.h
include/Algo/Modelisation/tetrahedralization.h
+7
-1
include/Algo/Modelisation/tetrahedralization.hpp
include/Algo/Modelisation/tetrahedralization.hpp
+49
-11
include/Algo/Modelisation/triangulation.hpp
include/Algo/Modelisation/triangulation.hpp
+0
-1
include/Algo/Render/GL2/mapRender.hpp
include/Algo/Render/GL2/mapRender.hpp
+2
-2
include/Geometry/intersection.h
include/Geometry/intersection.h
+14
-3
include/Geometry/intersection.hpp
include/Geometry/intersection.hpp
+16
-8
include/Topology/generic/functor.h
include/Topology/generic/functor.h
+0
-1
include/Topology/generic/traversor3.h
include/Topology/generic/traversor3.h
+0
-1
include/Topology/generic/traversor3.hpp
include/Topology/generic/traversor3.hpp
+1
-1
include/Topology/gmap/gmap1.h
include/Topology/gmap/gmap1.h
+10
-10
include/Topology/gmap/gmap1.hpp
include/Topology/gmap/gmap1.hpp
+11
-11
include/Topology/gmap/gmap2.h
include/Topology/gmap/gmap2.h
+17
-10
include/Topology/gmap/gmap2.hpp
include/Topology/gmap/gmap2.hpp
+3
-3
include/Topology/gmap/gmap3.h
include/Topology/gmap/gmap3.h
+31
-7
include/Topology/map/embeddedMap3.h
include/Topology/map/embeddedMap3.h
+5
-0
include/Topology/map/map3.h
include/Topology/map/map3.h
+9
-1
src/Container/attributeContainer.cpp
src/Container/attributeContainer.cpp
+1
-1
src/Topology/gmap/embeddedGMap3.cpp
src/Topology/gmap/embeddedGMap3.cpp
+12
-3
src/Topology/gmap/gmap1.cpp
src/Topology/gmap/gmap1.cpp
+7
-3
src/Topology/gmap/gmap2.cpp
src/Topology/gmap/gmap2.cpp
+29
-15
src/Topology/gmap/gmap3.cpp
src/Topology/gmap/gmap3.cpp
+33
-4
src/Topology/map/embeddedMap3.cpp
src/Topology/map/embeddedMap3.cpp
+22
-0
src/Topology/map/map3.cpp
src/Topology/map/map3.cpp
+27
-0
No files found.
Apps/Examples/simpleGMap3.cpp
View file @
6a57cabf
...
...
@@ -34,27 +34,31 @@ SimpleGMap3::SimpleGMap3()
normal
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"normal"
);
volume
=
myMap
.
addAttribute
<
VEC3
,
VOLUME
>
(
"volume"
);
CellMarker
<
EDGE
>
mE
(
myMap
);
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Dart
d
=
primCat
.
hexaGrid_topo
(
3
,
1
,
1
);
primCat
.
embedHexaGrid
(
2
,
1
,
1
);
std
::
cout
<<
"AAA"
<<
std
::
endl
;
myMap
.
check
();
std
::
cout
<<
"AAA"
<<
std
::
endl
;
DartMarker
markOrient
(
myMap
);
std
::
vector
<
Dart
>
orient
;
FunctorStore
fs
(
orient
);
// DartMarker markOrient(myMap);
// std::vector<Dart> orient;
// FunctorStore fs(orient);
d
=
49
;
myMap
.
foreach_dart_of_oriented_volume
(
d
,
fs
);
// d = 49;
// myMap.foreach_dart_of_oriented_volume(d, fs);
// for(std::vector<Dart>::iterator it = orient.begin() ; it != orient.end() ; ++it)
// markOrient.mark(*it);
std
::
cout
<<
"AAA"
<<
std
::
endl
;
// SelectorMarked sm(markOrient);
// std::cout << "AAA"<< std::endl;
// Algo::Modelisation::catmullClarkVol<PFP,PFP::TVEC3,PFP::VEC3>(myMap, position, sm);
for
(
std
::
vector
<
Dart
>::
iterator
it
=
orient
.
begin
()
;
it
!=
orient
.
end
()
;
++
it
)
markOrient
.
mark
(
*
it
);
// Geom::Plane3D<PFP::REAL> pl(VEC3(0.5,0.14,0.5),VEC3(1.5,0.45,0.5),VEC3(0.5,0.15,1.5));
Geom
::
Plane3D
<
PFP
::
REAL
>
pl
(
VEC3
(
-
1
,
-
0.5
,
-
0.5
),
VEC3
(
-
1
,
-
0.5
,
0.5
),
VEC3
(
1
,
0.5
,
0.5
));
Algo
::
Modelisation
::
sliceConvexVolume
<
PFP
>
(
myMap
,
position
,
d
,
pl
);
SelectorMarked
sm
(
markOrient
);
std
::
cout
<<
"AAA"
<<
std
::
endl
;
//Algo::Modelisation::catmullClarkVol<PFP,PFP::TVEC3,PFP::VEC3>(myMap, position, sm);
myMap
.
check
();
for
(
unsigned
int
i
=
position
.
begin
()
;
i
!=
position
.
end
()
;
position
.
next
(
i
))
position
[
i
]
+=
VEC3
(
2
,
0
,
0
);
...
...
@@ -77,6 +81,10 @@ SimpleGMap3::SimpleGMap3()
myMap
.
cutEdge
(
d
);
position
[
myMap
.
phi1
(
d
)]
=
mid
;
myMap
.
splitFace
(
d
,
myMap
.
phi1
(
myMap
.
phi1
(
myMap
.
phi1
(
d
))));
myMap
.
check
();
for
(
unsigned
int
i
=
position
.
begin
()
;
i
!=
position
.
end
()
;
position
.
next
(
i
))
position
[
i
]
+=
VEC3
(
0
,
2
,
0
);
...
...
@@ -112,12 +120,13 @@ void SimpleGMap3::cb_redraw()
glDisable
(
GL_LIGHTING
);
glLineWidth
(
1.0
f
);
Algo
::
Render
::
GL1
::
renderTopoGMD3
<
PFP
>
(
myMap
,
position
,
true
,
true
,
true
,
true
,
0.9
f
,
0.9
f
,
0.9
f
,
0.9
f
);
// Algo::Render::GL1::renderTopoMD3<PFP>(myMap, position, true, true, true, 0.9f, 0.9f, 0.9f);
glDisable
(
GL_LIGHTING
);
glColor3f
(
1.0
f
,
1.0
f
,
1.0
f
);
glLineWidth
(
1.0
f
);
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_LINE
);
Algo
::
Render
::
GL1
::
renderTriQuadPoly
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL1
::
LINE
,
1.0
,
position
,
normal
);
//
glDisable(GL_LIGHTING);
//
glColor3f(1.0f, 1.0f, 1.0f);
//
glLineWidth(1.0f);
//
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
//
Algo::Render::GL1::renderTriQuadPoly<PFP>(myMap, Algo::Render::GL1::LINE, 1.0,position, normal);
}
/**********************************************************************************************
...
...
Apps/Examples/simpleGMap3.h
View file @
6a57cabf
...
...
@@ -28,6 +28,7 @@
#include "Topology/generic/parameters.h"
#include "Topology/gmap/embeddedGMap3.h"
//#include "Topology/map/embeddedMap3.h"
#include "Geometry/vector_gen.h"
...
...
@@ -40,6 +41,7 @@ struct PFP: public PFP_STANDARD
{
// definition of the map
typedef
EmbeddedGMap3
MAP
;
// typedef EmbeddedMap3 MAP ;
};
typedef
PFP
::
MAP
MAP
;
...
...
Apps/Examples/volumeExplorer.h
View file @
6a57cabf
...
...
@@ -27,7 +27,7 @@
#include <iostream>
#define WITH_GMAP 1
//
#define WITH_GMAP 1
#include "Topology/generic/parameters.h"
#ifdef WITH_GMAP
...
...
Apps/deprecated/polyhedronsView.cpp
View file @
6a57cabf
...
...
@@ -129,15 +129,15 @@ int main(int argc, char **argv)
prim3
.
transform
(
trf
);
// create a subdivided cube
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
prim4
(
myMap
,
position
);
prim4
.
cube_topo
(
4
,
5
,
6
);
prim4
.
embedCube
(
50.0
f
,
50.0
f
,
50.0
f
);
//
Algo::Modelisation::Polyhedron<PFP> prim4(myMap, position);
//
prim4.cube_topo(4, 5, 6);
//
prim4.embedCube(50.0f,50.0f, 50.0f);
//transform
trf
.
identity
();
Geom
::
rotate
<
float
>
(
1.0
f
,
1.0
f
,
1.0
f
,
0.4
f
,
trf
);
Geom
::
translate
<
float
>
(
270.0
f
,
0.0
,
0.0
,
trf
);
prim4
.
transform
(
trf
);
//
prim4.transform(trf);
// bounding box
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
);
...
...
README.TXT
View file @
6a57cabf
...
...
@@ -3,7 +3,7 @@ installer les paquets suivants:
cmake libXi-dev libXmu-dev libglew-dev libxml2-dev libboost-all-dev zlib1g-dev qt4-designer qt4-dev-tools uuid-dev
Pour compiler CGoGN:
- aller dans ThirdParty, cd build, taper "cmake
.
.", puis make ( avec -j x si vous avez x core sur votre machine)
- aller dans ThirdParty, cd build, taper "cmake .", puis make ( avec -j x si vous avez x core sur votre machine)
On peut fixer certaines option pour ne pas tout compiler (cf le README.TXT dans ThirdParty)
On peut aussi compiler en debug en créant un répertoir qui fini par Debug à la place de build
...
...
include/Algo/Export/export.h
View file @
6a57cabf
...
...
@@ -68,6 +68,15 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector<VertexAttribute<type
template
<
typename
PFP
>
bool
exportOFF
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
char
*
filename
,
const
FunctorSelect
&
good
=
allDarts
)
;
/**
* export the map into a OBJ file
* @param the_map map to be exported
* @param filename filename of obj file
* @return true
*/
template
<
typename
PFP
>
bool
exportOBJ
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
char
*
filename
,
const
FunctorSelect
&
good
=
allDarts
)
;
/**
* export the map into a Trian file
* @param the_map map to be exported
...
...
include/Algo/Export/export.hpp
View file @
6a57cabf
...
...
@@ -386,6 +386,72 @@ bool exportOFF(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>
return
true
;
}
template
<
typename
PFP
>
bool
exportOBJ
(
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
;
}
unsigned
int
nbDarts
=
map
.
getNbDarts
()
;
std
::
vector
<
unsigned
int
>
facesSize
;
std
::
vector
<
std
::
vector
<
unsigned
int
>
>
facesIdx
;
facesSize
.
reserve
(
nbDarts
/
3
)
;
facesIdx
.
reserve
(
nbDarts
/
3
)
;
std
::
map
<
unsigned
int
,
unsigned
int
>
vIndex
;
unsigned
int
vCpt
=
0
;
std
::
vector
<
unsigned
int
>
vertices
;
vertices
.
reserve
(
nbDarts
/
6
)
;
CellMarker
<
VERTEX
>
markV
(
map
)
;
TraversorF
<
MAP
>
t
(
map
,
good
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
{
std
::
vector
<
unsigned
int
>
fidx
;
fidx
.
reserve
(
8
)
;
Traversor2FV
<
typename
PFP
::
MAP
>
tfv
(
map
,
d
)
;
for
(
Dart
it
=
tfv
.
begin
();
it
!=
tfv
.
end
();
it
=
tfv
.
next
())
{
unsigned
int
vNum
=
map
.
getEmbedding
(
VERTEX
,
it
)
;
if
(
!
markV
.
isMarked
(
it
))
{
markV
.
mark
(
it
)
;
vIndex
[
vNum
]
=
vCpt
++
;
vertices
.
push_back
(
vNum
)
;
}
fidx
.
push_back
(
vIndex
[
vNum
]
+
1
)
;
}
facesIdx
.
push_back
(
fidx
)
;
}
out
<<
"#OBJ - Export from CGoGN"
<<
std
::
endl
;
for
(
unsigned
int
i
=
0
;
i
<
vertices
.
size
();
++
i
)
{
const
VEC3
&
v
=
position
[
vertices
[
i
]]
;
out
<<
"v "
<<
v
[
0
]
<<
" "
<<
v
[
1
]
<<
" "
<<
v
[
2
]
<<
std
::
endl
;
}
out
<<
std
::
endl
;
for
(
unsigned
int
i
=
0
;
i
<
facesIdx
.
size
();
++
i
)
{
out
<<
"f "
;
for
(
unsigned
int
j
=
0
;
j
<
facesIdx
[
i
].
size
();
++
j
)
out
<<
" "
<<
facesIdx
[
i
][
j
]
;
out
<<
std
::
endl
;
}
out
.
close
()
;
return
true
;
}
template
<
typename
PFP
>
bool
exportPlyPTMgeneric
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
char
*
filename
,
const
FunctorSelect
&
good
)
{
...
...
include/Algo/Export/exportPov.h
View file @
6a57cabf
...
...
@@ -15,13 +15,13 @@ namespace ExportPov
{
template
<
typename
PFP
>
void
exportTriangleWire
(
std
::
ofstream
&
out
,
typename
PFP
::
VEC3
&
p1
,
typename
PFP
::
VEC3
&
p2
,
typename
PFP
::
VEC3
&
p3
)
void
exportTriangleWire
(
std
::
ofstream
&
out
,
typename
PFP
::
VEC3
&
p1
,
typename
PFP
::
VEC3
&
p2
,
typename
PFP
::
VEC3
&
p3
,
float
width
)
{
out
<<
"cylinder { <"
<<
p1
[
0
]
<<
","
<<
p1
[
2
]
<<
","
<<
p1
[
1
]
<<
">, <"
<<
p2
[
0
]
<<
","
<<
p2
[
2
]
<<
","
<<
p2
[
1
]
<<
">,
0.5
}"
<<
std
::
endl
;
out
<<
"cylinder { <"
<<
p1
[
0
]
<<
","
<<
p1
[
1
]
<<
","
<<
p1
[
2
]
<<
">, <"
<<
p2
[
0
]
<<
","
<<
p2
[
1
]
<<
","
<<
p2
[
2
]
<<
">,
"
<<
width
<<
"
}"
<<
std
::
endl
;
out
<<
"cylinder { <"
<<
p1
[
0
]
<<
","
<<
p1
[
2
]
<<
","
<<
p1
[
1
]
<<
">, <"
<<
p3
[
0
]
<<
","
<<
p3
[
2
]
<<
","
<<
p3
[
1
]
<<
">,
0.5
}"
<<
std
::
endl
;
out
<<
"cylinder { <"
<<
p1
[
0
]
<<
","
<<
p1
[
1
]
<<
","
<<
p1
[
2
]
<<
">, <"
<<
p3
[
0
]
<<
","
<<
p3
[
1
]
<<
","
<<
p3
[
2
]
<<
">,
"
<<
width
<<
"
}"
<<
std
::
endl
;
out
<<
"cylinder { <"
<<
p3
[
0
]
<<
","
<<
p3
[
2
]
<<
","
<<
p3
[
1
]
<<
">, <"
<<
p2
[
0
]
<<
","
<<
p2
[
2
]
<<
","
<<
p2
[
1
]
<<
">,
0.5
}"
<<
std
::
endl
;
out
<<
"cylinder { <"
<<
p3
[
0
]
<<
","
<<
p3
[
1
]
<<
","
<<
p3
[
2
]
<<
">, <"
<<
p2
[
0
]
<<
","
<<
p2
[
1
]
<<
","
<<
p2
[
2
]
<<
">,
"
<<
width
<<
"
}"
<<
std
::
endl
;
}
template
<
typename
PFP
>
...
...
@@ -39,33 +39,26 @@ void exportMeshPlain(std::ofstream& out, typename PFP::MAP& map, VertexAttribute
{
out
<<
"#declare "
<<
meshName
<<
"= union {"
<<
std
::
endl
;
DartMarkerStore
tra
ite
(
map
);
TraversorF
<
typename
PFP
::
MAP
>
tra
vF
(
map
);
for
(
Dart
d
=
map
.
begin
()
;
d
!=
map
.
end
()
;
map
.
next
(
d
))
for
(
Dart
d
=
travF
.
begin
()
;
d
!=
travF
.
end
()
;
travF
.
next
(
d
))
{
if
(
good
(
d
)
&&
!
traite
.
isMarked
(
d
)
)
if
(
good
(
d
))
{
unsigned
int
nb
=
0
;
Dart
dd
=
d
;
do
{
traite
.
mark
(
dd
);
dd
=
map
.
phi1
(
dd
);
nb
++
;
}
while
(
dd
!=
d
);
unsigned
int
nb
=
map
.
faceDegree
(
d
);
if
(
nb
==
3
)
Algo
::
ExportPov
::
exportTrianglePlain
<
PFP
>
(
out
,
position
[
d
d
],
position
[
map
.
phi1
(
d
d
)],
position
[
map
.
phi1
(
map
.
phi1
(
d
d
))]);
Algo
::
ExportPov
::
exportTrianglePlain
<
PFP
>
(
out
,
position
[
d
],
position
[
map
.
phi1
(
d
)],
position
[
map
.
phi1
(
map
.
phi1
(
d
))]);
else
{
out
<<
"polygon{ "
<<
nb
+
1
<<
std
::
endl
;
dd
=
d
;
Dart
dd
=
d
;
do
{
out
<<
"<"
<<
position
[
dd
][
0
]
<<
","
<<
position
[
dd
][
2
]
<<
","
<<
position
[
dd
][
1
]
<<
">,"
<<
std
::
endl
;
out
<<
"<"
<<
position
[
dd
][
0
]
<<
","
<<
position
[
dd
][
1
]
<<
","
<<
position
[
dd
][
2
]
<<
">,"
<<
std
::
endl
;
dd
=
map
.
phi1
(
dd
);
}
while
(
dd
!=
d
);
out
<<
"<"
<<
position
[
d
][
0
]
<<
","
<<
position
[
d
][
2
]
<<
","
<<
position
[
d
][
1
]
<<
">"
<<
std
::
endl
;
out
<<
"<"
<<
position
[
d
][
0
]
<<
","
<<
position
[
d
][
1
]
<<
","
<<
position
[
d
][
2
]
<<
">"
<<
std
::
endl
;
out
<<
"}"
<<
std
::
endl
;
}
}
...
...
@@ -177,38 +170,18 @@ void exportMeshWire(std::ofstream& out, typename PFP::MAP& map, VertexAttribute<
{
out
<<
"#declare "
<<
meshName
<<
"= union {"
<<
std
::
endl
;
DartMarkerStore
tra
ite
(
map
);
TraversorE
<
typename
PFP
::
MAP
>
tra
vE
(
map
);
for
(
Dart
d
=
map
.
begin
()
;
d
!=
map
.
end
()
;
map
.
next
(
d
))
for
(
Dart
d
=
travE
.
begin
()
;
d
!=
travE
.
end
()
;
d
=
travE
.
next
())
{
if
(
good
(
d
)
&&
!
traite
.
isMarked
(
d
)
)
if
(
good
(
d
))
{
unsigned
int
nb
=
0
;
Dart
dd
=
d
;
do
{
traite
.
mark
(
dd
);
dd
=
map
.
phi1
(
dd
);
nb
++
;
}
while
(
dd
!=
d
);
Dart
dd
=
map
.
phi2
(
d
);
if
(
nb
==
3
)
Algo
::
ExportPov
::
exportTriangleWire
<
PFP
>
(
out
,
position
[
dd
],
position
[
map
.
phi1
(
dd
)],
position
[
map
.
phi1
(
map
.
phi1
(
dd
))]);
else
{
dd
=
d
;
do
{
if
(
position
[
dd
][
0
]
!=
position
[
map
.
phi1
(
dd
)][
0
]
||
position
[
dd
][
1
]
!=
position
[
map
.
phi1
(
dd
)][
1
]
||
position
[
dd
][
2
]
!=
position
[
map
.
phi1
(
dd
)][
2
])
{
out
<<
"cylinder{ "
<<
std
::
endl
;
out
<<
"<"
<<
position
[
dd
][
0
]
<<
","
<<
position
[
dd
][
2
]
<<
","
<<
position
[
dd
][
1
]
<<
">,"
<<
std
::
endl
;
out
<<
"<"
<<
position
[
map
.
phi1
(
dd
)][
0
]
<<
","
<<
position
[
map
.
phi1
(
dd
)][
2
]
<<
","
<<
position
[
map
.
phi1
(
dd
)][
1
]
<<
">, 0.5"
<<
std
::
endl
;
out
<<
"}"
<<
std
::
endl
;
}
dd
=
map
.
phi1
(
dd
);
}
while
(
dd
!=
d
);
}
out
<<
"cylinder{ "
<<
std
::
endl
;
out
<<
"<"
<<
position
[
d
][
0
]
<<
","
<<
position
[
d
][
1
]
<<
","
<<
position
[
d
][
2
]
<<
">,"
<<
std
::
endl
;
out
<<
"<"
<<
position
[
dd
][
0
]
<<
","
<<
position
[
dd
][
1
]
<<
","
<<
position
[
dd
][
2
]
<<
">,"
<<
0.5
<<
std
::
endl
;
out
<<
"}"
<<
std
::
endl
;
}
}
...
...
include/Algo/Geometry/normal.hpp
View file @
6a57cabf
...
...
@@ -125,11 +125,11 @@ typename PFP::VEC3 vertexBorderNormal(typename PFP::MAP& map, Dart d, const Vert
CellMarker
<
FACE
>
f
(
map
);
FunctorStore
fs
(
faces
);
map
.
foreach_dart_of_
oriented_
vertex
(
d
,
fs
);
map
.
foreach_dart_of_vertex
(
d
,
fs
);
for
(
std
::
vector
<
Dart
>::
iterator
it
=
faces
.
begin
()
;
it
!=
faces
.
end
()
;
++
it
)
{
if
(
!
f
.
isMarked
(
*
it
)
&&
map
.
phi3
(
*
it
)
==*
it
)
if
(
!
f
.
isMarked
(
*
it
)
&&
map
.
isBoundaryFace
(
*
it
)
)
{
f
.
mark
(
*
it
);
VEC3
n
=
faceNormal
<
PFP
>
(
map
,
*
it
,
position
);
...
...
include/Algo/Geometry/volume.hpp
View file @
6a57cabf
...
...
@@ -79,7 +79,7 @@ typename PFP::REAL convexPolyhedronVolume(typename PFP::MAP& map, Dart d, const
for
(
typename
std
::
vector
<
Dart
>::
iterator
face
=
visitedFaces
.
begin
();
face
!=
visitedFaces
.
end
();
++
face
)
{
Dart
e
=
*
face
;
if
(
map
.
is
Fac
eTriangle
(
e
))
if
(
map
.
is
Cycl
eTriangle
(
e
))
{
VEC3
p1
=
position
[
e
]
;
VEC3
p2
=
position
[
map
.
phi1
(
e
)]
;
...
...
include/Algo/Import/import.h
View file @
6a57cabf
...
...
@@ -46,7 +46,7 @@ namespace Import
* @param filename
* @param attrNames attribute names
* @param mergeCloseVertices a boolean indicating if close vertices should be merged during import
* @return a boolean indicating if import was successful
l
* @return a boolean indicating if import was successful
*/
template
<
typename
PFP
>
bool
importMesh
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
bool
mergeCloseVertices
=
false
);
...
...
@@ -57,23 +57,23 @@ bool importMesh(typename PFP::MAP& map, const std::string& filename, std::vector
* @param filename
* @param attrNames attribute names
* @param mergeCloseVertices a boolean indicating if close vertices should be merged during import
* @return a boolean indicating if import was successful
l
* @return a boolean indicating if import was successful
*/
template
<
typename
PFP
>
bool
importMeshV
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
bool
mergeCloseVertices
=
false
);
/**
* import a mesh and extrud it
* import a mesh and extrud
e
it
* @param map the map in which the function imports the mesh
* @param filename
* @param attrNames attribute names
* @param mergeCloseVertices a boolean indicating if close vertices should be merged during import
* @return a boolean indicating if import was successful
l
* @return a boolean indicating if import was successful
*/
template
<
typename
PFP
>
bool
importMeshToExtrude
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
);
/*
*
/*
* import a MOKA file
* @param gmap the gmap in which the function imports the mesh
* @param filename
...
...
@@ -82,7 +82,6 @@ bool importMeshToExtrude(typename PFP::MAP& map, const std::string& filename, st
template
<
typename
PFP
>
bool
importMoka
(
typename
PFP
::
MAP
&
gmap
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
);
/**
* import a Choupi file
* @param map
...
...
@@ -102,15 +101,13 @@ template <typename PFP>
bool
importNodeWithELERegions
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filenameNode
,
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
,
bool
invertTetra
=
false
);
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
importMoka
(
typename
PFP
::
MAP
&
the_gmap
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
);
//template <typename PFP>
//bool importObjWithTex(typename PFP::MAP& map, const std::string& filename);
//
template
<
typename
PFP
>
bool
importTs
(
typename
PFP
::
MAP
&
the_map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
float
scaleFactor
=
1.0
f
);
}
// namespace Import
...
...
@@ -119,10 +116,10 @@ bool importTs(typename PFP::MAP& the_map, const std::string& filename, std::vect
}
// namespace CGoGN
#include "Algo/Import/importMesh.hpp"
#include "Algo/Import/importMoka.hpp"
//#include "Algo/Import/importObjTex.hpp"
#include "Algo/Import/importObjEle.hpp"
#include "Algo/Import/importTet.hpp"
#include "Algo/Import/importMoka.hpp"
#include "Algo/Import/importTs.hpp"
#include "Algo/Import/importNodeEle.hpp"
...
...
include/Algo/Import/import2tables.h
View file @
6a57cabf
...
...
@@ -30,7 +30,6 @@
#include <vector>
#include <string>
//#include "Topology/generic/attributeHandler.h"
#include "Geometry/vector_gen.h"
#include "Geometry/matrix.h"
...
...
@@ -57,7 +56,7 @@ namespace Import
namespace
ImportVolumique
{
enum
ImportType
{
UNKNOWNVOLUME
,
TET
,
OFF
,
TS
,
NODE
};
enum
ImportType
{
UNKNOWNVOLUME
,
TET
,
OFF
,
TS
,
MOKA
,
NODE
};
}
...
...
include/Algo/Import/import2tablesVolume.hpp
View file @
6a57cabf
...
...
@@ -40,9 +40,15 @@ ImportVolumique::ImportType MeshTablesVolume<PFP>::getFileType(const std::string
if
((
filename
.
rfind
(
".node"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".NODE"
)
!=
std
::
string
::
npos
))
return
ImportVolumique
::
NODE
;
if
((
filename
.
rfind
(
".off"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".OFF"
)
!=
std
::
string
::
npos
))
return
ImportVolumique
::
OFF
;
if
((
filename
.
rfind
(
".ts"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".TS"
)
!=
std
::
string
::
npos
))
return
ImportVolumique
::
TS
;
if
((
filename
.
rfind
(
".moka"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".MOKA"
)
!=
std
::
string
::
npos
))
return
ImportVolumique
::
MOKA
;
return
ImportVolumique
::
UNKNOWNVOLUME
;
}
...
...
@@ -60,6 +66,9 @@ bool MeshTablesVolume<PFP>::importMesh(const std::string& filename, std::vector<
break
;
case
ImportVolumique
::
TS
:
break
;
// case ImportVolumique::MOKA:
// return importMoka(filename,attrNames);
// break;
default:
CGoGNerr
<<
"Not yet supported"
<<
CGoGNendl
;
break
;
...
...
@@ -178,7 +187,6 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<s
return
true
;
}
}
// namespace Import
}
// namespace Algo
...
...
include/Algo/Import/importMesh.hpp
View file @
6a57cabf
...
...
@@ -236,6 +236,114 @@ bool importMeshSToV(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts, float d
return
true
;
}
template
<
typename
PFP
>
bool
importMeshSurfToVol
(
typename
PFP
::
MAP
&
map
,
MeshTablesSurface
<
PFP
>&
mts
,
float
dist
)
{
VertexAutoAttribute
<
NoMathIONameAttribute
<
std
::
vector
<
Dart
>
>
>
vecDartsPerVertex
(
map
);
unsigned
nbf
=
mts
.
getNbFaces
();
int
index
=
0
;
// buffer for tempo faces (used to remove degenerated edges)
std
::
vector
<
unsigned
int
>
edgesBuffer
;
edgesBuffer
.
reserve
(
16
);
DartMarkerNoUnmark
m
(
map
)
;
VertexAttribute
<
typename
PFP
::
VEC3
>
position
=
map
.
template
getAttribute
<
typename
PFP
::
VEC3
,
VERTEX
>(
"position"
);
std
::
vector
<
unsigned
int
>
backEdgesBuffer
(
mts
.
getNbVertices
(),
EMBNULL
);
// for each face of table -> create a prism
for
(
unsigned
int
i
=
0
;
i
<
nbf
;
++
i
)
{
// store face in buffer, removing degenerated edges
unsigned
int
nbe
=
mts
.
getNbEdgesFace
(
i
);
edgesBuffer
.
clear
();
unsigned
int
prec
=
EMBNULL
;
for
(
unsigned
int
j
=
0
;
j
<
nbe
;
++
j
)
{
unsigned
int
em
=
mts
.
getEmbIdx
(
index
++
);
if
(
em
!=
prec
)
{
prec
=
em
;
edgesBuffer
.
push_back
(
em
);
}
}
// check first/last vertices
if
(
edgesBuffer
.
front
()
==
edgesBuffer
.
back
())
edgesBuffer
.
pop_back
();
// create only non degenerated faces
nbe
=
edgesBuffer
.
size
();
if
(
nbe
>
2
)
{
Dart
d
=
Algo
::
Modelisation
::
createPrism
<
PFP
>
(
map
,
nbe
);
//Embed the base faces
for
(
unsigned
int
j
=
0
;
j
<
nbe
;
++
j
)
{
unsigned
int
em
=
edgesBuffer
[
j
];
// get embedding
if
(
backEdgesBuffer
[
em
]
==
EMBNULL
)
{
unsigned
int
emn
=
map
.
template
newCell
<
VERTEX
>();
map
.
template
copyCell
<
VERTEX
>(
emn
,
em
);
backEdgesBuffer
[
em
]
=
emn
;
position
[
emn
]
+=
typename
PFP
::
VEC3
(
0
,
0
,
dist
);
}
FunctorSetEmb
<
typename
PFP
::
MAP
,
VERTEX
>
fsetemb
(
map
,
em
);
//foreach_dart_of_orbit_in_parent<typename PFP::MAP>(&map, VERTEX, d, fsetemb) ;
map
.
template
foreach_dart_of_orbit
<
PFP
::
MAP
::
VERTEX_OF_PARENT
>(
d
,
fsetemb
);
//Embed the other base face
Dart
d2
=
map
.
phi1
(
map
.
phi1
(
map
.
phi2
(
d
)));
unsigned
int
em2
=
backEdgesBuffer
[
em
];
FunctorSetEmb
<
typename
PFP
::
MAP
,
VERTEX
>
fsetemb2
(
map
,
em2
);
//foreach_dart_of_orbit_in_parent<typename PFP::MAP>(&map, VERTEX, d2, fsetemb2) ;
map
.
template
foreach_dart_of_orbit
<
PFP
::
MAP
::
VERTEX_OF_PARENT
>(
d2
,
fsetemb2
);
m
.
mark
(
d
)
;
// mark on the fly to unmark on second loop
vecDartsPerVertex
[
em
].
push_back
(
d
);
// store incident darts for fast adjacency reconstruction
d
=
map
.
phi_1
(
d
);
}
}
}
// reconstruct neighbourhood
unsigned
int
nbBoundaryEdges
=
0
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
m
.
isMarked
(
d
))
{
// darts incident to end vertex of edge
std
::
vector
<
Dart
>&
vec
=
vecDartsPerVertex
[
map
.
phi1
(
d
)];
unsigned
int
embd
=
map
.
template
getEmbedding
<
VERTEX
>(
d
);
Dart
good_dart
=
NIL
;
for
(
typename
std
::
vector
<
Dart
>::
iterator
it
=
vec
.
begin
();
it
!=
vec
.
end
()
&&
good_dart
==
NIL
;
++
it
)
{
if
(
map
.
template
getEmbedding
<
VERTEX
>(
map
.
phi1
(
*
it
))
==
embd
)
good_dart
=
*
it
;
}
<