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
68944bbf
Commit
68944bbf
authored
Nov 08, 2011
by
Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug de catmull-clark sur gcarte inexistant : pb d affichage en fait..
parent
ebe54c68
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
114 additions
and
63 deletions
+114
-63
Apps/Examples/simpleGMap3.cpp
Apps/Examples/simpleGMap3.cpp
+36
-31
Apps/Examples/simpleGMap3.h
Apps/Examples/simpleGMap3.h
+2
-0
include/Algo/Modelisation/subdivision3map.hpp
include/Algo/Modelisation/subdivision3map.hpp
+27
-25
include/Algo/Render/GL1/topo_render.hpp
include/Algo/Render/GL1/topo_render.hpp
+7
-3
include/Topology/gmap/embeddedGMap3.h
include/Topology/gmap/embeddedGMap3.h
+6
-0
src/Topology/gmap/embeddedGMap3.cpp
src/Topology/gmap/embeddedGMap3.cpp
+36
-4
No files found.
Apps/Examples/simpleGMap3.cpp
View file @
68944bbf
...
...
@@ -32,6 +32,7 @@
SimpleGMap3
::
SimpleGMap3
()
{
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
);
normal
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
);
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Dart
d
=
primCat
.
hexaGrid_topo
(
2
,
1
,
1
);
...
...
@@ -39,43 +40,41 @@ SimpleGMap3::SimpleGMap3()
myMap
.
check
();
// DartMarker markOrient(myMap);
// std::vector<Dart> orient;
// FunctorStore fs(orient);
// myMap.foreach_dart_of_oriented_volume(d,fs);
//
// for(std::vector<Dart>::iterator it = orient.begin() ; it != orient.end() ; ++it)
// markOrient.mark(*it);
//
// SelectorMarked sm(markOrient);
DartMarker
markOrient
(
myMap
);
std
::
vector
<
Dart
>
orient
;
FunctorStore
fs
(
orient
);
myMap
.
foreach_dart_of_oriented_volume
(
d
,
fs
);
Algo
::
Modelisation
::
catmullClarkVol
<
PFP
,
PFP
::
TVEC3
,
PFP
::
VEC3
>
(
myMap
,
position
);
for
(
std
::
vector
<
Dart
>::
iterator
it
=
orient
.
begin
()
;
it
!=
orient
.
end
()
;
++
it
)
markOrient
.
mark
(
*
it
);
SelectorMarked
sm
(
markOrient
);
Algo
::
Modelisation
::
catmullClarkVol
<
PFP
,
PFP
::
TVEC3
,
PFP
::
VEC3
>
(
myMap
,
position
,
sm
);
for
(
unsigned
int
i
=
position
.
begin
()
;
i
!=
position
.
end
()
;
position
.
next
(
i
))
position
[
i
]
+=
VEC3
(
2
,
0
,
0
);
// Algo::Modelisation::Primitive3D<PFP> prim(myMap,position);
// d = prim.hexaGrid_topo(2,2,1);
// prim.embedHexaGrid(1,1,1);
//
// Dart d1 = myMap.phi1(myMap.phi1(myMap.phi2(myMap.phi1(myMap.phi1(d)))));
// VEC3 mid0 = (position[d1]+position[myMap.phi1(d1)])/2.0f;
// myMap.cutEdge(d1);
// position[myMap.phi1(d1)] = mid0;
//
// VEC3 mid1 = (position[d]+position[myMap.phi1(d)])/2.0f;
// myMap.cutEdge(d);
// position[myMap.phi1(d)] = mid1;
//
// d = myMap.phi1(myMap.phi1(myMap.phi2(myMap.phi1(myMap.phi1(d)))));
// VEC3 mid = (position[d]+position[myMap.phi1(d)])/2.0f;
// myMap.cutEdge(d);
// position[myMap.phi1(d)] = mid;
//
// for(unsigned int i = position.begin() ; i != position.end() ; position.next(i))
// position[i] += VEC3(0,2,0);
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
myMap
,
position
);
d
=
prim
.
hexaGrid_topo
(
2
,
2
,
1
);
prim
.
embedHexaGrid
(
1
,
1
,
1
);
myMap
.
check
();
Dart
d1
=
myMap
.
phi1
(
myMap
.
phi1
(
myMap
.
phi2
(
myMap
.
phi1
(
myMap
.
phi1
(
d
)))));
VEC3
mid0
=
(
position
[
d1
]
+
position
[
myMap
.
phi1
(
d1
)])
/
2.0
f
;
myMap
.
cutEdge
(
d1
);
position
[
myMap
.
phi1
(
d1
)]
=
mid0
;
VEC3
mid1
=
(
position
[
d
]
+
position
[
myMap
.
phi1
(
d
)])
/
2.0
f
;
myMap
.
cutEdge
(
d
);
position
[
myMap
.
phi1
(
d
)]
=
mid1
;
d
=
myMap
.
phi1
(
myMap
.
phi1
(
myMap
.
phi2
(
myMap
.
phi1
(
myMap
.
phi1
(
d
)))));
VEC3
mid
=
(
position
[
d
]
+
position
[
myMap
.
phi1
(
d
)])
/
2.0
f
;
myMap
.
cutEdge
(
d
);
position
[
myMap
.
phi1
(
d
)]
=
mid
;
for
(
unsigned
int
i
=
position
.
begin
()
;
i
!=
position
.
end
()
;
position
.
next
(
i
))
position
[
i
]
+=
VEC3
(
0
,
2
,
0
);
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
prim2
(
myMap
,
position
);
d
=
prim2
.
hexaGrid_topo
(
2
,
1
,
1
);
...
...
@@ -110,6 +109,12 @@ 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
);
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
);
}
...
...
Apps/Examples/simpleGMap3.h
View file @
68944bbf
...
...
@@ -31,6 +31,7 @@
#include "Geometry/vector_gen.h"
#include "Algo/Render/GL1/map_glRender.h"
#include "Algo/Render/GL1/topo_render.h"
using
namespace
CGoGN
;
...
...
@@ -53,6 +54,7 @@ public:
SelectorTrue
allDarts
;
PFP
::
TVEC3
position
;
PFP
::
TVEC3
normal
;
SimpleGMap3
()
;
...
...
include/Algo/Modelisation/subdivision3map.hpp
View file @
68944bbf
...
...
@@ -224,22 +224,22 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
d
=
dN
;
}
while
(
*
it
!=
d
);
//
//close the generated hole and create the central vertex
//
unsigned int degree = map.closeHole(map.phi1(d));
//
//
Dart dd = map.phi1(map.phi2(map.phi1(d)));
//
map.splitFace(map.phi_1(dd),map.phi1(dd));
//
Dart dS = map.phi1(dd);
//
map.cutEdge(dS);
//
//
attributs[map.phi1(dS)] = attBary[d];
//
//
//TODO : test with vertices with degree higher than 3
//
for(unsigned int i=0; i < (degree/2)-2; ++i)
//
{
//
map.splitFace(map.phi2(dS),map.template phi<111>(map.phi2(dS)));
//
dS = map.template phi<111>(map.phi2(dS));
//
}
//close the generated hole and create the central vertex
unsigned
int
degree
=
map
.
closeHole
(
map
.
phi1
(
d
));
Dart
dd
=
map
.
phi1
(
map
.
phi2
(
map
.
phi1
(
d
)));
map
.
splitFace
(
map
.
phi_1
(
dd
),
map
.
phi1
(
dd
));
Dart
dS
=
map
.
phi1
(
dd
);
map
.
cutEdge
(
dS
);
attributs
[
map
.
phi1
(
dS
)]
=
attBary
[
d
];
//TODO : test with vertices with degree higher than 3
for
(
unsigned
int
i
=
0
;
i
<
(
degree
/
2
)
-
2
;
++
i
)
{
map
.
splitFace
(
map
.
phi2
(
dS
),
map
.
template
phi
<
111
>(
map
.
phi2
(
dS
)));
dS
=
map
.
template
phi
<
111
>(
map
.
phi2
(
dS
));
}
}
nb_
=
0
;
...
...
@@ -248,15 +248,17 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
std
::
cout
<<
"then "
<<
nb_
<<
std
::
endl
;
// //sew all faces leading to the central vertex
// for (std::map<Dart,Dart>::iterator it = toSew.begin(); it != toSew.end(); ++it)
// {
// Dart dT = map.phi2(it->first);
// if(dT==map.phi3(dT))
// {
// map.sewVolumes(dT,map.phi2(it->second));
// }
// }
map
.
check
();
//sew all faces leading to the central vertex
for
(
std
::
map
<
Dart
,
Dart
>::
iterator
it
=
toSew
.
begin
();
it
!=
toSew
.
end
();
++
it
)
{
Dart
dT
=
map
.
phi2
(
it
->
first
);
if
(
dT
==
map
.
phi3
(
dT
))
{
map
.
sewVolumes
(
dT
,
map
.
phi2
(
it
->
second
));
}
}
}
}
//namespace Modelisation
...
...
include/Algo/Render/GL1/topo_render.hpp
View file @
68944bbf
...
...
@@ -436,12 +436,17 @@ void renderTopoGMD3(typename PFP::MAP& map, const typename PFP::TVEC3& positions
vecVolCenters
.
reserve
(
vecDartFaces
.
size
()
/
4
);
// = nb of volumes for a tetra mesh
DartMarker
mark
(
map
);
// marker for darts
CellMarker
mVol
(
map
,
VOLUME
);
// CellMarker mVol(map, VOLUME);
DartMarker
mVol
(
map
);
//compute barycenter and get a dart by face
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
!
mVol
.
isMarked
(
d
))
{
mVol
.
mark
(
d
);
// mVol.mark(d);
mVol
.
markOrbit
(
VOLUME
,
d
);
CellMarkerStore
markVert
(
map
,
VERTEX
);
//marker for vertices
VEC3
center
(
0
);
unsigned
int
nbVertices
=
0
;
...
...
@@ -461,7 +466,6 @@ void renderTopoGMD3(typename PFP::MAP& map, const typename PFP::TVEC3& positions
do
{
mark
.
mark
(
dNext
);
// Mark
// mark.mark(map.beta0(dNext));
if
(
!
markVert
.
isMarked
(
dNext
))
{
...
...
include/Topology/gmap/embeddedGMap3.h
View file @
68944bbf
...
...
@@ -39,6 +39,12 @@ class EmbeddedGMap3 : public GMap3
public:
typedef
GMap3
TOPO_MAP
;
//!
/*!
*
*/
virtual
void
unsewFaces
(
Dart
d
);
//!
/*!
*
...
...
src/Topology/gmap/embeddedGMap3.cpp
View file @
68944bbf
...
...
@@ -30,6 +30,36 @@
namespace
CGoGN
{
void
EmbeddedGMap3
::
unsewFaces
(
Dart
d
)
{
Dart
e
=
beta2
(
d
);
GMap3
::
unsewFaces
(
d
);
if
(
isOrbitEmbedded
(
VERTEX
))
{
if
(
!
sameVertex
(
d
,
e
))
{
embedNewCell
(
VERTEX
,
e
);
copyCell
(
VERTEX
,
e
,
d
);
}
d
=
beta0
(
d
);
e
=
beta0
(
e
);
if
(
!
sameVertex
(
d
,
e
))
{
embedNewCell
(
VERTEX
,
e
);
copyCell
(
VERTEX
,
e
,
d
);
}
}
if
(
isOrbitEmbedded
(
EDGE
))
{
embedNewCell
(
EDGE
,
e
);
copyCell
(
EDGE
,
e
,
d
);
}
}
void
EmbeddedGMap3
::
sewVolumes
(
Dart
d
,
Dart
e
)
{
//topological sewing
...
...
@@ -41,7 +71,8 @@ void EmbeddedGMap3::sewVolumes(Dart d, Dart e)
{
unsigned
int
vEmb1
=
EMBNULL
;
Dart
dd
=
d
;
do
{
do
{
vEmb1
=
getEmbedding
(
VERTEX
,
dd
);
embedOrbit
(
VERTEX
,
dd
,
vEmb1
)
;
dd
=
phi1
(
dd
)
;
...
...
@@ -54,9 +85,10 @@ void EmbeddedGMap3::sewVolumes(Dart d, Dart e)
{
unsigned
int
vEmb1
=
EMBNULL
;
Dart
dd
=
d
;
do
{
vEmb1
=
getEmbedding
(
EDGE
,
d
);
embedOrbit
(
EDGE
,
d
,
vEmb1
)
;
do
{
vEmb1
=
getEmbedding
(
EDGE
,
dd
);
embedOrbit
(
EDGE
,
dd
,
vEmb1
)
;
dd
=
phi1
(
dd
)
;
}
while
(
dd
!=
d
)
;
}
...
...
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