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
7114af20
Commit
7114af20
authored
Feb 02, 2015
by
Sylvain Thery
Browse files
Merge branch 'master' into 'master'
Master once upon a time See merge request !39
parents
7576a3e9
21e86c78
Changes
60
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/mcmesh.cpp
View file @
7114af20
...
...
@@ -168,7 +168,8 @@ void MCMesh::updateRender()
void
MCMesh
::
fromFile
(
char
*
fname
)
{
myImg
=
new
SAlgo
::
MC
::
Image
<
DATATYPE
>
();
myImg
->
loadInrgz
(
fname
);
//myImg->loadInrgz(fname);
myImg
->
loadVox
(
fname
);
CGoGNout
<<
"Image chargee"
<<
CGoGNendl
;
CGoGNout
<<
myImg
->
getWidthX
()
<<
"x"
<<
myImg
->
getWidthY
()
<<
"x"
<<
myImg
->
getWidthZ
()
<<
"voxels"
<<
CGoGNendl
;
}
...
...
Apps/Examples/viewer.cpp
View file @
7114af20
...
...
@@ -31,7 +31,7 @@ Viewer::Viewer() :
m_drawFaces
(
true
),
m_drawNormals
(
false
),
m_drawTopo
(
false
),
m_drawBoundaryTopo
(
tru
e
),
m_drawBoundaryTopo
(
fals
e
),
m_render
(
NULL
),
m_phongShader
(
NULL
),
m_flatShader
(
NULL
),
...
...
@@ -87,7 +87,7 @@ void Viewer::cb_initGL()
m_render
=
new
Algo
::
Render
::
GL2
::
MapRender
()
;
m_topoRender
=
new
Algo
::
Render
::
GL2
::
TopoRender
()
;
m_topoRender
->
setInitialDartsColor
(
0.25
f
,
0.25
f
,
0.25
f
)
;
m_topoRender
->
setInitialDartsColor
(
1.0
f
,
1.00
f
,
1.00
f
)
;
m_positionVBO
=
new
Utils
::
VBO
()
;
m_normalVBO
=
new
Utils
::
VBO
()
;
...
...
@@ -552,11 +552,14 @@ void Viewer::importMesh(std::string& filename)
// myMap.enableQuickTraversal<VERTEX>() ;
std
::
cout
<<
"The mesh is "
<<
(
myMap
.
isOpen
()
?
"open"
:
"closed"
)
<<
std
::
endl
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
POINTS
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
LINES
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
TRIANGLES
)
;
m_topoRender
->
updateData
<
PFP
>
(
myMap
,
position
,
0.85
f
,
0.85
f
,
m_drawBoundaryTopo
)
;
m_topoRender
->
updateData
<
PFP
>
(
myMap
,
position
,
0.85
f
,
0.85
f
,
m_drawBoundaryTopo
,
true
)
;
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
normalBaseSize
=
bb
.
diagSize
()
/
100.0
f
;
...
...
Apps/Examples/volumeExplorer.cpp
View file @
7114af20
...
...
@@ -29,8 +29,10 @@
#include
"Algo/Modelisation/polyhedron.h"
#include
"Algo/Import/import.h"
#include
"Algo/Geometry/volume.h"
#include
"Algo/Modelisation/tetrahedralization.h"
#include
"Algo/Geometry/area.h"
#include
"Utils/chrono.h"
#include
"Algo/Export/exportVol.h"
...
...
@@ -172,12 +174,14 @@ void MyQT::cb_Open()
for
(
Dart
d
=
tra
.
begin
();
d
!=
tra
.
end
();
d
=
tra
.
next
())
{
// float v = Algo::Geometry::tetrahedronVolume<PFP>(myMap, d, position);
color
[
d
]
=
PFP
::
VEC3
(
1.0
,
0
,
0
);
// color[d] = VEC3(v,0,0);
// if (v>maxV)
// maxV=v;
if
(
myMap
.
isVolumeIncidentToBoundary
(
d
))
color
[
d
]
=
VEC3
(
0
,
0
,
0
);
color
[
d
]
=
VEC3
(
1
,
0.41
,
0.706
);
}
// for (unsigned int i = color.begin(); i != color.end(); color.next(i))
// {
...
...
@@ -399,7 +403,7 @@ int main(int argc, char **argv)
{
*/
if
(
extension
==
std
::
string
(
".map"
))
if
(
extension
==
std
::
string
(
".map
bin
"
))
{
myMap
.
loadMapBin
(
filename
);
position
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
,
MAP
>
(
"position"
)
;
...
...
@@ -421,6 +425,17 @@ int main(int argc, char **argv)
float
maxV
=
0.0
f
;
for
(
Dart
d
=
tra
.
begin
();
d
!=
tra
.
end
();
d
=
tra
.
next
())
{
// float v = Algo::Geometry::tetrahedronVolume<PFP>(myMap, d, position);
color
[
d
]
=
PFP
::
VEC3
(
1.0
,
0
,
0
);
// if (v>maxV)
// maxV=v;
if
(
myMap
.
isVolumeIncidentToBoundary
(
d
))
color
[
d
]
=
PFP
::
VEC3
(
1
,
0.41
,
0.706
);
//else
// color[d] = PFP::VEC3(1.0,0,0);
/*
float v = Algo::Geometry::tetrahedronVolume<PFP>(myMap, d, position);
color[d] = VEC3(v,0,0);
if (v>maxV)
...
...
@@ -435,6 +450,7 @@ int main(int argc, char **argv)
{
color[i][0] /= maxV;
color[i][2] = 1.0f - color[i][0];
*/
}
}
...
...
@@ -460,6 +476,9 @@ int main(int argc, char **argv)
// Algo::Volume::Export::exportNAS<PFP>(myMap,position,"/tmp/test1.nas");
// Algo::Volume::Export::exportVTU<PFP>(myMap,position,"/tmp/test3.vtu");
}
myMap
.
check
();
// un peu d'interface
QApplication
app
(
argc
,
argv
);
MyQT
sqt
;
...
...
Apps/Tuto/Modelling/tuto_oper2.cpp
View file @
7114af20
...
...
@@ -157,6 +157,17 @@ void MyQT::operation(int x)
m_selected2
=
NIL
;
}
break
;
case
10
:
CGoGNout
<<
"split surface"
<<
CGoGNendl
;
if
(
!
m_selecteds
.
empty
())
{
myMap
.
splitSurface
(
m_selecteds
);
updateMap
();
m_selected
=
NIL
;
m_selected2
=
NIL
;
m_selecteds
.
clear
();
}
break
;
default:
break
;
...
...
@@ -233,7 +244,15 @@ void MyQT::cb_redraw()
m_render_topo
->
overdrawDart
(
myMap
,
m_selected
,
11
,
1.0
f
,
0.0
f
,
0.0
f
);
if
(
m_selected2
!=
NIL
)
if
(
!
m_selecteds
.
empty
())
{
for
(
std
::
vector
<
Dart
>::
iterator
it
=
m_selecteds
.
begin
()
;
it
!=
m_selecteds
.
end
()
;
++
it
)
m_render_topo
->
overdrawDart
(
myMap
,
*
it
,
11
,
0.0
f
,
0.0
f
,
1.0
f
);
}
m_render_topo
->
overdrawDart
(
myMap
,
m_selected2
,
11
,
0.0
f
,
1.0
f
,
0.0
f
);
}
void
MyQT
::
cb_mousePress
(
int
button
,
int
x
,
int
y
)
...
...
@@ -253,6 +272,17 @@ void MyQT::cb_mousePress(int button, int x, int y)
}
updateGL
();
}
if
(
Control
())
{
Dart
d
=
m_render_topo
->
picking
(
myMap
,
x
,
y
);
// nb
if
(
button
==
Qt
::
LeftButton
)
{
if
(
d
==
Dart
::
nil
())
m_selecteds
.
clear
();
else
m_selecteds
.
push_back
(
d
);
}
}
}
void
MyQT
::
cb_keyPress
(
int
keycode
)
...
...
Apps/Tuto/Modelling/tuto_oper2.h
View file @
7114af20
...
...
@@ -93,6 +93,7 @@ protected:
#endif
Dart
m_selected
;
Dart
m_selected2
;
std
::
vector
<
Dart
>
m_selecteds
;
DartMarker
<
MAP
>
dm
;
float
m_shift
;
...
...
Apps/Tuto/Modelling/tuto_oper2.ui
View file @
7114af20
...
...
@@ -36,7 +36,16 @@
</size>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<property
name=
"margin"
>
<property
name=
"leftMargin"
>
<number>
2
</number>
</property>
<property
name=
"topMargin"
>
<number>
2
</number>
</property>
<property
name=
"rightMargin"
>
<number>
2
</number>
</property>
<property
name=
"bottomMargin"
>
<number>
2
</number>
</property>
<property
name=
"spacing"
>
...
...
@@ -99,6 +108,11 @@
<string>
deleteFace
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
splitSurface
</string>
</property>
</item>
</widget>
</item>
<item>
...
...
Apps/Tuto/Modelling/tuto_oper3.cpp
View file @
7114af20
...
...
@@ -245,6 +245,24 @@ void MyQT::operation(int x)
updateMap
();
}
break
;
case
13
:
CGoGNout
<<
"split volume"
<<
CGoGNendl
;
if
(
!
m_selecteds
.
empty
())
{
myMap
.
splitVolume
(
m_selecteds
);
m_selecteds
.
clear
();
updateMap
();
}
break
;
case
14
:
CGoGNout
<<
"cut volume"
<<
CGoGNendl
;
if
(
!
m_selecteds
.
empty
())
{
myMap
.
cutVolume
(
m_selecteds
);
m_selecteds
.
clear
();
updateMap
();
}
break
;
default:
break
;
}
...
...
@@ -459,12 +477,12 @@ void MyQT::cb_mousePress(int button, int x, int y)
{
if
(
button
==
Qt
::
LeftButton
)
{
Dart
d
=
m_render_topo_boundary
->
picking
(
myMap
,
x
,
y
,
true
);
if
(
d
!=
Dart
::
nil
(
))
{
Dart
e
=
myMap
.
phi2
(
d
);
std
::
cout
<<
"Dart "
<<
d
.
index
<<
" / phi2:"
<<
e
.
index
<<
std
::
endl
;
}
m_selecteds
.
push_back
(
Dart
(
173
)
);
m_selecteds
.
push_back
(
Dart
(
186
))
;
m_selecteds
.
push_back
(
Dart
(
185
));
m_selecteds
.
push_back
(
Dart
(
171
)
);
m_selecteds
.
push_back
(
Dart
(
170
))
;
m_selecteds
.
push_back
(
Dart
(
174
));
}
if
(
button
==
Qt
::
RightButton
)
{
...
...
@@ -472,8 +490,6 @@ void MyQT::cb_mousePress(int button, int x, int y)
if
(
d
!=
Dart
::
nil
())
{
m_selecteds
.
push_back
(
d
);
Dart
e
=
myMap
.
phi2
(
d
);
std
::
cout
<<
"Dart "
<<
d
.
index
<<
" / phi2:"
<<
e
.
index
<<
std
::
endl
;
}
}
...
...
@@ -836,7 +852,7 @@ void MyQT::importMesh(std::string& filename)
std
::
cerr
<<
"could not import "
<<
filename
<<
std
::
endl
;
return
;
}
else
else
position
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
,
MAP
>
(
attrNames
[
0
])
;
m_selected
=
NIL
;
...
...
Apps/Tuto/Modelling/tuto_oper3.ui
View file @
7114af20
...
...
@@ -155,6 +155,16 @@
<string>
deleteVolume
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
splitVolume
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
cutVolume
</string>
</property>
</item>
</widget>
</item>
<item
row=
"6"
column=
"0"
>
...
...
CMakeLists.txt
View file @
7114af20
...
...
@@ -135,7 +135,7 @@ SET (CGoGN_EXT_INCLUDES
# define libs for external libs
SET
(
CGoGN_EXT_LIBS
nl
nl
${
OPENGL_LIBRARY
}
${
GLEW_LIBRARIES
}
${
ZLIB_LIBRARIES
}
...
...
SCHNApps/Plugins/CMakeLists.txt
View file @
7114af20
...
...
@@ -15,3 +15,5 @@ ADD_SUBDIRECTORY(surface_distance)
ADD_SUBDIRECTORY
(
volume_import
)
#ADD_SUBDIRECTORY(volume_render)
ADD_SUBDIRECTORY
(
volumetric
)
SCHNApps/include/texture.h
View file @
7114af20
#ifndef _TEXTURE_H_
#define _TEXTURE_H_
#include
"Utils/gl_def.h"
#include
<QSize>
namespace
CGoGN
{
...
...
SCHNApps/include/types.h
View file @
7114af20
...
...
@@ -39,6 +39,7 @@ class Camera;
class
MapHandlerGen
;
class
CellSelectorGen
;
struct
Texture
;
class
ObjectHandlerGen
;
typedef
QMap
<
QString
,
Plugin
*>
PluginSet
;
typedef
QMap
<
QString
,
View
*>
ViewSet
;
...
...
@@ -51,6 +52,8 @@ typedef QMap<QString, Utils::GLSLShader*> ShaderSet;
typedef
QMap
<
QString
,
Texture
*>
TextureSet
;
typedef
QMap
<
QString
,
ObjectHandlerGen
*>
ObjectSet
;
}
// namespace SCHNApps
}
// namespace CGoGN
...
...
ThirdParty/build/.gitignore
deleted
100644 → 0
View file @
7576a3e9
# all build directory ignored !
*
ThirdParty/buildDebug/.gitignore
deleted
100644 → 0
View file @
7576a3e9
# all build directory ignored !
*
apps_cmake.txt
View file @
7114af20
...
...
@@ -69,6 +69,7 @@ SET (COMMON_LIBS
${LIBXML2_LIBRARIES}
${Boost_SYSTEM_LIBRARY}
${Boost_REGEX_LIBRARY}
tinyxml2
)
IF(WIN32)
...
...
@@ -82,7 +83,6 @@ ELSE(WIN32)
find_package(SuiteSparse REQUIRED)
SET (COMMON_INCLUDES ${COMMON_INCLUDES} ${SUITESPARSE_INCLUDE_DIRS})
SET (COMMON_LIBS ${SUITESPARSE_LIBRARIES} lapack blas ${COMMON_LIBS} pthread )
ENDIF(WIN32)
#optionnal libs
...
...
build/.gitignore
deleted
100644 → 0
View file @
7576a3e9
#ignore all build directory
*
buildDebug/.gitignore
deleted
100644 → 0
View file @
7576a3e9
#ignore all build directory
*
include/Algo/Export/export.hpp
View file @
7114af20
...
...
@@ -998,7 +998,7 @@ bool exportChoupi(typename PFP::MAP& map, const VertexAttribute<typename PFP::VE
return
false
;
}
out
<<
map
.
template
getNbOrbits
<
VERTEX
>()
<<
" "
<<
map
.
template
getNbOrbits
<
EDGE
>()
<<
std
::
endl
;
out
<<
Algo
::
Topo
::
getNbOrbits
<
VERTEX
>
(
map
)
<<
" "
<<
Algo
::
Topo
::
getNbOrbits
<
EDGE
>
(
map
)
<<
std
::
endl
;
TraversorV
<
MAP
>
travV
(
map
);
for
(
Dart
dit
=
travV
.
begin
()
;
dit
!=
travV
.
end
()
;
dit
=
travV
.
next
())
...
...
include/Algo/Export/exportVol.h
View file @
7114af20
...
...
@@ -125,6 +125,9 @@ template <typename PFP>
bool
exportTetmesh
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
const
char
*
filename
);
template
<
typename
PFP
>
bool
exportBoundaryOFF
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
const
char
*
filename
);
}
// namespace Export
}
// namespace Volume
...
...
include/Algo/Export/exportVol.hpp
View file @
7114af20
...
...
@@ -853,6 +853,81 @@ bool exportMesh(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3
}
}
template
<
typename
PFP
>
bool
exportBoundaryOFF
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
const
char
*
filename
)
{
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
<
typename
PFP
::
MAP
,
VERTEX
>
markV
(
map
)
;
TraversorF
<
MAP
>
t
(
map
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
{
if
(
map
.
isBoundaryFace
(
d
))
{
Dart
db
=
d
;
if
(
!
map
.
template
isBoundaryMarked
<
3
>(
db
))
db
=
map
.
phi3
(
db
);
std
::
vector
<
unsigned
int
>
fidx
;
fidx
.
reserve
(
8
)
;
unsigned
int
degree
=
0
;
Traversor2FV
<
typename
PFP
::
MAP
>
tfv
(
map
,
db
)
;
for
(
Dart
it
=
tfv
.
begin
();
it
!=
tfv
.
end
();
it
=
tfv
.
next
())
{
++
degree
;
unsigned
int
vNum
=
map
.
template
getEmbedding
<
VERTEX
>(
it
)
;
if
(
!
markV
.
isMarked
(
it
))
{
markV
.
mark
(
it
)
;
vIndex
[
vNum
]
=
vCpt
++
;
vertices
.
push_back
(
vNum
)
;
}
fidx
.
push_back
(
vIndex
[
vNum
])
;
}
facesSize
.
push_back
(
degree
)
;
facesIdx
.
push_back
(
fidx
)
;
}
}
out
<<
"OFF"
<<
std
::
endl
;
out
<<
vertices
.
size
()
<<
" "
<<
facesSize
.
size
()
<<
" "
<<
0
<<
std
::
endl
;
for
(
unsigned
int
i
=
0
;
i
<
vertices
.
size
();
++
i
)
{
const
VEC3
&
v
=
position
[
vertices
[
i
]]
;
out
<<
v
[
0
]
<<
" "
<<
v
[
1
]
<<
" "
<<
v
[
2
]
<<
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
;
}
out
.
close
()
;
return
true
;
}
}
// namespace Export
}
// namespace Volume
...
...
Prev
1
2
3
Next
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