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
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
David Cazier
CGoGN
Commits
ef3ac359
Commit
ef3ac359
authored
Jun 03, 2011
by
untereiner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add draw topo 3-maps opengl 1
parent
e7511757
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
256 additions
and
77 deletions
+256
-77
include/Algo/Render/GL1/topo_render.h
include/Algo/Render/GL1/topo_render.h
+7
-1
include/Algo/Render/GL1/topo_render.hpp
include/Algo/Render/GL1/topo_render.hpp
+249
-76
No files found.
include/Algo/Render/GL1/topo_render.h
View file @
ef3ac359
...
...
@@ -30,6 +30,8 @@
//#include <gmtl/Output.h>
#include <GL/gl.h>
#include "Topology/generic/functor.h"
// OpenGL direct mode rendering of darts of maps
namespace
CGoGN
...
...
@@ -76,7 +78,11 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi
* @param kv exploding coefficient for volumes (0.0 normal draw)
*/
template
<
typename
PFP
>
void
renderTopoMD3
(
typename
PFP
::
MAP
&
the_map
,
bool
drawPhi1
,
bool
drawPhi2
,
bool
drawPhi3
,
float
ke
,
float
kf
,
float
kv
,
FunctorType
&
good
);
void
renderTopoMD3
(
typename
PFP
::
MAP
&
the_map
,
const
typename
PFP
::
TVEC3
&
positions
,
bool
drawPhi1
,
bool
drawPhi2
,
bool
drawPhi3
,
float
ke
,
float
kf
,
float
kv
,
FunctorType
&
good
);
template
<
typename
PFP
>
void
renderTopoMD3
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
positions
,
bool
drawPhi1
,
bool
drawPhi2
,
bool
drawPhi3
,
float
ke
,
float
kf
,
float
kv
);
}
// end namespace
}
// end namespace
...
...
include/Algo/Render/GL1/topo_render.hpp
View file @
ef3ac359
...
...
@@ -25,6 +25,8 @@
#include <limits>
#include "Topology/generic/autoAttributeHandler.h"
#include "Geometry/vector_gen.h"
namespace
CGoGN
{
...
...
@@ -119,35 +121,35 @@ namespace GL1
//};
//
//template <typename PFP>
//void renderTopoGM2(typename PFP::MAP&
the_
map, Marker m)
//void renderTopoGM2(typename PFP::MAP& map, Marker m)
//{
//
//
// std::vector<gmtl::Vec3f> fv1;
// std::vector<gmtl::Vec3f> fv2;
// fv1.reserve(
the_
map.getNbDarts());
// fv2.reserve(
the_
map.getNbDarts());
// fv1.reserve(map.getNbDarts());
// fv2.reserve(map.getNbDarts());
//
// // first pass render the triangles
// FunctorGM2Face<PFP> fgl_gc(
the_
map,fv1,fv2,m);
// FunctorGM2Face<PFP> fgl_gc(map,fv1,fv2,m);
//
// glLineWidth(1.0f);
// glBegin(GL_LINES);
// glColor3f(1.0,1.0,1.0);
//
//
the_
map.foreach_orbit(2,fgl_gc);
// map.foreach_orbit(2,fgl_gc);
// glEnd();
// glLineWidth(2.0f);
// glBegin(GL_LINES);
// for(Dart d =
the_map.begin(); d!= the_map.end(); the_
map.next(d))
// for(Dart d =
map.begin(); d!= map.end();
map.next(d))
// {
// glColor3f(0.0,1.0,1.0);
// int i=d->getLabel();
// int j=(
the_
map.alpha1(d))->getLabel();
// int j=(map.alpha1(d))->getLabel();
// glVertex3fv(fv1[i].getData());
// glVertex3fv(fv1[j].getData());
// glColor3f(1.0,0.0,0.0);
// j=(
the_
map.alpha(2,d))->getLabel();
// j=(map.alpha(2,d))->getLabel();
// glVertex3fv(fv2[i].getData());
// glVertex3fv(fv2[j].getData());
// }
...
...
@@ -157,22 +159,22 @@ namespace GL1
template
<
typename
PFP
>
void
renderTopoMD2
(
typename
PFP
::
MAP
&
the_
map
,
const
typename
PFP
::
TVEC3
&
positions
,
bool
drawPhi1
,
bool
drawPhi2
,
float
ke
,
float
kf
)
void
renderTopoMD2
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
positions
,
bool
drawPhi1
,
bool
drawPhi2
,
float
ke
,
float
kf
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
AutoAttributeHandler
<
Geom
::
Vec3f
>
fv1
(
the_
map
,
DART
);
AutoAttributeHandler
<
Geom
::
Vec3f
>
fv11
(
the_
map
,
DART
);
AutoAttributeHandler
<
Geom
::
Vec3f
>
fv2
(
the_
map
,
DART
);
AutoAttributeHandler
<
Geom
::
Vec3f
>
vert
(
the_
map
,
DART
);
AutoAttributeHandler
<
Geom
::
Vec3f
>
fv1
(
map
,
DART
);
AutoAttributeHandler
<
Geom
::
Vec3f
>
fv11
(
map
,
DART
);
AutoAttributeHandler
<
Geom
::
Vec3f
>
fv2
(
map
,
DART
);
AutoAttributeHandler
<
Geom
::
Vec3f
>
vert
(
map
,
DART
);
glLineWidth
(
2.0
f
);
glColor3f
(
0.9
f
,
0.9
f
,
0.9
f
);
glBegin
(
GL_LINES
);
DartMarker
mf
(
the_
map
);
for
(
Dart
d
=
the_map
.
begin
();
d
!=
the_map
.
end
();
the_
map
.
next
(
d
))
DartMarker
mf
(
map
);
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
!
mf
.
isMarked
(
d
))
{
...
...
@@ -190,7 +192,7 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi
const
VEC3
&
P
=
positions
[
d
];
vecPos
.
push_back
(
positions
[
d
]);
center
+=
P
;
d
=
the_
map
.
phi1
(
d
);
d
=
map
.
phi1
(
d
);
}
while
(
d
!=
dd
);
center
/=
REAL
(
vecPos
.
size
());
...
...
@@ -217,15 +219,15 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi
fv1
[
d
]
=
f
;
f
=
P
*
0.9
f
+
Q
*
0.1
f
;
fv11
[
d
]
=
f
;
d
=
the_
map
.
phi1
(
d
);
d
=
map
.
phi1
(
d
);
}
mf
.
markOrbit
(
FACE
,
d
);
}
}
for
(
Dart
d
=
the_map
.
begin
();
d
!=
the_map
.
end
();
the_
map
.
next
(
d
))
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
Dart
e
=
the_
map
.
phi2
(
d
);
Dart
e
=
map
.
phi2
(
d
);
if
((
d
<
e
)
&&
drawPhi2
)
{
glColor3f
(
1.0
,
0.0
,
0.0
);
...
...
@@ -234,7 +236,7 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi
}
if
(
drawPhi1
)
{
e
=
the_
map
.
phi1
(
d
);
e
=
map
.
phi1
(
d
);
glColor3f
(
0.0
f
,
1.0
f
,
1.0
f
);
glVertex3fv
(
fv1
[
d
].
data
());
glVertex3fv
(
fv11
[
e
].
data
());
...
...
@@ -246,7 +248,7 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi
glPointSize
(
5.0
f
);
glColor3f
(
0.0
f
,
0.0
f
,
0.0
f
);
glBegin
(
GL_POINTS
);
for
(
Dart
d
=
the_map
.
begin
();
d
!=
the_map
.
end
();
the_
map
.
next
(
d
))
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
glVertex3fv
(
vert
[
d
].
data
());
}
...
...
@@ -254,54 +256,55 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi
}
//
//
//template<typename PFP>
//class FunctorMD3Face : public FunctorMap<typename PFP::MAP>
//{
// typedef typename PFP::MAP MAP;
// typedef typename PFP::
EMB EMB
;
// typedef typename PFP::
VEC3 VEC3
;
//
//
// protected:
// std::vector<
gmtl::Vec3f
>& m_vf1;
// std::vector<
VEC3
>& m_vf1;
//
//
gmtl::Vec3f
m_volCenter;
//
VEC3
m_volCenter;
// int m_lab;
// float m_ke;
// float m_kf;
// float m_kv;
//
Marker
m_mark;
//
DartMarkerStore
m_mark;
// bool m_drawPhi1;
//
// typename PFP::TVEC3 m_positions;
//
// public:
// FunctorMD3Face(MAP& map,
std::vector<gmtl::Vec3f
>& vf1, float ke, float kf, float kv, Marker m, bool df1):
// FunctorMap<MAP>(map), m_vf1(vf1), m_lab(0), m_ke(ke), m_kf(kf), m_kv(kv), m_mark(m),m_drawPhi1(df1)
// FunctorMD3Face(MAP& map,
typename PFP::TVEC3& positions, std::vector<VEC3
>& vf1, float ke, float kf, float kv, Marker m, bool df1):
// FunctorMap<MAP>(map), m_
positions(positions), m_
vf1(vf1), m_lab(0), m_ke(ke), m_kf(kf), m_kv(kv), m_mark(m),m_drawPhi1(df1)
// {}
//
// void setVolCenter(const
gmtl::Vec3f
& vc) { m_volCenter = vc;}
// void setVolCenter(const
VEC3
& vc) { m_volCenter = vc;}
//
// bool operator()(Dart d)
// {
// this->m_ma
p.markDart(d,m_mark
);
// this->m_ma
rk.markDart(d
);
//
//
gmtl::Vec3f
vPosPhi1[256]; // max 256 sides per face
//
VEC3
vPosPhi1[256]; // max 256 sides per face
//
// std::vector<
gmtl::Vec3f
> vecPos;
// std::vector<
VEC3
> vecPos;
// vecPos.reserve(16);
//
gmtl::Vec3f
centerFace(0.0f,0.0f,0.0f);
//
VEC3
centerFace(0.0f,0.0f,0.0f);
//
// float k = 1.0f - m_kv;
//
// Dart dd = d;
// do
// {
//
const gmtl::Vec3f& P = this->m_map.getVertexEmb(
dd)->getPosition();
//
gmtl::Vec3f
Q = m_volCenter*k + m_kv*P;
//
VEC3 P = m_positions[dd];//this->m_map.getEmbedding(VERTEX,
dd)->getPosition();
//
VEC3
Q = m_volCenter*k + m_kv*P;
// centerFace += Q;
// vecPos.push_back(Q);
// dd
->setLabel(m_lab++)
;
// dd
= m_lab++
;
// dd = this->m_map.phi1(dd);
// }while (dd!=d);
//
...
...
@@ -323,13 +326,13 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi
//
// for (int i=0; i<nb; ++i)
// {
//
const gmtl::Vec3f&
P = vecPos[i];
//
gmtl::Vec3f
Q = vecPos[i+1]*ke + vecPos[i]*k;
//
VEC3
P = vecPos[i];
//
VEC3
Q = vecPos[i+1]*ke + vecPos[i]*k;
// glColor3f(1.0f,1.0f,0.0f);
// glVertex3fv(P
.getData()
);
// glVertex3fv(P);
// glColor3f(1.0f,1.0f,1.0f);
// glVertex3fv(Q
.getData()
);
//
gmtl::Vec3f
f = P*0.5f + Q*0.5f;
// glVertex3fv(Q);
//
VEC3
f = P*0.5f + Q*0.5f;
// m_vf1.push_back(f);
// f = P*0.9f + Q*0.1f;
// vPosPhi1[i] = f;
...
...
@@ -341,28 +344,29 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi
// for (int i=0; i<nb; ++i)
// {
// glColor3f(0.0f,1.0f,1.0f);
// int k=d
->getLabel()
;
// int k=d;
// int j=(i+1)%nb;
//
gmtl::Vec3f
fv3 = 2.0f*m_vf1[k] - vPosPhi1[i];
// glVertex3fv(fv3
.getData()
);
// glVertex3fv(vPosPhi1[j]
.getData()
);
//
VEC3
fv3 = 2.0f*m_vf1[k] - vPosPhi1[i];
// glVertex3fv(fv3);
// glVertex3fv(vPosPhi1[j]);
// d = this->m_map.phi1(d);
// }
// }
// return false;
// }
//};
//
//
//
//template <typename PFP>
//void renderTopoMD3(typename PFP::MAP&
the_map
, bool drawPhi1, bool drawPhi2, bool drawPhi3, float ke, float kf, float kv, FunctorType& good)
//void renderTopoMD3(typename PFP::MAP&
map, typename PFP::TVEC3& positions
, bool drawPhi1, bool drawPhi2, bool drawPhi3, float ke, float kf, float kv, FunctorType& good)
//{
// typedef typename PFP::VEC3 VEC3;
// typedef typename PFP::REAL REAL;
//
// std::vector<VEC3> vPosPhi23;
//
// std::vector<gmtl::Vec3f> vPosPhi23;
//
// vPosPhi23.reserve(the_map.getNbDarts());
// vPosPhi23.reserve(map.getNbDarts());
//
// glLineWidth(1.0f);
// glBegin(GL_LINES);
...
...
@@ -372,23 +376,24 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi
// vecDarts.reserve(50);
// FunctorStore fvol(vecDarts);
//
// Marker markerFace = the_map.getNewMarker(DART);
// FunctorMD3Face<PFP> fgl_cd(the_map,vPosPhi23,ke,kf,kv,markerFace,drawPhi1);
// DartMarkerStore markerFace(map);
//
// FunctorMD3Face<PFP> fgl_cd(map,positions,vPosPhi23,ke,kf,kv,markerFace,drawPhi1);
//
// // Scan all darts of the map
// for(Dart d =
the_map.begin(); d != the_map.end(); the_
map.next(d))
// for(Dart d =
map.begin(); d != map.end();
map.next(d))
// {
// if ( good(d) && (!
the_map.isMarkedDart(d,markerFace
))) // foreach volume (not already marked)
// if ( good(d) && (!
markerFace.isMarked(d
))) // foreach volume (not already marked)
// {
//
gmtl::Vec3f centerVol= Geometry::volumeCentroid<PFP>(the_map,d
) ; // compute center
//
VEC3 centerVol= Algo::Geometry::volumeCentroid<PFP>(map,d, positions
) ; // compute center
// fgl_cd.setVolCenter(centerVol); //set center of volume in face drawing fonctor
//
// vecDarts.clear();
//
the_
map.foreach_dart_of_oriented_volume(d,fvol); // get all darts of voluùe
// map.foreach_dart_of_oriented_volume(d,fvol); // get all darts of voluùe
//
// for (typename std::vector<Dart>::iterator it = vecDarts.begin(); it != vecDarts.end(); ++it)
// {
// if (!
the_map.isMarkedDart(*it,markerFace
)) // for all face of the volume
// if (!
markerFace.isMarked(*it
)) // for all face of the volume
// {
// fgl_cd(*it);
// }
...
...
@@ -396,8 +401,7 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi
// }
// }
//
// the_map.unmarkAll(markerFace);
// the_map.releaseMarker(markerFace);
// markerFace.unmarkAll();
//
// glEnd();
// glLineWidth(2.0f);
...
...
@@ -406,24 +410,24 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi
// // si on doit tracer phi2 & phi3 : unes seule passe
// if ( drawPhi2 && drawPhi3)
// {
// for(Dart d =
the_map.begin(); d!= the_map.end(); the_
map.next(d))
// for(Dart d =
map.begin(); d!= map.end();
map.next(d))
// {
// if (good(d))
// {
// int i=d
->getLabel()
;
// int i=d;
// glTexCoord3f(vPosPhi23[i][0],vPosPhi23[i][1],vPosPhi23[i][2]);
//
// if (good(
the_
map.phi2(d)))
// if (good(map.phi2(d)))
// {
// glColor3f(1.0,0.0,0.0);
// int j=(
the_map.phi2(d))->getLabel(
);
// int j=(
map.phi2(d)
);
// glVertex3fv(vPosPhi23[i].getData());
// glVertex3fv(vPosPhi23[j].getData());
// }
// if (good(
the_
map.phi3(d)))
// if (good(map.phi3(d)))
// {
// glColor3f(1.0,0.0,1.0);
// int j=(
the_map.phi3(d))->getLabel(
);
// int j=(
map.phi3(d)
);
// glVertex3fv(vPosPhi23[i].getData());
// glVertex3fv(vPosPhi23[j].getData());
// }
...
...
@@ -435,14 +439,14 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi
//
// if (drawPhi2)
// {
// for(Dart d =
the_map.begin(); d!= the_map.end(); the_
map.next(d))
// for(Dart d =
map.begin(); d!= map.end();
map.next(d))
// {
// if (good(d) && good(
the_
map.phi2(d)))
// if (good(d) && good(map.phi2(d)))
// {
// glColor3f(1.0,0.0,0.0);
// int i=d
->getLabel()
;
// int i=d;
// glTexCoord3f(vPosPhi23[i][0],vPosPhi23[i][1],vPosPhi23[i][2]);
// int j=(
the_map.phi2(d))->getLabel(
);
// int j=(
map.phi2(d)
);
// glVertex3fv(vPosPhi23[i].getData());
// glVertex3fv(vPosPhi23[j].getData());
// }
...
...
@@ -451,14 +455,14 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi
//
// if (drawPhi3)
// {
// for(Dart d =
the_map.begin(); d!= the_map.end(); the_
map.next(d))
// for(Dart d =
map.begin(); d!= map.end();
map.next(d))
// {
// if (good(d) && good(
the_
map.phi3(d)))
// if (good(d) && good(map.phi3(d)))
// {
// glColor3f(1.0,0.0,1.0);
// int i=d
->getLabel()
;
// int i=d;
// glTexCoord3f(vPosPhi23[i][0],vPosPhi23[i][1],vPosPhi23[i][2]);
// int j=(
the_map.phi3(d))->getLabel(
);
// int j=(
map.phi3(d)
);
// glVertex3fv(vPosPhi23[i].getData());
// glVertex3fv(vPosPhi23[j].getData());
// }
...
...
@@ -469,6 +473,175 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi
//
//}
template
<
typename
PFP
>
void
renderTopoMD3
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
positions
,
bool
drawPhi1
,
bool
drawPhi2
,
bool
drawPhi3
,
float
ke
,
float
kf
,
float
kv
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
AutoAttributeHandler
<
Geom
::
Vec3f
>
fv1
(
map
,
DART
);
AutoAttributeHandler
<
Geom
::
Vec3f
>
fv11
(
map
,
DART
);
AutoAttributeHandler
<
Geom
::
Vec3f
>
fv2
(
map
,
DART
);
AutoAttributeHandler
<
Geom
::
Vec3f
>
fv2x
(
map
,
DART
);
AutoAttributeHandler
<
Geom
::
Vec3f
>
vert
(
map
,
DART
);
int
m_nbDarts
=
0
;
// table of center of volume
std
::
vector
<
VEC3
>
vecCenters
;
vecCenters
.
reserve
(
1000
);
// table of nbfaces per volume
std
::
vector
<
unsigned
int
>
vecNbFaces
;
vecNbFaces
.
reserve
(
1000
);
// table of face (one dart of each)
std
::
vector
<
Dart
>
vecDartFaces
;
vecDartFaces
.
reserve
(
map
.
getNbDarts
()
/
4
);
DartMarker
mark
(
map
);
// marker for darts
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
CellMarkerStore
markVert
(
map
,
VERTEX
);
//marker for vertices
VEC3
center
(
0
,
0
,
0
);
unsigned
int
nbv
=
0
;
unsigned
int
nbf
=
0
;
std
::
list
<
Dart
>
visitedFaces
;
// Faces that are traversed
visitedFaces
.
push_back
(
d
);
// Start with the face of d
// For every face added to the list
for
(
std
::
list
<
Dart
>::
iterator
face
=
visitedFaces
.
begin
();
face
!=
visitedFaces
.
end
();
++
face
)
{
if
(
!
mark
.
isMarked
(
*
face
))
// Face has not been visited yet
{
// store a dart of face
vecDartFaces
.
push_back
(
*
face
);
nbf
++
;
Dart
dNext
=
*
face
;
do
{
if
(
!
markVert
.
isMarked
(
dNext
))
{
markVert
.
mark
(
dNext
);
center
+=
positions
[
dNext
];
nbv
++
;
}
mark
.
mark
(
dNext
);
// Mark
m_nbDarts
++
;
Dart
adj
=
map
.
phi2
(
dNext
);
// Get adjacent face
if
(
adj
!=
dNext
&&
!
mark
.
isMarked
(
adj
))
visitedFaces
.
push_back
(
adj
);
// Add it
dNext
=
map
.
phi1
(
dNext
);
}
while
(
dNext
!=
*
face
);
}
}
center
/=
typename
PFP
::
REAL
(
nbv
);
vecCenters
.
push_back
(
center
);
vecNbFaces
.
push_back
(
nbf
);
}
glLineWidth
(
1.0
f
);
glBegin
(
GL_LINES
);
glColor3f
(
1.0
f
,
1.0
f
,
1.0
f
);
std
::
vector
<
Dart
>::
iterator
face
=
vecDartFaces
.
begin
();
for
(
unsigned
int
iVol
=
0
;
iVol
<
vecNbFaces
.
size
();
++
iVol
)
{
for
(
unsigned
int
iFace
=
0
;
iFace
<
vecNbFaces
[
iVol
];
++
iFace
)
{
Dart
d
=
*
face
++
;
std
::
vector
<
VEC3
>
vecPos
;
vecPos
.
reserve
(
16
);
// store the face & center
VEC3
center
(
0
,
0
,
0
);
Dart
dd
=
d
;
do
{
const
VEC3
&
P
=
positions
[
d
];
vecPos
.
push_back
(
P
);
//m_attIndex[d] = posDBI;
center
+=
P
;
d
=
map
.
phi1
(
d
);
}
while
(
d
!=
dd
);
center
/=
REAL
(
vecPos
.
size
());
//shrink the face
unsigned
int
nb
=
vecPos
.
size
();
float
okf
=
1.0
f
-
kf
;
float
okv
=
1.0
f
-
kv
;
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
{
vecPos
[
i
]
=
vecCenters
[
iVol
]
*
okv
+
vecPos
[
i
]
*
kv
;
vecPos
[
i
]
=
center
*
okf
+
vecPos
[
i
]
*
kf
;
}
vecPos
.
push_back
(
vecPos
.
front
());
// copy the first for easy computation on next loop
// compute position of points to use for drawing topo
float
oke
=
1.0
f
-
ke
;
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
{
VEC3
P
=
vecPos
[
i
]
*
ke
+
vecPos
[
i
+
1
]
*
oke
;
VEC3
Q
=
vecPos
[
i
+
1
]
*
ke
+
vecPos
[
i
]
*
oke
;
vert
[
d
]
=
P
;
glVertex3fv
(
P
.
data
());
glVertex3fv
(
Q
.
data
());
fv1
[
d
]
=
P
*
0.1
f
+
Q
*
0.9
f
;
fv11
[
d
]
=
P
*
0.9
f
+
Q
*
0.1
f
;
fv2
[
d
]
=
P
*
0.52
f
+
Q
*
0.48
f
;
fv2x
[
d
]
=
P
*
0.48
f
+
Q
*
0.52
f
;
d
=
map
.
phi1
(
d
);
}
}
}
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
Dart
e
=
map
.
phi2
(
d
);
if
((
d
<
e
)
&&
drawPhi2
)
{
glColor3f
(
1.0
,
0.0
,
0.0
);
glVertex3fv
(
fv2
[
d
].
data
());
glVertex3fv
(
fv2
[
e
].
data
());
}
e
=
map
.
phi3
(
d
);
if
((
d
<
e
)
&&
drawPhi3
)
{
glColor3f
(
1.0
,
1.0
,
0.0
);
glVertex3fv
(
fv2
[
d
].
data
());
glVertex3fv
(
fv2
[
e
].
data
());
}
if
(
drawPhi1
)
{
e
=
map
.
phi1
(
d
);
glColor3f
(
0.0
f
,
1.0
f
,
1.0
f
);
glVertex3fv
(
fv1
[
d
].
data
());
glVertex3fv
(
fv11
[
e
].
data
());
}
}
glEnd
();
// LINES
glPointSize
(
5.0
f
);
glColor3f
(
0.0
f
,
0.0
f
,
0.0
f
);
glBegin
(
GL_POINTS
);
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
glVertex3fv
(
vert
[
d
].
data
());
}
glEnd
();
}
}
// endnamespace
}
// endnamespace
...
...
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