Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
David Cazier
CGoGN
Commits
cb9f0df4
Commit
cb9f0df4
authored
Nov 30, 2012
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Plain Diff
Merge cgogn:~cgogn/CGoGN
parents
5d64b236
01ef1b3d
Changes
40
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
521 additions
and
434 deletions
+521
-434
Apps/Examples/clipping.cpp
Apps/Examples/clipping.cpp
+1
-0
Apps/Examples/concave_rendering.cpp
Apps/Examples/concave_rendering.cpp
+1
-0
Apps/Examples/extrusionView.cpp
Apps/Examples/extrusionView.cpp
+1
-0
Apps/Examples/mcmesh.h
Apps/Examples/mcmesh.h
+1
-0
Apps/Examples/texturesExample.cpp
Apps/Examples/texturesExample.cpp
+1
-0
Apps/Examples/viewer.h
Apps/Examples/viewer.h
+1
-1
Apps/Tuto/tuto2.h
Apps/Tuto/tuto2.h
+1
-0
Apps/Tuto/tuto5.h
Apps/Tuto/tuto5.h
+1
-1
Apps/Tuto/tuto_histo.h
Apps/Tuto/tuto_histo.h
+1
-1
Apps/Tuto/tuto_mt.h
Apps/Tuto/tuto_mt.h
+1
-0
include/Algo/Geometry/curvature.hpp
include/Algo/Geometry/curvature.hpp
+3
-3
include/Algo/Histogram/histogram.h
include/Algo/Histogram/histogram.h
+1
-1
include/Algo/Modelisation/boundEmb.h
include/Algo/Modelisation/boundEmb.h
+57
-0
include/Algo/Modelisation/polyhedron.h
include/Algo/Modelisation/polyhedron.h
+10
-1
include/Algo/Modelisation/polyhedron.hpp
include/Algo/Modelisation/polyhedron.hpp
+60
-232
include/Algo/MovingObjects/particle_cell_2D_memo.h
include/Algo/MovingObjects/particle_cell_2D_memo.h
+5
-5
include/Algo/MovingObjects/particle_cell_2D_memo.hpp
include/Algo/MovingObjects/particle_cell_2D_memo.hpp
+37
-10
include/Algo/Render/GL2/colorPerFaceRender.h
include/Algo/Render/GL2/colorPerFaceRender.h
+1
-1
include/Algo/Render/GL2/explodeVolumeRender.h
include/Algo/Render/GL2/explodeVolumeRender.h
+1
-1
include/Algo/Render/GL2/mapRender.h
include/Algo/Render/GL2/mapRender.h
+1
-1
include/Algo/Render/GL2/mapRender.hpp
include/Algo/Render/GL2/mapRender.hpp
+1
-1
include/Algo/Render/GL2/topo3Render.h
include/Algo/Render/GL2/topo3Render.h
+1
-1
include/Algo/Render/GL2/topoRender.h
include/Algo/Render/GL2/topoRender.h
+1
-1
include/Topology/generic/attributeHandler.hpp
include/Topology/generic/attributeHandler.hpp
+2
-2
include/Topology/generic/cellmarker.h
include/Topology/generic/cellmarker.h
+6
-6
include/Topology/generic/genericmap.h
include/Topology/generic/genericmap.h
+8
-0
include/Topology/generic/genericmap.hpp
include/Topology/generic/genericmap.hpp
+25
-17
include/Topology/gmap/embeddedGMap2.h
include/Topology/gmap/embeddedGMap2.h
+5
-0
include/Topology/gmap/gmap0.hpp
include/Topology/gmap/gmap0.hpp
+2
-1
include/Utils/GLSLShader.h
include/Utils/GLSLShader.h
+2
-1
include/Utils/frameManipulator.h
include/Utils/frameManipulator.h
+1
-1
include/Utils/pickables.h
include/Utils/pickables.h
+1
-1
include/Utils/vbo.h
include/Utils/vbo.h
+28
-138
include/Utils/vbo_base.h
include/Utils/vbo_base.h
+142
-0
src/Topology/gmap/embeddedGMap2.cpp
src/Topology/gmap/embeddedGMap2.cpp
+47
-0
src/Topology/map/embeddedMap2.cpp
src/Topology/map/embeddedMap2.cpp
+58
-2
src/Utils/Shaders/shaderSimpleTexture.cpp
src/Utils/Shaders/shaderSimpleTexture.cpp
+1
-1
src/Utils/drawer.cpp
src/Utils/drawer.cpp
+1
-1
src/Utils/text3d.cpp
src/Utils/text3d.cpp
+2
-1
src/Utils/vbo.cpp
src/Utils/vbo.cpp
+1
-1
No files found.
Apps/Examples/clipping.cpp
View file @
cb9f0df4
...
...
@@ -23,6 +23,7 @@
*******************************************************************************/
#include "clipping.h"
#include "Utils/vbo.h"
#include "Utils/static_assert.h"
/*******************************************************************************
...
...
Apps/Examples/concave_rendering.cpp
View file @
cb9f0df4
...
...
@@ -35,6 +35,7 @@
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/vbo.h"
#include <glm/gtc/type_ptr.hpp>
...
...
Apps/Examples/extrusionView.cpp
View file @
cb9f0df4
...
...
@@ -40,6 +40,7 @@
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderFlat.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/vbo.h"
#include <vector>
...
...
Apps/Examples/mcmesh.h
View file @
cb9f0df4
...
...
@@ -38,6 +38,7 @@
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderFlat.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/vbo.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/MC/marchingcube.h"
...
...
Apps/Examples/texturesExample.cpp
View file @
cb9f0df4
...
...
@@ -25,6 +25,7 @@
#include "texturesExample.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Utils/vbo.h"
TexView
::
TexView
()
:
m_render
(
NULL
),
...
...
Apps/Examples/viewer.h
View file @
cb9f0df4
...
...
@@ -46,7 +46,7 @@
#include "Utils/Shaders/shaderVectorPerVertex.h"
#include "Utils/pointSprite.h"
#include "Utils/text3d.h"
#include "Utils/vbo
Render
.h"
#include "Utils/vbo.h"
#include "Utils/Qt/qtInputs.h"
...
...
Apps/Tuto/tuto2.h
View file @
cb9f0df4
...
...
@@ -41,6 +41,7 @@
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Shaders/shaderColorPerVertex.h"
#include "Utils/vbo.h"
using
namespace
CGoGN
;
...
...
Apps/Tuto/tuto5.h
View file @
cb9f0df4
...
...
@@ -45,7 +45,7 @@
#include "Topology/generic/cellmarker.h"
#include "Utils/text3d.h"
#include "Utils/vbo.h"
#include "Utils/pointSprite.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Shaders/shaderVectorPerVertex.h"
...
...
Apps/Tuto/tuto_histo.h
View file @
cb9f0df4
...
...
@@ -35,7 +35,7 @@
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Shaders/shaderColorPerVertex.h"
#include "Utils/vbo.h"
#include "Algo/Histogram/histogram.h"
#include "Utils/Qt/qthistodraw.h"
...
...
Apps/Tuto/tuto_mt.h
View file @
cb9f0df4
...
...
@@ -37,6 +37,7 @@
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Shaders/shaderVectorPerVertex.h"
#include "Utils/vbo.h"
#include "Utils/cgognStream.h"
#include "Utils/Qt/qtSimple.h"
...
...
include/Algo/Geometry/curvature.hpp
View file @
cb9f0df4
...
...
@@ -440,17 +440,17 @@ void computeCurvatureVertices_NormalCycles(
if
(
!
map
.
template
isOrbitEmbedded
<
VERTEX
>())
{
CellMarkerNoUnmark
<
VERTEX
>
cm
(
map
);
map
.
template
initOrbitEmbedding
<
VERTEX
>();
map
.
template
init
All
Orbit
s
Embedding
<
VERTEX
>();
}
if
(
!
map
.
template
isOrbitEmbedded
<
EDGE
>())
{
CellMarkerNoUnmark
<
EDGE
>
cm
(
map
);
map
.
template
initOrbitEmbedding
<
EDGE
>();
map
.
template
init
All
Orbit
s
Embedding
<
EDGE
>();
}
if
(
!
map
.
template
isOrbitEmbedded
<
FACE
>())
{
CellMarkerNoUnmark
<
FACE
>
cm
(
map
);
map
.
template
initOrbitEmbedding
<
FACE
>();
map
.
template
init
All
Orbit
s
Embedding
<
FACE
>();
}
FunctorComputeCurvatureVertices_NormalCycles
<
PFP
>
funct
(
map
,
radius
,
position
,
normal
,
edgeangle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
);
...
...
include/Algo/Histogram/histogram.h
View file @
cb9f0df4
...
...
@@ -33,7 +33,7 @@
#include "Topology/generic/cellmarker.h"
#include "Geometry/vector_gen.h"
#include "Utils/colorMaps.h"
#include "Utils/vbo.h"
#include "Utils/vbo
_base
.h"
namespace
CGoGN
...
...
include/Algo/Modelisation/boundEmb.h
0 → 100644
View file @
cb9f0df4
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef _BOUND_EMBD_H
#define _BOUND_EMBD_H
namespace
CGoGN
{
namespace
Algo
{
namespace
Modelisation
{
template
<
typename
PFP
>
void
sewFaceEmb
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
Dart
e
)
{
map
.
sewFaces
(
d
,
e
,
false
)
;
if
(
map
.
template
isOrbitEmbedded
<
EDGE
>())
map
.
template
initOrbitEmbeddingNewCell
<
EDGE
>(
d
)
;
}
template
<
typename
PFP
>
Dart
newFaceEmb
(
typename
PFP
::
MAP
&
map
,
unsigned
int
n
)
{
Dart
d
=
map
.
newFace
(
n
,
false
);
if
(
map
.
template
isOrbitEmbedded
<
FACE
>())
map
.
template
initOrbitEmbeddingNewCell
<
FACE
>(
d
)
;
return
d
;
}
}
}
}
#endif
include/Algo/Modelisation/polyhedron.h
View file @
cb9f0df4
...
...
@@ -44,6 +44,12 @@ namespace Modelisation
enum
{
NONE
,
GRID
,
CUBE
,
CYLINDER
,
CONE
,
SPHERE
,
TORE
,
COMPOSED
};
//template <typename PFP>
//void sewFaceEmb(typename PFP::MAP& map, Dart d, Dart e);
//
//template <typename PFP>
//Dart newFaceEmb(typename PFP::MAP& map, unsigned int n);
/**
* sudivide the all quads of a CC into 2 triangles
*/
...
...
@@ -194,7 +200,8 @@ protected:
void
computeCenter
();
Dart
grid_topo_open
(
unsigned
int
x
,
unsigned
int
y
);
Dart
cylinder_topo_open
(
unsigned
int
n
,
unsigned
int
z
);
public:
/**
* Constructor
...
...
@@ -233,6 +240,8 @@ public:
*/
std
::
vector
<
Dart
>&
getVertexDarts
()
{
return
m_tableVertDarts
;
}
/**
* Create a 2D grid
* quads are oriented counter-clockwise and the returned dart
...
...
include/Algo/Modelisation/polyhedron.hpp
View file @
cb9f0df4
...
...
@@ -324,8 +324,10 @@ Polyhedron<PFP>::Polyhedron(const Polyhedron<PFP>& p1, const Polyhedron<PFP>& p2
m_center
=
center
/
typename
PFP
::
REAL
(
m_tableVertDarts
.
size
());
}
template
<
typename
PFP
>
Dart
Polyhedron
<
PFP
>::
grid_topo
(
unsigned
int
x
,
unsigned
int
y
)
Dart
Polyhedron
<
PFP
>::
grid_topo
_open
(
unsigned
int
x
,
unsigned
int
y
)
{
if
(
m_kind
!=
NONE
)
return
m_dart
;
...
...
@@ -385,13 +387,23 @@ Dart Polyhedron<PFP>::grid_topo(unsigned int x, unsigned int y)
// store & return reference dart
m_dart
=
m_tableVertDarts
[
0
];
// util ?
return
m_dart
;
}
template
<
typename
PFP
>
Dart
Polyhedron
<
PFP
>::
grid_topo
(
unsigned
int
x
,
unsigned
int
y
)
{
if
(
m_kind
!=
NONE
)
return
m_dart
;
m_dart
=
grid_topo_open
(
x
,
y
);
m_map
.
closeHole
(
m_dart
)
;
return
m_dart
;
}
template
<
typename
PFP
>
Dart
Polyhedron
<
PFP
>::
cylinder_topo
(
unsigned
int
n
,
unsigned
int
z
,
bool
top_closed
,
bool
bottom_closed
)
Dart
Polyhedron
<
PFP
>::
cylinder_topo
_open
(
unsigned
int
n
,
unsigned
int
z
)
{
if
(
m_kind
!=
NONE
)
return
m_dart
;
...
...
@@ -399,12 +411,7 @@ Dart Polyhedron<PFP>::cylinder_topo(unsigned int n, unsigned int z, bool top_clo
m_nx
=
n
;
m_nz
=
z
;
m_bottom_closed
=
bottom_closed
;
m_top_closed
=
top_closed
;
int
nb
=
(
n
)
*
(
z
+
1
);
if
(
bottom_closed
)
nb
++
;
if
(
top_closed
)
nb
++
;
int
nb
=
(
n
)
*
(
z
+
1
)
+
2
;
// vertice reservation
m_tableVertDarts
.
reserve
(
nb
);
...
...
@@ -457,6 +464,22 @@ Dart Polyhedron<PFP>::cylinder_topo(unsigned int n, unsigned int z, bool top_clo
}
}
m_dart
=
m_tableVertDarts
.
front
();
return
m_dart
;
}
template
<
typename
PFP
>
Dart
Polyhedron
<
PFP
>::
cylinder_topo
(
unsigned
int
n
,
unsigned
int
z
,
bool
top_closed
,
bool
bottom_closed
)
{
if
(
m_kind
!=
NONE
)
return
m_dart
;
m_dart
=
cylinder_topo_open
(
n
,
z
);
m_bottom_closed
=
bottom_closed
;
m_top_closed
=
top_closed
;
if
(
bottom_closed
)
{
Dart
d
=
m_tableVertDarts
[
0
];
...
...
@@ -489,160 +512,17 @@ Dart Polyhedron<PFP>::cylinder_topo(unsigned int n, unsigned int z, bool top_clo
else
m_map
.
closeHole
(
m_map
.
phi_1
(
m_tableVertDarts
[
n
*
z
]));
m_dart
=
m_tableVertDarts
.
front
();
//
m_dart = m_tableVertDarts.front();
return
m_dart
;
}
// template <typename PFP>
// Dart Polyhedron<PFP>::cone_topo(int n, int z, bool bottom_closed)
// {
// if (m_kind != NONE) return m_dart;
//
// if (z>1)
// {
// if (n>4) // normal case
// {
// Dart d = cylinder_topo(n,z-1,true,bottom_closed);
// m_kind = CONE;
// m_nz = z;
// return d;
// }
// else if (n==4)
// {
// Dart d = cylinder_topo(n,z-1,true,false);
// m_kind = CONE;
// m_nz = z;
// // close bottom with one quad not three triangles
// if (bottom_closed)
// {
// Dart t= m_map.newFace(4,false);
// m_map.sewFaces(m_tableVertDarts[0],t);
// t=m_map.phi_1(t);
// m_map.sewFaces(m_tableVertDarts[1],t);
// t=m_map.phi_1(t);
// m_map.sewFaces(m_tableVertDarts[2],t);
// t=m_map.phi_1(t);
// m_map.sewFaces(m_tableVertDarts[3],t);
// }
// return d;
// }
// else // n==3 (base is triangle)
// {
// Dart d = cylinder_topo(n,z-1,true,false);
// m_kind = CONE;
// m_nz = z;
// // close bottom with one triangle not three
// if (bottom_closed)
// {
// Dart t= m_map.newFace(3,false);
// m_map.sewFaces(d,t);
// d=nextDV(d); t=m_map.phi_1(t);
// m_map.sewFaces(d,t);
// d=nextDV(d); t=m_map.phi_1(t);
// m_map.sewFaces(d,t);
// }
// return d;
// }
// }
// else //z==1 only on slice
// {
// m_kind = CONE;
// m_nx = n;
// m_nz = z;
// if (n>4) // normal case
// {
// if (bottom_closed)
// m_tableVertDarts.reserve(n+2);
// else
// m_tableVertDarts.reserve(n+1);
//
// Dart ref = triangleFan_topo<PFP>(m_map,n);
// Dart d = ref;
// for (int i=0;i<n;++i)
// {
// m_tableVertDarts.push_back(d);
// d = nextDV(d);
// }
//
// if (bottom_closed)
// {
// m_bottom_closed=true;
// Dart dd = triangleFan_topo<PFP>(m_map,n);
// m_tableVertDarts.push_back(m_map.phi_1(dd));
// for (int i=0;i<n;++i)
// {
// m_map.sewFaces(d,dd);
// d=nextDV(d);
// dd=precDV(dd);
// }
// }
//
// m_tableVertDarts.push_back(m_map.phi_1(ref));
//
// m_dart=ref;
// return ref;
// }
// else if (n==4)
// {
// m_bottom_closed=false; // because no vertex in bottom
// m_tableVertDarts.reserve(4);
//
// Dart dd = triangleFan_topo<PFP>(m_map,4);
// for (int i=0;i<4;++i)
// {
// m_tableVertDarts.push_back(dd);
// dd = nextDV(dd);
// }
// m_tableVertDarts.push_back(m_map.phi_1(dd));
//
// if (bottom_closed)
// {
// Dart t= m_map.newFace(4,false);
// m_map.sewFaces(m_tableVertDarts[0],t);
// t=m_map.phi_1(t);
// m_map.sewFaces(m_tableVertDarts[1],t);
// t=m_map.phi_1(t);
// m_map.sewFaces(m_tableVertDarts[2],t);
// t=m_map.phi_1(t);
// m_map.sewFaces(m_tableVertDarts[3],t);
// }
// m_dart=dd;
// return dd;
// }
// else // n==3 (base is triangle, here we create a tetrahedron)
// {
// m_bottom_closed=false; // because no vertex in bottom
// m_tableVertDarts.reserve(4);
//
// Dart dd = triangleFan_topo<PFP>(m_map,3);
// for (int i=0;i<3;++i)
// {
// m_tableVertDarts.push_back(dd);
// dd = nextDV(dd);
// }
// m_tableVertDarts.push_back(m_map.phi_1(dd));
//
// if (bottom_closed)
// {
// Dart t= m_map.newFace(3,false);
// m_map.sewFaces(m_tableVertDarts[0],t);
// t=m_map.phi_1(t);
// m_map.sewFaces(m_tableVertDarts[1],t);
// t=m_map.phi_1(t);
// m_map.sewFaces(m_tableVertDarts[2],t);
// }
// m_dart=dd;
// return dd;
// }
// }
// }
template
<
typename
PFP
>
Dart
Polyhedron
<
PFP
>::
cube_topo
(
unsigned
int
x
,
unsigned
int
y
,
unsigned
int
z
)
{
if
(
m_kind
!=
NONE
)
return
m_dart
;
m_dart
=
cylinder_topo
(
2
*
(
x
+
y
),
z
,
false
,
false
);
m_dart
=
cylinder_topo
_open
(
2
*
(
x
+
y
),
z
);
m_kind
=
CUBE
;
m_nx
=
x
;
m_ny
=
y
;
...
...
@@ -654,7 +534,7 @@ Dart Polyhedron<PFP>::cube_topo(unsigned int x, unsigned int y, unsigned int z)
// we now have the 4 sides, just need to create store and sew top & bottom
// the top
Polyhedron
<
PFP
>
primTop
(
m_map
,
m_positions
);
primTop
.
grid_topo
(
x
,
y
);
primTop
.
grid_topo
_open
(
x
,
y
);
std
::
vector
<
Dart
>&
tableTop
=
primTop
.
getVertexDarts
();
int
index_side
=
2
*
(
x
+
y
)
*
z
;
...
...
@@ -687,7 +567,7 @@ Dart Polyhedron<PFP>::cube_topo(unsigned int x, unsigned int y, unsigned int z)
// the bottom
Polyhedron
<
PFP
>
primBottom
(
m_map
,
m_positions
);
primBottom
.
grid_topo
(
x
,
y
);
primBottom
.
grid_topo
_open
(
x
,
y
);
std
::
vector
<
Dart
>&
tableBottom
=
primBottom
.
getVertexDarts
();
index_side
=
3
*
(
x
+
y
)
+
(
x
-
1
);
...
...
@@ -780,10 +660,7 @@ void Polyhedron<PFP>::embedGrid(float x, float y, float z)
{
for
(
unsigned
int
j
=
0
;
j
<=
m_nx
;
++
j
)
{
VEC3
pos
(
-
x
/
2
+
dx
*
float
(
j
),
-
y
/
2
+
dy
*
float
(
i
),
z
);
unsigned
int
em
=
m_positions
.
insert
(
pos
);
Dart
d
=
m_tableVertDarts
[
i
*
(
m_nx
+
1
)
+
j
];
m_map
.
template
setOrbitEmbedding
<
VERTEX
>(
d
,
em
);
m_positions
[
m_tableVertDarts
[
i
*
(
m_nx
+
1
)
+
j
]
]
=
VEC3
(
-
x
/
2
+
dx
*
float
(
j
),
-
y
/
2
+
dy
*
float
(
i
),
z
);
}
}
}
...
...
@@ -811,28 +688,19 @@ void Polyhedron<PFP>::embedCylinder(float bottom_radius, float top_radius, float
float
x
=
radius
*
cos
(
alpha
*
float
(
j
));
float
y
=
radius
*
sin
(
alpha
*
float
(
j
));
VEC3
pos
(
x
,
y
,
-
height
/
2
+
dz
*
float
(
i
));
unsigned
int
em
=
m_positions
.
insert
(
pos
);
Dart
d
=
m_tableVertDarts
[
i
*
(
m_nx
)
+
j
];
m_map
.
template
setOrbitEmbedding
<
VERTEX
>(
d
,
em
);
m_positions
[
m_tableVertDarts
[
i
*
(
m_nx
)
+
j
]
]
=
VEC3
(
x
,
y
,
-
height
/
2
+
dz
*
float
(
i
));
}
}
int
indexUmbrella
=
m_nx
*
(
m_nz
+
1
);
if
(
m_bottom_closed
)
{
VEC3
pos
(
0.0
f
,
0.0
f
,
-
height
/
2
);
unsigned
int
em
=
m_positions
.
insert
(
pos
);
Dart
d
=
m_tableVertDarts
[
indexUmbrella
++
];
m_map
.
template
setOrbitEmbedding
<
VERTEX
>(
d
,
em
);
m_positions
[
m_tableVertDarts
[
indexUmbrella
++
]
]
=
VEC3
(
0.0
f
,
0.0
f
,
-
height
/
2
);
}
if
(
m_top_closed
)
{
VEC3
pos
(
0.0
f
,
0.0
f
,
height
/
2
);
unsigned
int
em
=
m_positions
.
insert
(
pos
);
Dart
d
=
m_tableVertDarts
[
indexUmbrella
];
m_map
.
template
setOrbitEmbedding
<
VERTEX
>(
d
,
em
);
m_positions
[
m_tableVertDarts
[
indexUmbrella
]
]
=
VEC3
(
0.0
f
,
0.0
f
,
height
/
2
);
}
}
...
...
@@ -841,47 +709,35 @@ void Polyhedron<PFP>::embedCone(float radius, float height)
{
typedef
typename
PFP
::
VEC3
VEC3
;
if
(
m_kind
!
=
C
ONE
)
if
(
!
(
(
m_kind
=
=
C
YLINDER
)
&&
(
m_top_closed
))
)
{
CGoGNerr
<<
"Warning try to embedCone something that is not a cone"
<<
CGoGNendl
;
return
;
}
float
alpha
=
float
(
2.0
*
M_PI
/
m_nx
);
int
zcyl
=
m_nz
-
1
;
float
dz
=
height
/
float
(
m_nz
);
for
(
unsigned
int
i
=
0
;
i
<=
zcyl
;
++
i
)
float
dz
=
height
/
float
(
m_nz
+
1
);
for
(
unsigned
int
i
=
0
;
i
<=
m_nz
;
++
i
)
{
for
(
unsigned
int
j
=
0
;
j
<
m_nx
;
++
j
)
{
float
rad
=
radius
*
float
(
m_nz
-
i
)
/
float
(
m_nz
);
float
rad
=
radius
*
float
(
m_nz
+
1
-
i
)
/
float
(
m_nz
+
1
);
float
h
=
-
height
/
2
+
dz
*
float
(
i
);
float
x
=
rad
*
cos
(
alpha
*
float
(
j
));
float
y
=
rad
*
sin
(
alpha
*
float
(
j
));
VEC3
pos
(
x
,
y
,
h
);
unsigned
int
em
=
m_positions
.
insert
(
pos
);
Dart
d
=
m_tableVertDarts
[
i
*
(
m_nx
)
+
j
];
m_map
.
template
setOrbitEmbedding
<
VERTEX
>(
d
,
em
);
m_positions
[
m_tableVertDarts
[
i
*
(
m_nx
)
+
j
]
]
=
VEC3
(
x
,
y
,
h
);
}
}
int
indexUmbrella
=
m_nx
*
(
m_nz
);
int
indexUmbrella
=
m_nx
*
(
m_nz
+
1
);
if
(
m_bottom_closed
)
{
VEC3
pos
(
0.0
f
,
0.0
f
,
-
height
/
2
);
unsigned
int
em
=
m_positions
.
insert
(
pos
);
Dart
d
=
m_tableVertDarts
[
indexUmbrella
++
];
m_map
.
template
setOrbitEmbedding
<
VERTEX
>(
d
,
em
);
m_positions
[
m_tableVertDarts
[
indexUmbrella
++
]
]
=
VEC3
(
0.0
f
,
0.0
f
,
-
height
/
2
);
}
// top always closed in cone
VEC3
pos
(
0.0
f
,
0.0
f
,
height
/
2.0
f
);
unsigned
int
em
=
m_positions
.
insert
(
pos
);
Dart
d
=
m_tableVertDarts
[
indexUmbrella
];
m_map
.
template
setOrbitEmbedding
<
VERTEX
>(
d
,
em
);
m_positions
[
m_tableVertDarts
[
indexUmbrella
]
]
=
VEC3
(
0.0
f
,
0.0
f
,
height
/
2
);
}
template
<
typename
PFP
>
...
...
@@ -907,24 +763,17 @@ void Polyhedron<PFP>::embedSphere(float radius)
float
x
=
rad
*
cos
(
alpha
*
float
(
j
));
float
y
=
rad
*
sin
(
alpha
*
float
(
j
));
VEC3
pos
(
x
,
y
,
h
);
unsigned
int
em
=
m_positions
.
insert
(
pos
);
Dart
d
=
m_tableVertDarts
[
i
*
(
m_nx
)
+
j
];
m_map
.
template
setOrbitEmbedding
<
VERTEX
>(
d
,
em
);
m_positions
[
m_tableVertDarts
[
i
*
(
m_nx
)
+
j
]
]
=
VEC3
(
x
,
y
,
h
);
}
}
// bottom pole
VEC3
pos
(
0.0
f
,
0.0
f
,
-
radius
);
unsigned
int
em
=
m_positions
.
insert
(
pos
);
Dart
d
=
m_tableVertDarts
[
m_nx
*
(
m_nz
+
1
)];
m_map
.
template
setOrbitEmbedding
<
VERTEX
>(
d
,
em
);
m_positions
[
m_tableVertDarts
[
m_nx
*
(
m_nz
+
1
)]
]
=
VEC3
(
0.0
f
,
0.0
f
,
-
radius
);
// top pole
pos
=
VEC3
(
0.0
f
,
0.0
f
,
radius
);
em
=
m_positions
.
insert
(
pos
);
d
=
m_tableVertDarts
[
m_nx
*
(
m_nz
+
1
)
+
1
];
m_map
.
template
setOrbitEmbedding
<
VERTEX
>(
d
,
em
);
m_positions
[
m_tableVertDarts
[
m_nx
*
(
m_nz
+
1
)
+
1
]
]
=
VEC3
(
0.0
f
,
0.0
f
,
radius
);
}
template
<
typename
PFP
>
...
...
@@ -949,10 +798,7 @@ void Polyhedron<PFP>::embedTore(float big_radius, float small_radius)
float
r
=
big_radius
+
small_radius
*
cos
(
beta
*
float
(
j
));
float
x
=
r
*
cos
(
alpha
*
float
(
i
));
float
y
=
r
*
sin
(
alpha
*
float
(
i
));
VEC3
pos
(
x
,
y
,
z
);
unsigned
int
em
=
m_positions
.
insert
(
pos
);
Dart
d
=
m_tableVertDarts
[
j
*
(
m_nx
)
+
i
];
m_map
.
template
setOrbitEmbedding
<
VERTEX
>(
d
,
em
);
m_positions
[
m_tableVertDarts
[
j
*
(
m_nx
)
+
i
]
]
=
VEC3
(
x
,
y
,
z
);
}