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
a5aeb607
Commit
a5aeb607
authored
Mar 10, 2014
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update test_traversor2
parent
d574eb73
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
40 deletions
+44
-40
Apps/SandBox/test_traversor2.cpp
Apps/SandBox/test_traversor2.cpp
+19
-25
Apps/SandBox/test_traversor2.h
Apps/SandBox/test_traversor2.h
+17
-7
include/Topology/generic/traversor2.hpp
include/Topology/generic/traversor2.hpp
+6
-6
include/Topology/generic/traversor2Virt.hpp
include/Topology/generic/traversor2Virt.hpp
+2
-2
No files found.
Apps/SandBox/test_traversor2.cpp
View file @
a5aeb607
...
...
@@ -29,25 +29,21 @@
#include "Algo/Import/import.h"
#include "Algo/Export/export.h"
using
namespace
CGoGN
;
int
main
(
int
argc
,
char
**
argv
)
{
// // interface
QApplication
app
(
argc
,
argv
);
MyQT
sqt
;
sqt
.
setDock
(
&
sqt
.
dock
);
sqt
.
setCallBack
(
sqt
.
dock
.
listTravers
,
SIGNAL
(
currentRowChanged
(
int
)),
SLOT
(
traversors
(
int
))
);
sqt
.
setCallBack
(
sqt
.
dock
.
withBoundary
,
SIGNAL
(
clicked
()),
SLOT
(
updateMap
())
);
sqt
.
setCallBack
(
sqt
.
dock
.
svg
,
SIGNAL
(
clicked
()),
SLOT
(
svg
())
);
sqt
.
setCallBack
(
sqt
.
dock
.
widthSlider
,
SIGNAL
(
valueChanged
(
int
)),
SLOT
(
width
(
int
))
);
int
n
=
3
;
if
(
argc
==
2
)
int
n
=
3
;
if
(
argc
==
2
)
n
=
atoi
(
argv
[
1
]);
// example code itself
...
...
@@ -63,7 +59,6 @@ int main(int argc, char **argv)
return
app
.
exec
();
}
void
MyQT
::
traversors
(
int
x
)
{
// update all color to grey
...
...
@@ -189,11 +184,11 @@ void MyQT::createMap(int n)
m_render_topo
->
setInitialDartsColor
(
0.5
f
,
0.5
f
,
0.5
f
);
m_render_topo
->
setInitialBoundaryDartsColor
(
0.3
f
,
0.3
f
,
0.3
f
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
dock
.
withBoundary
->
isChecked
());
m_render_topo
->
updateData
(
myMap
,
position
,
0.9
f
,
0.9
f
,
dock
.
withBoundary
->
isChecked
());
for
(
Dart
d
=
myMap
.
begin
();
d
!=
myMap
.
end
();
myMap
.
next
(
d
))
for
(
Dart
d
=
myMap
.
begin
();
d
!=
myMap
.
end
();
myMap
.
next
(
d
))
{
if
(
dm
.
isMarked
(
d
)
&&
(
!
myMap
.
isBoundaryMarked
2
(
d
)))
if
(
dm
.
isMarked
(
d
)
&&
(
!
myMap
.
isBoundaryMarked
<
2
>
(
d
)))
{
colorDarts
[
d
]
=
Geom
::
Vec3f
(
0.5
f
,
0.5
f
,
0.5
f
);
m_render_topo
->
setDartColor
(
d
,
0.5
f
,
0.5
f
,
0.5
f
);
...
...
@@ -204,10 +199,10 @@ void MyQT::createMap(int n)
void
MyQT
::
updateMap
()
{
m_render_topo
->
setInitialBoundaryDartsColor
(
0.0
f
,
0.0
f
,
0.0
f
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
dock
.
withBoundary
->
isChecked
());
for
(
Dart
d
=
myMap
.
begin
();
d
!=
myMap
.
end
();
myMap
.
next
(
d
))
m_render_topo
->
updateData
(
myMap
,
position
,
0.9
f
,
0.9
f
,
dock
.
withBoundary
->
isChecked
());
for
(
Dart
d
=
myMap
.
begin
();
d
!=
myMap
.
end
();
myMap
.
next
(
d
))
{
if
(
dm
.
isMarked
(
d
)
&&
(
!
myMap
.
isBoundaryMarked
2
(
d
)))
if
(
dm
.
isMarked
(
d
)
&&
(
!
myMap
.
isBoundaryMarked
<
2
>
(
d
)))
{
const
Geom
::
Vec3f
&
C
=
colorDarts
[
d
];
if
(
C
*
C
!=
0.0
f
)
...
...
@@ -221,7 +216,11 @@ void MyQT::updateMap()
void
MyQT
::
cb_initGL
()
{
glClearColor
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
);
m_render_topo
=
new
Algo
::
Render
::
GL2
::
TopoRender
(
0.01
f
)
;
#ifdef USE_GMAP
m_render_topo
=
new
Algo
::
Render
::
GL2
::
TopoRenderGMap
<
PFP
>
(
0.01
f
)
;
#else
m_render_topo
=
new
Algo
::
Render
::
GL2
::
TopoRenderMap
<
PFP
>
(
0.01
f
)
;
#endif
}
// redraw GL callback (clear and swap already done)
...
...
@@ -245,16 +244,14 @@ void MyQT::cb_mousePress(int button, int x, int y)
{
if
(
Shift
())
{
Dart
d
=
m_render_topo
->
picking
<
PFP
>
(
myMap
,
x
,
y
);
// nb
Dart
d
=
m_render_topo
->
picking
(
myMap
,
x
,
y
);
// nb
if
(
button
==
Qt
::
LeftButton
)
{
if
(
d
!=
Dart
::
nil
())
m_selected
=
d
;
if
(
d
!=
Dart
::
nil
())
std
::
cout
<<
"DART="
<<
d
.
index
<<
std
::
endl
;
std
::
cout
<<
"DART="
<<
d
.
index
<<
std
::
endl
;
}
if
(
button
==
Qt
::
RightButton
)
{
...
...
@@ -269,11 +266,10 @@ void MyQT::cb_keyPress(int keycode)
{
switch
(
keycode
)
{
case
'c'
:
for
(
Dart
d
=
myMap
.
begin
();
d
!=
myMap
.
end
();
myMap
.
next
(
d
))
{
if
(
!
myMap
.
isBoundaryMarked
2
(
d
))
if
(
!
myMap
.
isBoundaryMarked
<
2
>
(
d
))
{
int
n
=
rand
();
float
r
=
float
(
n
&
0x7f
)
/
255.0
f
+
0.25
f
;
...
...
@@ -295,7 +291,7 @@ void MyQT::cb_keyPress(int keycode)
case
'h'
:
for
(
Dart
d
=
myMap
.
begin
();
d
!=
myMap
.
end
();
myMap
.
next
(
d
))
{
if
(
!
myMap
.
isBoundaryMarked
2
(
d
))
if
(
!
myMap
.
isBoundaryMarked
<
2
>
(
d
))
{
colorDarts
[
d
]
=
Geom
::
Vec3f
(
0.0
f
,
0.0
f
,
0.0
f
);
m_render_topo
->
setDartColor
(
d
,
0.0
f
,
0.0
f
,
0.0
f
);
...
...
@@ -387,9 +383,9 @@ void MyQT::importMesh(std::string& filename)
if
(
!
colorDarts
.
isValid
())
{
colorDarts
=
myMap
.
addAttribute
<
VEC3
,
DART
>
(
"color"
);
for
(
Dart
d
=
myMap
.
begin
();
d
!=
myMap
.
end
();
myMap
.
next
(
d
))
for
(
Dart
d
=
myMap
.
begin
();
d
!=
myMap
.
end
();
myMap
.
next
(
d
))
{
if
(
dm
.
isMarked
(
d
)
&&
(
!
myMap
.
isBoundaryMarked
2
(
d
)))
if
(
dm
.
isMarked
(
d
)
&&
(
!
myMap
.
isBoundaryMarked
<
2
>
(
d
)))
{
int
n
=
rand
();
float
r
=
float
(
n
&
0x7f
)
/
255.0
f
+
0.25
f
;
...
...
@@ -412,11 +408,9 @@ void MyQT::importMesh(std::string& filename)
updateGLMatrices
()
;
}
void
MyQT
::
width
(
int
w
)
{
m_render_topo
->
setDartWidth
(
w
);
m_render_topo
->
setRelationWidth
(
w
);
updateGL
();
}
Apps/SandBox/test_traversor2.h
View file @
a5aeb607
...
...
@@ -58,16 +58,22 @@ struct PFP: public PFP_STANDARD
#endif
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
PFP
::
VEC3
VEC3
;
class
MyQT
:
public
Utils
::
QT
::
SimpleQT
{
Q_OBJECT
public:
MyQT
()
:
m_render_topo
(
NULL
),
m_selected
(
NIL
),
m_selected2
(
NIL
),
dm
(
myMap
),
m_shift
(
0.01
f
)
{}
MyQT
()
:
m_render_topo
(
NULL
),
m_selected
(
NIL
),
m_selected2
(
NIL
),
dm
(
myMap
),
m_shift
(
0.01
f
)
{}
void
cb_redraw
();
void
cb_initGL
();
...
...
@@ -82,15 +88,19 @@ protected:
// declaration of the map
MAP
myMap
;
VertexAttribute
<
VEC3
>
position
;
DartAttribute
<
VEC3
>
colorDarts
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>
position
;
DartAttribute
<
VEC3
,
MAP_IMPL
>
colorDarts
;
// render (for the topo)
Algo
::
Render
::
GL2
::
TopoRender
*
m_render_topo
;
#ifdef USE_GMAP
Algo
::
Render
::
GL2
::
TopoRenderGMap
<
PFP
>*
m_render_topo
;
#else
Algo
::
Render
::
GL2
::
TopoRenderMap
<
PFP
>*
m_render_topo
;
#endif
Dart
m_selected
;
Dart
m_selected2
;
DartMarker
dm
;
DartMarker
<
MAP
>
dm
;
float
m_shift
;
// just for more compact writing
...
...
include/Topology/generic/traversor2.hpp
View file @
a5aeb607
...
...
@@ -316,7 +316,7 @@ Traversor2EF<MAP>::Traversor2EF(const MAP& map, Dart dart) : m(map), start(dart)
}
else
{
if
(
m
.
isBoundaryMarked2
(
start
))
if
(
m
.
template
isBoundaryMarked
<
2
>
(
start
))
start
=
m
.
phi2
(
start
)
;
}
}
...
...
@@ -350,7 +350,7 @@ Dart Traversor2EF<MAP>::next()
if
(
current
!=
NIL
)
{
current
=
m
.
phi2
(
current
)
;
if
(
current
==
start
||
m
.
isBoundaryMarked2
(
current
))
// do not consider a boundary face
if
(
current
==
start
||
m
.
template
isBoundaryMarked
<
2
>
(
current
))
// do not consider a boundary face
current
=
NIL
;
}
return
current
;
...
...
@@ -424,7 +424,7 @@ Traversor2EEaF<MAP>::Traversor2EEaF(const MAP& map, Dart dart) :
}
else
{
if
(
m
.
isBoundaryMarked2
(
dart
))
if
(
m
.
template
isBoundaryMarked
<
2
>
(
dart
))
stop1
=
m
.
phi2
(
dart
);
else
stop1
=
dart
;
...
...
@@ -464,7 +464,7 @@ Dart Traversor2EEaF<MAP>::next()
current
=
m
.
phi1
(
current
)
;
if
(
current
==
stop1
)
{
if
(
!
m
.
isBoundaryMarked2
(
stop2
))
if
(
!
m
.
template
isBoundaryMarked
<
2
>
(
stop2
))
current
=
m
.
phi1
(
stop2
)
;
else
current
=
NIL
;
...
...
@@ -615,7 +615,7 @@ Traversor2FFaE<MAP>::Traversor2FFaE(const MAP& map, Dart dart) : m(map),m_QLT(NU
else
{
start
=
m
.
phi2
(
dart
)
;
while
(
start
!=
NIL
&&
m
.
isBoundaryMarked2
(
start
))
while
(
start
!=
NIL
&&
m
.
template
isBoundaryMarked
<
2
>
(
start
))
{
start
=
m
.
phi2
(
m
.
phi1
(
m
.
phi2
(
start
)))
;
if
(
start
==
m
.
phi2
(
dart
))
...
...
@@ -655,7 +655,7 @@ Dart Traversor2FFaE<MAP>::next()
do
{
current
=
m
.
phi2
(
m
.
phi1
(
m
.
phi2
(
current
)))
;
}
while
(
m
.
isBoundaryMarked2
(
current
))
;
}
while
(
m
.
template
isBoundaryMarked
<
2
>
(
current
))
;
if
(
current
==
start
)
current
=
NIL
;
}
...
...
include/Topology/generic/traversor2Virt.hpp
View file @
a5aeb607
...
...
@@ -423,7 +423,7 @@ VTraversor2EEaF<MAP>::VTraversor2EEaF(const MAP& map, Dart dart) : m(map),m_QLT(
}
else
{
if
(
m
.
isBoundaryMarked2
(
dart
))
if
(
m
.
template
isBoundaryMarked
<
2
>
(
dart
))
stop1
=
m
.
phi2
(
dart
);
else
stop1
=
dart
;
...
...
@@ -463,7 +463,7 @@ Dart VTraversor2EEaF<MAP>::next()
current
=
m
.
phi1
(
current
)
;
if
(
current
==
stop1
)
{
if
(
!
m
.
isBoundaryMarked2
(
stop2
))
if
(
!
m
.
template
isBoundaryMarked
<
2
>
(
stop2
))
current
=
m
.
phi1
(
stop2
)
;
else
current
=
NIL
;
...
...
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