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
0dc114ac
Commit
0dc114ac
authored
Dec 08, 2011
by
Pierre Kraemer
Browse files
Merge cgogn:~jund/CGoGN
Conflicts: Apps/Examples/simpleGMap3.cpp
parents
156f13bd
53d599e2
Changes
11
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/simpleGMap3.cpp
View file @
0dc114ac
...
...
@@ -28,21 +28,23 @@
#include
"Algo/Modelisation/primitives3d.h"
#include
"Algo/Modelisation/subdivision3.h"
SimpleGMap3
::
SimpleGMap3
()
{
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
);
normal
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"normal"
);
volume
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VOLUME
,
"volume"
);
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Dart
d
=
primCat
.
hexaGrid_topo
(
2
,
1
,
1
);
primCat
.
embedHexaGrid
(
1
,
1
,
1
);
Dart
d
=
primCat
.
hexaGrid_topo
(
3
,
1
,
1
);
primCat
.
embedHexaGrid
(
2
,
1
,
1
);
myMap
.
check
();
DartMarker
markOrient
(
myMap
);
std
::
vector
<
Dart
>
orient
;
FunctorStore
fs
(
orient
);
d
=
49
;
myMap
.
foreach_dart_of_oriented_volume
(
d
,
fs
);
for
(
std
::
vector
<
Dart
>::
iterator
it
=
orient
.
begin
()
;
it
!=
orient
.
end
()
;
++
it
)
...
...
Apps/Examples/simpleGMap3.h
View file @
0dc114ac
...
...
@@ -54,6 +54,7 @@ public:
PFP
::
TVEC3
position
;
PFP
::
TVEC3
normal
;
PFP
::
TVEC3
volume
;
SimpleGMap3
()
;
...
...
include/Algo/Modelisation/subdivision3.hpp
View file @
0dc114ac
...
...
@@ -38,51 +38,49 @@ namespace Modelisation
template
<
typename
PFP
>
Dart
cut3Ear
(
typename
PFP
::
MAP
&
map
,
Dart
d
)
{
Dart
e
=
d
;
int
nb
=
0
;
Dart
dNew
;
Dart
dRing
;
Dart
dRing2
;
//count the valence of the vertex
do
{
nb
++
;
e
=
map
.
phi1
(
map
.
phi2
(
e
));
}
while
(
e
!=
d
);
if
(
nb
<
3
)
{
CGoGNout
<<
"Warning : cannot cut 2 volumes without creating a degenerated face "
<<
CGoGNendl
;
return
d
;
}
else
{
//triangulate around the vertex
Dart
e
=
d
;
int
nb
=
0
;
Dart
dNew
;
Dart
dRing
;
Dart
dRing2
;
//count the valence of the vertex
do
{
Dart
dN
=
map
.
phi1
(
map
.
phi2
(
e
));
if
(
map
.
template
phi
<
111
>(
e
)
!=
e
)
map
.
splitFace
(
map
.
phi_1
(
e
),
map
.
phi1
(
e
));
dRing
=
map
.
phi1
(
e
);
dRing2
=
map
.
phi2
(
dRing
);
nb
++
;
e
=
map
.
phi1
(
map
.
phi2
(
e
));
}
while
(
e
!=
d
);
map
.
unsewFaces
(
dRing
);
if
(
nb
<
3
)
{
CGoGNout
<<
"Warning : cannot cut 2 volumes without creating a degenerated face "
<<
CGoGNendl
;
return
d
;
}
else
{
//triangulate around the vertex
do
{
Dart
dN
=
map
.
phi1
(
map
.
phi2
(
e
));
if
(
map
.
template
phi
<
111
>(
e
)
!=
e
)
map
.
splitFace
(
map
.
phi_1
(
e
),
map
.
phi1
(
e
));
e
=
dN
;
}
while
(
e
!=
d
);
dRing
=
map
.
phi1
(
e
)
;
dRing2
=
map
.
phi2
(
dRing
);
map
.
closeHole
(
dRing
);
map
.
closeHole
(
dRing2
);
map
.
sewVolumes
(
map
.
phi2
(
dRing
),
map
.
phi2
(
dRing2
));
}
map
.
unsewFaces
(
dRing
);
return
map
.
phi2
(
dRing
)
;
}
e
=
dN
;
}
while
(
e
!=
d
);
map
.
closeHole
(
dRing
);
map
.
closeHole
(
dRing2
);
map
.
sewVolumes
(
map
.
phi2
(
dRing
),
map
.
phi2
(
dRing2
));
}
return
map
.
phi2
(
dRing
);
}
template
<
typename
PFP
,
typename
EMBV
,
typename
EMB
>
void
catmullClarkVol
(
typename
PFP
::
MAP
&
map
,
EMBV
&
attributs
,
const
FunctorSelect
&
selected
)
...
...
@@ -113,7 +111,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
//memorize each vertices per volumes
if
(
selected
(
d
)
&&
!
mv
.
isMarked
(
d
))
{
std
::
cout
<<
" d "
<<
d
<<
std
::
endl
;
l_vertices
.
push_back
(
d
);
mv
.
markOrbitInParent
<
typename
PFP
::
MAP
>
(
VERTEX
,
d
);
}
...
...
@@ -145,12 +142,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
}
}
unsigned
int
nb_
=
0
;
for
(
unsigned
int
nb
=
attributs
.
begin
()
;
nb
!=
attributs
.
end
()
;
attributs
.
next
(
nb
))
nb_
++
;
std
::
cout
<<
"first "
<<
nb_
<<
std
::
endl
;
// second pass: quandrangule faces
std
::
map
<
Dart
,
Dart
>
toSew
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
...
...
@@ -230,12 +221,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
}
}
nb_
=
0
;
for
(
unsigned
int
nb
=
attributs
.
begin
()
;
nb
!=
attributs
.
end
()
;
attributs
.
next
(
nb
))
nb_
++
;
std
::
cout
<<
"then "
<<
nb_
<<
std
::
endl
;
map
.
check
();
//sew all faces leading to the central vertex
...
...
@@ -249,12 +234,9 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
}
}
}
//namespace Modelisation
}
//namespace Algo
}
//namespace CGoGN
include/Algo/MovingObjects/particle_base.h
View file @
0dc114ac
...
...
@@ -31,6 +31,11 @@ class ParticleBase
m_position
=
position
;
}
virtual
unsigned
int
getState
()
{
return
0
;
}
/**
* @param newPosition new position to reach
*/
...
...
include/Algo/MovingObjects/particle_cell_2D.h
View file @
0dc114ac
...
...
@@ -76,6 +76,11 @@ public :
void
faceState
(
const
VEC3
&
current
);
virtual
unsigned
int
getState
()
{
return
state
;
}
void
move
(
const
VEC3
&
newCurrent
)
{
crossCell
=
NO_CROSS
;
...
...
include/Algo/MovingObjects/particle_cell_2DandHalf.h
View file @
0dc114ac
...
...
@@ -70,6 +70,11 @@ public :
void
faceState
(
VEC3
current
);
virtual
unsigned
int
getState
()
{
return
state
;
}
void
move
(
const
VEC3
&
newCurrent
)
{
crossCell
=
NO_CROSS
;
...
...
include/Algo/MovingObjects/particle_cell_2DandHalf.hpp
View file @
0dc114ac
...
...
@@ -221,6 +221,16 @@ void ParticleCell2DAndHalf<PFP>::faceState(VEC3 current)
assert
(
std
::
isfinite
(
current
[
0
])
&&
std
::
isfinite
(
current
[
1
])
&&
std
::
isfinite
(
current
[
2
]));
// assert(Algo::Geometry::isPointInConvexFace2D<PFP>(m,d,m_positions,m_position,true));
//project current within plane
VEC3
n1
=
Algo
::
Geometry
::
faceNormal
<
PFP
>
(
m
,
d
,
m_positions
);
VEC3
n2
=
current
-
m_position
;
n1
.
normalize
();
VEC3
n3
=
n1
^
n2
;
n3
.
normalize
();
VEC3
n4
=
n3
^
n1
;
current
=
m_position
+
(
n2
*
n4
)
*
n4
;
//track new position within map
Dart
dd
=
d
;
float
wsoe
=
getOrientationFace
(
current
,
m_position
,
m
.
phi1
(
d
));
...
...
include/Algo/Render/GL2/topoRender.hpp
View file @
0dc114ac
...
...
@@ -182,7 +182,7 @@ void TopoRenderMapD::updateData(typename PFP::MAP& map, const typename PFP::TVEC
template
<
typename
PFP
>
void
TopoRenderGMap
::
updateData
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
positions
,
float
ke
,
float
kf
,
const
FunctorSelect
&
good
)
{
/*
/*
typedef typename PFP::VEC3 VEC3;
typedef typename PFP::REAL REAL;
...
...
include/Utils/pickables.h
View file @
0dc114ac
...
...
@@ -24,7 +24,7 @@
#ifndef __PICKABLES_H_
#define __PICKABLE_H_
#define __PICKABLE
S
_H_
#include
"Utils/vbo.h"
#include
"glm/glm.hpp"
...
...
@@ -270,7 +270,7 @@ class Grid: public LineDrawable
public:
/**
* constructor
* @param sub number of subdivision of gri
g
* @param sub number of subdivision of gri
d
*/
Grid
(
unsigned
int
sub
=
5
);
...
...
src/Topology/gmap/embeddedGMap3.cpp
View file @
0dc114ac
...
...
@@ -394,8 +394,8 @@ bool EmbeddedGMap3::check()
if
(
isOrbitEmbedded
(
VERTEX
))
{
if
(
getEmbedding
(
VERTEX
,
d
)
!=
getEmbedding
(
VERTEX
,
beta1
(
d
))
||
getEmbedding
(
VERTEX
,
d
)
!=
getEmbedding
(
VERTEX
,
beta2
(
d
))
||
getEmbedding
(
VERTEX
,
d
)
!=
getEmbedding
(
VERTEX
,
beta3
(
d
))
)
getEmbedding
(
VERTEX
,
d
)
!=
getEmbedding
(
VERTEX
,
beta2
(
d
))
||
getEmbedding
(
VERTEX
,
d
)
!=
getEmbedding
(
VERTEX
,
beta3
(
d
))
)
{
std
::
cout
<<
"Embedding Check : different embeddings on vertex"
<<
std
::
endl
;
return
false
;
...
...
@@ -405,8 +405,8 @@ bool EmbeddedGMap3::check()
if
(
isOrbitEmbedded
(
EDGE
))
{
if
(
getEmbedding
(
EDGE
,
d
)
!=
getEmbedding
(
EDGE
,
beta0
(
d
))
||
getEmbedding
(
EDGE
,
d
)
!=
getEmbedding
(
EDGE
,
beta2
(
d
))
||
getEmbedding
(
EDGE
,
d
)
!=
getEmbedding
(
EDGE
,
beta3
(
d
))
)
getEmbedding
(
EDGE
,
d
)
!=
getEmbedding
(
EDGE
,
beta2
(
d
))
||
getEmbedding
(
EDGE
,
d
)
!=
getEmbedding
(
EDGE
,
beta3
(
d
))
)
{
std
::
cout
<<
"Embedding Check : different embeddings on edge"
<<
std
::
endl
;
return
false
;
...
...
@@ -416,8 +416,8 @@ bool EmbeddedGMap3::check()
if
(
isOrbitEmbedded
(
FACE
))
{
if
(
getEmbedding
(
FACE
,
d
)
!=
getEmbedding
(
FACE
,
beta0
(
d
))
||
getEmbedding
(
FACE
,
d
)
!=
getEmbedding
(
FACE
,
beta1
(
d
))
||
getEmbedding
(
FACE
,
d
)
!=
getEmbedding
(
FACE
,
beta3
(
d
))
)
getEmbedding
(
FACE
,
d
)
!=
getEmbedding
(
FACE
,
beta1
(
d
))
||
getEmbedding
(
FACE
,
d
)
!=
getEmbedding
(
FACE
,
beta3
(
d
))
)
{
CGoGNout
<<
"Check: different embeddings on face"
<<
CGoGNendl
;
return
false
;
...
...
@@ -427,8 +427,8 @@ bool EmbeddedGMap3::check()
if
(
isOrbitEmbedded
(
VOLUME
))
{
if
(
getEmbedding
(
VOLUME
,
d
)
!=
getEmbedding
(
VOLUME
,
beta0
(
d
))
||
getEmbedding
(
VOLUME
,
d
)
!=
getEmbedding
(
VOLUME
,
beta1
(
d
))
||
getEmbedding
(
VOLUME
,
d
)
!=
getEmbedding
(
VOLUME
,
beta2
(
d
))
)
getEmbedding
(
VOLUME
,
d
)
!=
getEmbedding
(
VOLUME
,
beta1
(
d
))
||
getEmbedding
(
VOLUME
,
d
)
!=
getEmbedding
(
VOLUME
,
beta2
(
d
))
)
{
CGoGNout
<<
"Check: different embeddings on volume"
<<
CGoGNendl
;
return
false
;
...
...
@@ -441,3 +441,4 @@ bool EmbeddedGMap3::check()
}
}
// namespace CGoGN
src/Utils/pickables.cpp
View file @
0dc114ac
...
...
@@ -134,7 +134,6 @@ glm::mat4& Pickable::transfo()
return
m_transfo
;
}
void
Pickable
::
rotate
(
float
angle
,
const
Geom
::
Vec3f
&
Axis
)
{
m_transfo
=
glm
::
rotate
(
m_transfo
,
angle
,
glm
::
vec3
(
Axis
[
0
],
Axis
[
1
],
Axis
[
2
]));
...
...
@@ -472,7 +471,7 @@ unsigned int Sphere::pick(const Geom::Vec3f& P, const Geom::Vec3f& V, Geom::Vec3
I
=
P
;
I
.
normalize
();
// grossiere approximation TODO amelio
e
rer approxim ?
I
.
normalize
();
// grossiere approximation TODO ameliorer approxim ?
return
1
;
}
...
...
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