Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Pitiot
CGoGN
Commits
7a2fdd6b
Commit
7a2fdd6b
authored
Feb 20, 2015
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restore volumeExplorer
parent
bd4f72f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
76 deletions
+40
-76
Apps/Examples/volumeExplorer.cpp
Apps/Examples/volumeExplorer.cpp
+33
-72
Apps/Examples/volumeExplorer.h
Apps/Examples/volumeExplorer.h
+7
-4
No files found.
Apps/Examples/volumeExplorer.cpp
View file @
7a2fdd6b
...
@@ -29,12 +29,8 @@
...
@@ -29,12 +29,8 @@
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Import/import.h"
#include "Algo/Import/import.h"
#include "Algo/Geometry/volume.h"
#include "Algo/Geometry/volume.h"
#include "Algo/Modelisation/tetrahedralization.h"
#include "Algo/Geometry/area.h"
#include "Algo/Geometry/area.h"
#include "Utils/chrono.h"
#include "Algo/Export/exportVol.h"
#include "Algo/Export/exportVol.h"
MAP
myMap
;
MAP
myMap
;
...
@@ -275,6 +271,14 @@ void MyQT::cb_redraw()
...
@@ -275,6 +271,14 @@ void MyQT::cb_redraw()
m_frame
->
draw
();
m_frame
->
draw
();
m_PlanePick
->
draw
();
m_PlanePick
->
draw
();
}
}
m_nbFrames
++
;
if
(
m_nbFrames
>=
40
)
{
std
::
cout
<<
40000.0
/
m_frame_ch
.
elapsed
()
<<
" fps"
<<
std
::
endl
;
m_nbFrames
=
0
;
m_frame_ch
.
start
();
}
}
}
...
@@ -385,23 +389,6 @@ int main(int argc, char **argv)
...
@@ -385,23 +389,6 @@ int main(int argc, char **argv)
std
::
string
filename
(
argv
[
1
]);
std
::
string
filename
(
argv
[
1
]);
size_t
pos
=
filename
.
rfind
(
"."
);
// position of "." in filename
size_t
pos
=
filename
.
rfind
(
"."
);
// position of "." in filename
std
::
string
extension
=
filename
.
substr
(
pos
);
std
::
string
extension
=
filename
.
substr
(
pos
);
/*
if(extension == std::string(".off"))
{
if(!Algo::Volume::Import::importMeshToExtrude<PFP>(myMap, filename, attrNames))
{
std::cerr << "could not import " << filename << std::endl ;
return 1;
}
else
{
position = myMap.getAttribute<VEC3, VERTEX>(attrNames[0]) ;
myMap.closeMap();
}
}
else
{
*/
if
(
extension
==
std
::
string
(
".mapbin"
))
if
(
extension
==
std
::
string
(
".mapbin"
))
{
{
...
@@ -421,36 +408,20 @@ int main(int argc, char **argv)
...
@@ -421,36 +408,20 @@ int main(int argc, char **argv)
color
=
myMap
.
addAttribute
<
VEC3
,
VOLUME
,
MAP
>
(
"colorVol"
);
color
=
myMap
.
addAttribute
<
VEC3
,
VOLUME
,
MAP
>
(
"colorVol"
);
TraversorCell
<
MAP
,
VOLUME
>
tra
(
myMap
);
TraversorCell
<
MAP
,
VOLUME
>
tra
(
myMap
);
float
maxV
=
0.0
f
;
float
maxV
=
0.0
f
;
for
(
Dart
d
=
tra
.
begin
();
d
!=
tra
.
end
();
d
=
tra
.
next
())
for
(
Dart
d
=
tra
.
begin
();
d
!=
tra
.
end
();
d
=
tra
.
next
())
{
{
float
v
=
Algo
::
Geometry
::
convexPolyhedronVolume
<
PFP
>
(
myMap
,
d
,
position
);
// 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
);
color
[
d
]
=
VEC3
(
v
,
0
,
0
);
if
(
v
>
maxV
)
if
(
v
>
maxV
)
maxV
=
v
;
maxV
=
v
;
// if(myMap.isVolumeIncidentToBoundary(d))
// color[d] = VEC3(0,0,0);
// else
color[d] = VEC3(v,0,0);
}
}
for
(
unsigned
int
i
=
color
.
begin
();
i
!=
color
.
end
();
color
.
next
(
i
))
for
(
unsigned
int
i
=
color
.
begin
();
i
!=
color
.
end
();
color
.
next
(
i
))
{
{
color
[
i
][
0
]
/=
maxV
;
color
[
i
][
0
]
/=
maxV
;
color
[
i
][
2
]
=
1.0
f
-
color
[
i
][
0
];
color
[
i
][
2
]
=
1.0
f
-
color
[
i
][
0
];
*/
}
}
}
}
...
@@ -458,7 +429,7 @@ int main(int argc, char **argv)
...
@@ -458,7 +429,7 @@ int main(int argc, char **argv)
{
{
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
,
MAP
>
(
"position"
);
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
,
MAP
>
(
"position"
);
int
nb
=
32
;
int
nb
=
16
;
Algo
::
Volume
::
Tilings
::
Cubic
::
Grid
<
PFP
>
cubic
(
myMap
,
nb
,
nb
,
nb
);
Algo
::
Volume
::
Tilings
::
Cubic
::
Grid
<
PFP
>
cubic
(
myMap
,
nb
,
nb
,
nb
);
cubic
.
embedIntoGrid
(
position
,
1.0
f
,
1.0
f
,
1.0
f
);
cubic
.
embedIntoGrid
(
position
,
1.0
f
,
1.0
f
,
1.0
f
);
...
@@ -472,9 +443,6 @@ int main(int argc, char **argv)
...
@@ -472,9 +443,6 @@ int main(int argc, char **argv)
TraversorW
<
MAP
>
tra
(
myMap
);
TraversorW
<
MAP
>
tra
(
myMap
);
for
(
Dart
d
=
tra
.
begin
();
d
!=
tra
.
end
();
d
=
tra
.
next
())
for
(
Dart
d
=
tra
.
begin
();
d
!=
tra
.
end
();
d
=
tra
.
next
())
color
[
d
]
=
position
[
d
]
+
VEC3
(
0.5
,
0.5
,
0.5
);
color
[
d
]
=
position
[
d
]
+
VEC3
(
0.5
,
0.5
,
0.5
);
// Algo::Volume::Export::exportMSH<PFP>(myMap,position,"/tmp/test2.msh");
// Algo::Volume::Export::exportNAS<PFP>(myMap,position,"/tmp/test1.nas");
// Algo::Volume::Export::exportVTU<PFP>(myMap,position,"/tmp/test3.vtu");
}
}
myMap
.
check
();
myMap
.
check
();
...
@@ -513,37 +481,30 @@ int main(int argc, char **argv)
...
@@ -513,37 +481,30 @@ int main(int argc, char **argv)
sqt
.
show
();
sqt
.
show
();
dock
.
slider_explode
->
setValue
(
80
);
dock
.
slider_explode
->
setValue
(
80
);
dock
.
slider_explode_face
->
setValue
(
8
0
);
dock
.
slider_explode_face
->
setValue
(
10
0
);
sqt
.
clipping_onoff
(
true
);
sqt
.
clipping_onoff
(
true
);
Utils
::
Chrono
ch
;
// Utils::Chrono ch;
// ch.start();
// Vertex v(myMap.begin());
// float vol = Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position);
// VEC3 p = Algo::Volume::Geometry::vertexNeighborhoodCentroid<PFP>(myMap,v,position);
// vol += Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position);
// vol += Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position);
// Vol w(myMap.begin());
// vol += Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position);
// VEC3 q = Algo::Surface::Geometry::volumeCentroid<PFP>(myMap,w,position);
// std::cout << ch.elapsed()<< " ms // val="<<vol<< std::endl;
ch
.
start
();
// std::cout << "Compute Volume ->"<< std::endl;
float
vol
=
Algo
::
Geometry
::
Parallel
::
totalVolume
<
PFP
>
(
myMap
,
position
);
// ch.start();
vol
+=
Algo
::
Geometry
::
Parallel
::
totalVolume
<
PFP
>
(
myMap
,
position
);
// vol = Algo::Geometry::totalVolume<PFP>(myMap, position);
vol
+=
Algo
::
Geometry
::
Parallel
::
totalVolume
<
PFP
>
(
myMap
,
position
);
// std::cout << ch.elapsed()<< " ms val="<<vol<< std::endl;
vol
+=
Algo
::
Geometry
::
Parallel
::
totalVolume
<
PFP
>
(
myMap
,
position
);
// ch.start();
std
::
cout
<<
ch
.
elapsed
()
<<
" ms // val="
<<
vol
<<
std
::
endl
;
// vol += Algo::Geometry::totalVolume<PFP>(myMap, position);
// std::cout << ch.elapsed()<< " ms val="<<vol<< std::endl;
std
::
cout
<<
"Compute Volume ->"
<<
std
::
endl
;
// ch.start();
ch
.
start
();
// vol += Algo::Geometry::totalVolume<PFP>(myMap, position);
vol
=
Algo
::
Geometry
::
totalVolume
<
PFP
>
(
myMap
,
position
);
// std::cout << ch.elapsed()<< " ms val="<<vol<< std::endl;
std
::
cout
<<
ch
.
elapsed
()
<<
" ms val="
<<
vol
<<
std
::
endl
;
// ch.start();
ch
.
start
();
// vol += Algo::Geometry::totalVolume<PFP>(myMap, position);
vol
+=
Algo
::
Geometry
::
totalVolume
<
PFP
>
(
myMap
,
position
);
// std::cout << ch.elapsed()<< " ms val="<<vol<< std::endl;
std
::
cout
<<
ch
.
elapsed
()
<<
" ms val="
<<
vol
<<
std
::
endl
;
ch
.
start
();
vol
+=
Algo
::
Geometry
::
totalVolume
<
PFP
>
(
myMap
,
position
);
std
::
cout
<<
ch
.
elapsed
()
<<
" ms val="
<<
vol
<<
std
::
endl
;
ch
.
start
();
vol
+=
Algo
::
Geometry
::
totalVolume
<
PFP
>
(
myMap
,
position
);
std
::
cout
<<
ch
.
elapsed
()
<<
" ms val="
<<
vol
<<
std
::
endl
;
// et on attend la fin.
// et on attend la fin.
return
app
.
exec
();
return
app
.
exec
();
...
...
Apps/Examples/volumeExplorer.h
View file @
7a2fdd6b
...
@@ -36,14 +36,14 @@
...
@@ -36,14 +36,14 @@
#include "Algo/Render/GL2/explodeVolumeRender.h"
#include "Algo/Render/GL2/explodeVolumeRender.h"
#include "Utils/cgognStream.h"
#include "Utils/cgognStream.h"
#include "Utils/Qt/qt
Simple
.h"
#include "Utils/Qt/qt
QGLV
.h"
#include "Utils/frameManipulator.h"
#include "Utils/frameManipulator.h"
#include "ui_volumeExplorer.h"
#include "ui_volumeExplorer.h"
#include "Utils/Qt/qtui.h"
#include "Utils/Qt/qtui.h"
#include "Algo/Export/exportVol.h"
#include "Algo/Export/exportVol.h"
#include "Utils/chrono.h"
using
namespace
CGoGN
;
using
namespace
CGoGN
;
...
@@ -66,7 +66,7 @@ using namespace CGoGN ;
...
@@ -66,7 +66,7 @@ using namespace CGoGN ;
* Ajouter les widgets necessaires, mettre des noms clairs pour
* Ajouter les widgets necessaires, mettre des noms clairs pour
* les utiliser dans le .cpp (pour les call back principalement)
* les utiliser dans le .cpp (pour les call back principalement)
*/
*/
class
MyQT
:
public
Utils
::
QT
::
SimpleQ
T
class
MyQT
:
public
Utils
::
QT
::
SimpleQ
GLV
{
{
Q_OBJECT
Q_OBJECT
...
@@ -95,6 +95,8 @@ class MyQT: public Utils::QT::SimpleQT
...
@@ -95,6 +95,8 @@ class MyQT: public Utils::QT::SimpleQT
// shader of toporender3
// shader of toporender3
Utils
::
ClippingShader
*
m_sh1
;
Utils
::
ClippingShader
*
m_sh1
;
Utils
::
ClippingShader
*
m_sh2
;
Utils
::
ClippingShader
*
m_sh2
;
Utils
::
Chrono
m_frame_ch
;
unsigned
int
m_nbFrames
;
public:
public:
float
m_WidthObj
;
float
m_WidthObj
;
...
@@ -110,7 +112,8 @@ public:
...
@@ -110,7 +112,8 @@ public:
hide_clipping
(
false
),
hide_clipping
(
false
),
m_topo_render
(
NULL
),
m_topo_render
(
NULL
),
m_explode_render
(
NULL
),
m_explode_render
(
NULL
),
m_explode_factor
(
0.8
f
)
m_explode_factor
(
0.8
f
),
m_nbFrames
(
0
)
{}
{}
protected:
protected:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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