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
9584150d
Commit
9584150d
authored
Apr 21, 2013
by
Lionel Untereiner
Browse files
Options
Browse Files
Download
Plain Diff
Merge cgogn.unistra.fr:~untereiner/CGoGN
parents
ce12a6a6
b5d8570a
Changes
32
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
921 additions
and
107 deletions
+921
-107
Apps/Examples/viewer.cpp
Apps/Examples/viewer.cpp
+14
-4
Apps/Examples/viewer.h
Apps/Examples/viewer.h
+5
-2
Apps/Tuto/tuto_oper2.cpp
Apps/Tuto/tuto_oper2.cpp
+4
-2
Apps/Tuto/tuto_oper3.cpp
Apps/Tuto/tuto_oper3.cpp
+16
-5
SCHNApps/Plugins/renderTopoSurface/include/renderTopoSurface.h
...pps/Plugins/renderTopoSurface/include/renderTopoSurface.h
+4
-1
SCHNApps/Plugins/renderTopoSurface/src/renderTopoSurface.cpp
SCHNApps/Plugins/renderTopoSurface/src/renderTopoSurface.cpp
+16
-0
include/Algo/DecimationVolumes/approximator.h
include/Algo/DecimationVolumes/approximator.h
+3
-3
include/Algo/DecimationVolumes/decimator.h
include/Algo/DecimationVolumes/decimator.h
+3
-3
include/Algo/DecimationVolumes/decimator.hpp
include/Algo/DecimationVolumes/decimator.hpp
+5
-5
include/Algo/DecimationVolumes/edgeSelector.h
include/Algo/DecimationVolumes/edgeSelector.h
+3
-3
include/Algo/DecimationVolumes/edgeSelector.hpp
include/Algo/DecimationVolumes/edgeSelector.hpp
+3
-3
include/Algo/DecimationVolumes/geometryApproximator.h
include/Algo/DecimationVolumes/geometryApproximator.h
+3
-3
include/Algo/DecimationVolumes/geometryApproximator.hpp
include/Algo/DecimationVolumes/geometryApproximator.hpp
+3
-3
include/Algo/DecimationVolumes/operator.h
include/Algo/DecimationVolumes/operator.h
+3
-3
include/Algo/DecimationVolumes/operator.hpp
include/Algo/DecimationVolumes/operator.hpp
+3
-3
include/Algo/DecimationVolumes/selector.h
include/Algo/DecimationVolumes/selector.h
+3
-3
include/Algo/ImplicitHierarchicalMesh/ihm.h
include/Algo/ImplicitHierarchicalMesh/ihm.h
+15
-1
include/Algo/ImplicitHierarchicalMesh/ihm.hpp
include/Algo/ImplicitHierarchicalMesh/ihm.hpp
+11
-1
include/Algo/ImplicitHierarchicalMesh/ihm3.hpp
include/Algo/ImplicitHierarchicalMesh/ihm3.hpp
+1
-2
include/Algo/Import/importMesh.hpp
include/Algo/Import/importMesh.hpp
+5
-1
include/Algo/Modelisation/polyhedron.h
include/Algo/Modelisation/polyhedron.h
+5
-0
include/Algo/Modelisation/polyhedron.hpp
include/Algo/Modelisation/polyhedron.hpp
+128
-0
include/Algo/Multiresolution/Map2MR/map2MR_PM.h
include/Algo/Multiresolution/Map2MR/map2MR_PM.h
+9
-9
include/Algo/Multiresolution/Map2MR/map2MR_PM.hpp
include/Algo/Multiresolution/Map2MR/map2MR_PM.hpp
+1
-1
include/Algo/Multiresolution/Map3MR/Filters/lerp.h
include/Algo/Multiresolution/Map3MR/Filters/lerp.h
+3
-20
include/Algo/Multiresolution/Map3MR/Filters/schaefer.h
include/Algo/Multiresolution/Map3MR/Filters/schaefer.h
+190
-0
include/Algo/Multiresolution/Map3MR/map3MR_PM.h
include/Algo/Multiresolution/Map3MR/map3MR_PM.h
+125
-0
include/Algo/Multiresolution/Map3MR/map3MR_PM.hpp
include/Algo/Multiresolution/Map3MR/map3MR_PM.hpp
+298
-0
include/Algo/Render/GL2/topoRender.hpp
include/Algo/Render/GL2/topoRender.hpp
+22
-21
include/Topology/ihmap/ihm2.hpp
include/Topology/ihmap/ihm2.hpp
+0
-1
src/Algo/ImplicitHierarchicalMesh/ihm.cpp
src/Algo/ImplicitHierarchicalMesh/ihm.cpp
+16
-3
src/Algo/ImplicitHierarchicalMesh/ihm3.cpp
src/Algo/ImplicitHierarchicalMesh/ihm3.cpp
+1
-1
No files found.
Apps/Examples/viewer.cpp
View file @
9584150d
...
...
@@ -31,6 +31,7 @@ Viewer::Viewer() :
m_drawFaces
(
true
),
m_drawNormals
(
false
),
m_drawTopo
(
false
),
m_drawBoundaryTopo
(
true
),
m_render
(
NULL
),
m_phongShader
(
NULL
),
m_flatShader
(
NULL
),
...
...
@@ -78,8 +79,6 @@ void Viewer::cb_initGL()
{
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
2
)
;
setFocal
(
5.0
f
)
;
m_render
=
new
Algo
::
Render
::
GL2
::
MapRender
()
;
m_topoRender
=
new
Algo
::
Render
::
GL2
::
TopoRender
()
;
...
...
@@ -109,7 +108,7 @@ void Viewer::cb_initGL()
m_simpleColorShader
=
new
Utils
::
ShaderSimpleColor
()
;
m_simpleColorShader
->
setAttributePosition
(
m_positionVBO
)
;
Geom
::
Vec4f
c
(
0.
1
f
,
0.1
f
,
0.1
f
,
1.0
f
)
;
Geom
::
Vec4f
c
(
0.
0
f
,
0.0
f
,
0.0
f
,
1.0
f
)
;
m_simpleColorShader
->
setColor
(
c
)
;
m_pointSprite
=
new
Utils
::
PointSprite
()
;
...
...
@@ -231,7 +230,7 @@ void Viewer::importMesh(std::string& filename)
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
LINES
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
TRIANGLES
)
;
m_topoRender
->
updateData
<
PFP
>
(
myMap
,
position
,
0.85
f
,
0.85
f
)
;
m_topoRender
->
updateData
<
PFP
>
(
myMap
,
position
,
0.85
f
,
0.85
f
,
m_drawBoundaryTopo
)
;
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
normalBaseSize
=
bb
.
diagSize
()
/
100.0
f
;
...
...
@@ -294,6 +293,17 @@ void Viewer::slot_drawEdges(bool b)
void
Viewer
::
slot_drawFaces
(
bool
b
)
{
m_drawFaces
=
b
;
if
(
b
)
{
Geom
::
Vec4f
c
(
0.0
f
,
0.0
f
,
0.0
f
,
1.0
f
)
;
m_simpleColorShader
->
setColor
(
c
)
;
}
else
{
Geom
::
Vec4f
c
(
0.9
f
,
0.9
f
,
0.1
f
,
1.0
f
)
;
m_simpleColorShader
->
setColor
(
c
)
;
}
updateGL
()
;
}
...
...
Apps/Examples/viewer.h
View file @
9584150d
...
...
@@ -24,7 +24,8 @@
#include <iostream>
#include "Utils/Qt/qtSimple.h"
//#include "Utils/Qt/qtSimple.h"
#include "Utils/Qt/qtQGLV.h"
#include "ui_viewer.h"
#include "Utils/Qt/qtui.h"
...
...
@@ -65,7 +66,8 @@ struct PFP: public PFP_STANDARD
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
VEC3
VEC3
;
class
Viewer
:
public
Utils
::
QT
::
SimpleQT
//class Viewer : public Utils::QT::SimpleQT
class
Viewer
:
public
Utils
::
QT
::
SimpleQGLV
{
Q_OBJECT
...
...
@@ -96,6 +98,7 @@ public:
bool
m_drawFaces
;
bool
m_drawNormals
;
bool
m_drawTopo
;
bool
m_drawBoundaryTopo
;
VertexAttribute
<
VEC3
>
position
;
VertexAttribute
<
VEC3
>
normal
;
...
...
Apps/Tuto/tuto_oper2.cpp
View file @
9584150d
...
...
@@ -357,8 +357,10 @@ void MyQT::cb_Open()
void
MyQT
::
cb_Save
()
{
std
::
string
filename
=
selectFileSave
(
"Export SVG file "
,
"."
,
"(*.off)"
);
Algo
::
Surface
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
filename
.
c_str
());
std
::
string
filename
=
selectFileSave
(
"Export Map file "
,
"."
,
"(*.map)"
);
//Algo::Surface::Export::exportOFF<PFP>(myMap,position,filename.c_str());
if
(
!
myMap
.
saveMapBin
(
filename
))
std
::
cout
<<
"could not save file : "
<<
filename
<<
std
::
endl
;
}
void
MyQT
::
importMesh
(
std
::
string
&
filename
)
...
...
Apps/Tuto/tuto_oper3.cpp
View file @
9584150d
...
...
@@ -259,9 +259,20 @@ void MyQT::createMap(int n)
position
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
if
(
!
position
.
isValid
())
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
myMap
,
position
);
prim
.
hexaGrid_topo
(
n
,
n
,
n
);
prim
.
embedHexaGrid
(
1.0
f
,
1.0
f
,
1.0
f
);
// Algo::Volume::Modelisation::Primitive3D<PFP> prim(myMap, position);
// prim.hexaGrid_topo(n,n,n);
// prim.embedHexaGrid(1.0f,1.0f,1.0f);
// Algo::Surface::Modelisation::Polyhedron<PFP> poly(myMap, position);
// poly.cylinder_topo(6,1,true,true);
// poly.embedCylinder(6.0,6.0,5.0);
// myMap.closeMap();
Dart
d
=
Algo
::
Surface
::
Modelisation
::
embedPrism
<
PFP
>
(
myMap
,
position
,
5
,
true
,
6.0
,
6.0
,
5.0
);
Dart
d2
=
Algo
::
Surface
::
Modelisation
::
embedPyramid
<
PFP
>
(
myMap
,
position
,
4
,
true
,
6.0
,
5.0
);
myMap
.
sewVolumes
(
myMap
.
phi2
(
d
),
d2
);
position
[
myMap
.
phi_1
(
myMap
.
phi2
(
d2
))]
+=
VEC3
(
9.0
,
-
5.0
,
-
2.5
);
myMap
.
check
();
...
...
@@ -565,8 +576,8 @@ void MyQT::cb_keyPress(int keycode)
updateGL
();
break
;
case
'W'
:
m_ex1
=
0.9
f
;
m_ex2
=
0.9
f
;
m_ex1
=
0.9
5
f
;
m_ex2
=
0.9
5
f
;
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
m_ex1
,
m_ex2
,
m_ex3
/*, nb*/
);
updateGL
();
break
;
...
...
SCHNApps/Plugins/renderTopoSurface/include/renderTopoSurface.h
View file @
9584150d
...
...
@@ -64,7 +64,7 @@ public:
virtual
void
keyPress
(
View
*
view
,
QKeyEvent
*
event
)
{}
virtual
void
keyRelease
(
View
*
view
,
QKeyEvent
*
event
)
{}
virtual
void
mousePress
(
View
*
view
,
QMouseEvent
*
event
)
{}
virtual
void
mousePress
(
View
*
view
,
QMouseEvent
*
event
)
;
virtual
void
mouseRelease
(
View
*
view
,
QMouseEvent
*
event
)
{}
virtual
void
mouseMove
(
View
*
view
,
QMouseEvent
*
event
)
{}
virtual
void
wheelEvent
(
View
*
view
,
QWheelEvent
*
event
)
{}
...
...
@@ -100,6 +100,9 @@ public slots:
void
attributeModified
(
unsigned
int
orbit
,
QString
nameAttr
);
void
connectivityModified
();
signals:
void
dartSelected
(
Dart
d
);
};
}
// namespace SCHNApps
...
...
SCHNApps/Plugins/renderTopoSurface/src/renderTopoSurface.cpp
View file @
9584150d
...
...
@@ -86,6 +86,22 @@ void RenderTopoSurfacePlugin::redraw(View* view)
}
}
void
RenderTopoSurfacePlugin
::
mousePress
(
View
*
view
,
QMouseEvent
*
event
)
{
// if (Shift())
// {
// ParameterSet* params = h_viewParams[view];
// m_renderTopo->updateData<PFP>(myMap, position, m_coeff_topo_explod[0], m_coeff_topo_explod[1], m_coeff_topo_explod[2], *m_selNoBoundary) ;
// Dart d = m_renderTopo->picking<PFP>(myMap, x, y, *m_selNoBoundary);
// if (d != Dart::nil())
// {
// emit(dartSelected(d);
// }
// }
}
void
RenderTopoSurfacePlugin
::
viewLinked
(
View
*
view
,
Plugin
*
plugin
)
{
if
(
plugin
==
this
)
...
...
include/Algo/DecimationVolumes/approximator.h
View file @
9584150d
...
...
@@ -37,7 +37,7 @@ namespace Algo
namespace
Volume
{
namespace
Decimation
Volumes
namespace
Decimation
{
enum
ApproximatorType
...
...
@@ -144,9 +144,9 @@ public:
};
}
// namespace Decimation
Volumes
}
// namespace Decimation
}
}
// namespace Volume
}
// namespace Algo
...
...
include/Algo/DecimationVolumes/decimator.h
View file @
9584150d
...
...
@@ -39,7 +39,7 @@ namespace Algo
namespace
Volume
{
namespace
Decimation
Volumes
namespace
Decimation
{
template
<
typename
PFP
>
...
...
@@ -51,9 +51,9 @@ void decimate(
unsigned
int
percentWantedVertices
);
}
//namespace Decimation
Volumes
}
//namespace Decimation
}
}
//namesapce Volume
}
//namespace Algo
...
...
include/Algo/DecimationVolumes/decimator.hpp
View file @
9584150d
...
...
@@ -31,7 +31,7 @@ namespace Algo
namespace
Volume
{
namespace
Decimation
Volumes
namespace
Decimation
{
template
<
typename
PFP
>
...
...
@@ -56,10 +56,10 @@ void decimate(typename PFP::MAP& map, SelectorType s, ApproximatorType a,
switch
(
s
)
{
case
S_MapOrder
:
selector
=
new
Algo
::
DecimationVolumes
::
EdgeSelector_MapOrder
<
PFP
>
(
map
,
position
,
approximators
)
;
selector
=
new
Algo
::
Volume
::
Decimation
::
EdgeSelector_MapOrder
<
PFP
>
(
map
,
position
,
approximators
)
;
break
;
case
S_Random
:
selector
=
new
Algo
::
DecimationVolumes
::
EdgeSelector_Random
<
PFP
>
(
map
,
position
,
approximators
)
;
selector
=
new
Algo
::
Volume
::
Decimation
::
EdgeSelector_Random
<
PFP
>
(
map
,
position
,
approximators
)
;
break
;
default:
CGoGNout
<<
"not yet implemented"
<<
CGoGNendl
;
...
...
@@ -122,9 +122,9 @@ void decimate(typename PFP::MAP& map, SelectorType s, ApproximatorType a,
delete
(
*
it
)
;
}
}
//namespace Decimation
Volumes
}
//namespace Decimation
}
}
//namespace Volume
}
//namespace Algo
...
...
include/Algo/DecimationVolumes/edgeSelector.h
View file @
9584150d
...
...
@@ -15,7 +15,7 @@ namespace Algo
namespace
Volume
{
namespace
Decimation
Volumes
namespace
Decimation
{
/*
...
...
@@ -186,9 +186,9 @@ public:
}
//end namespace Decimation
Volumes
}
//end namespace Decimation
}
}
//namespace Volume
}
//end namespace Algo
...
...
include/Algo/DecimationVolumes/edgeSelector.hpp
View file @
9584150d
...
...
@@ -35,7 +35,7 @@ namespace Algo
namespace
Volume
{
namespace
Decimation
Volumes
namespace
Decimation
{
/************************************************************************************
* MAP ORDER *
...
...
@@ -323,7 +323,7 @@ void EdgeSelector_SG98<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
// einfo.valid = true ;
}
}
//end namespace Decimation
Volumique
}
}
//end namespace Decimation
}
//namespace Volume
}
//end namespace Algo
}
//end namespace CGoGN
include/Algo/DecimationVolumes/geometryApproximator.h
View file @
9584150d
...
...
@@ -36,7 +36,7 @@ namespace Algo
namespace
Volume
{
namespace
Decimation
Volumes
namespace
Decimation
{
template
<
typename
PFP
>
...
...
@@ -78,9 +78,9 @@ public:
}
;
}
//namespace Decimation
Volumes
}
//namespace Decimation
}
}
//namespace Volume
}
//namespace Algo
...
...
include/Algo/DecimationVolumes/geometryApproximator.hpp
View file @
9584150d
...
...
@@ -34,7 +34,7 @@ namespace Algo
namespace
Volume
{
namespace
Decimation
Volumes
namespace
Decimation
{
/************************************************************************************
...
...
@@ -122,9 +122,9 @@ void Approximator_HalfCollapse<PFP>::approximate(Dart d)
// }
}
}
//end namespace Decimation
Volumes
}
//end namespace Decimation
}
}
//namespace Volume
}
//end namespace Algo
...
...
include/Algo/DecimationVolumes/operator.h
View file @
9584150d
...
...
@@ -37,7 +37,7 @@ namespace Algo
namespace
Volume
{
namespace
Decimation
Volumes
namespace
Decimation
{
enum
OperatorType
...
...
@@ -179,9 +179,9 @@ public:
};
}
//end namespace Decimation
Volumes
}
//end namespace Decimation
}
}
//namespace Volume
}
//end namespace Algo
...
...
include/Algo/DecimationVolumes/operator.hpp
View file @
9584150d
...
...
@@ -31,7 +31,7 @@ namespace Algo
namespace
Volume
{
namespace
Decimation
Volumes
namespace
Decimation
{
/************************************************************************************
...
...
@@ -161,9 +161,9 @@ void OperatorList<PFP>::refine(VertexAttribute<typename PFP::VEC3>& position)
}
}
//end namespace Decimation
Volumes
}
//end namespace Decimation
}
}
//namespace Volume
}
//end namespace Algo
...
...
include/Algo/DecimationVolumes/selector.h
View file @
9584150d
...
...
@@ -13,7 +13,7 @@ namespace Algo
namespace
Volume
{
namespace
Decimation
Volumes
namespace
Decimation
{
enum
SelectorType
...
...
@@ -62,9 +62,9 @@ public:
virtual
void
updateWithoutCollapse
()
=
0
;
};
}
//end namespace Decimation
Volumes
}
//end namespace Decimation
}
}
//namespace Volume
}
//end namespace Algo
...
...
include/Algo/ImplicitHierarchicalMesh/ihm.h
View file @
9584150d
...
...
@@ -60,7 +60,21 @@ public:
static
const
unsigned
int
DIMENSION
=
2
;
void
init
()
;
//!
/*!
*
*/
void
update_topo_shortcuts
();
void
initImplicitProperties
()
;
/**
* clear the map
* @param remove attrib remove attribute (not only clear the content)
*/
void
clear
(
bool
removeAttrib
);
/***************************************************
* ATTRIBUTES MANAGEMENT *
...
...
include/Algo/ImplicitHierarchicalMesh/ihm.hpp
View file @
9584150d
...
...
@@ -66,6 +66,17 @@ AttributeHandler_IHM<T, ORBIT> ImplicitHierarchicalMap::getAttribute(const std::
return
AttributeHandler_IHM
<
T
,
ORBIT
>
(
this
,
h
.
getDataVector
())
;
}
inline
void
ImplicitHierarchicalMap
::
update_topo_shortcuts
()
{
Map2
::
update_topo_shortcuts
();
m_dartLevel
=
Map2
::
getAttribute
<
unsigned
int
,
DART
>
(
"dartLevel"
)
;
m_edgeId
=
Map2
::
getAttribute
<
unsigned
int
,
DART
>
(
"edgeId"
)
;
//AttributeContainer& cont = m_attribs[DART] ;
//m_nextLevelCell = cont.getDataVector<unsigned int>(cont.getAttributeIndex("nextLevelCell")) ;
}
/***************************************************
* MAP TRAVERSAL *
***************************************************/
...
...
@@ -278,7 +289,6 @@ inline unsigned int ImplicitHierarchicalMap::getCurrentLevel()
inline
void
ImplicitHierarchicalMap
::
setCurrentLevel
(
unsigned
int
l
)
{
assert
(
l
>=
0
||
!
"Trying to set current level to a negative value"
)
;
m_curLevel
=
l
;
}
...
...
include/Algo/ImplicitHierarchicalMesh/ihm3.hpp
View file @
9584150d
...
...
@@ -80,7 +80,7 @@ inline void ImplicitHierarchicalMap3::update_topo_shortcuts()
/***************************************************
*
MAP TRAVERSAL
*
*
MAP TRAVERSAL
*
***************************************************/
inline
Dart
ImplicitHierarchicalMap3
::
newDart
()
...
...
@@ -453,7 +453,6 @@ inline unsigned int ImplicitHierarchicalMap3::getCurrentLevel()
inline
void
ImplicitHierarchicalMap3
::
setCurrentLevel
(
unsigned
int
l
)
{
assert
(
l
>=
0
||
!
"Trying to set current level to a negative value"
)
;
m_curLevel
=
l
;
}
...
...
include/Algo/Import/importMesh.hpp
View file @
9584150d
...
...
@@ -111,11 +111,15 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
if
(
good_dart
!=
NIL
)
{
if
(
(
d
!=
map
.
phi2
(
d
))
&&
(
good_dart
!=
map
.
phi2
(
good_dart
))
)
if
(
good_dart
==
map
.
phi2
(
good_dart
)
)
{
map
.
sewFaces
(
d
,
good_dart
,
false
);
m
.
unmarkOrbit
<
EDGE
>
(
d
);
}
else
{
++
nbBoundaryEdges
;
}
}
else
{
...
...
include/Algo/Modelisation/polyhedron.h
View file @
9584150d
...
...
@@ -137,7 +137,12 @@ template <typename PFP>
bool
isPrism
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
unsigned
int
thread
=
0
);
template
<
typename
PFP
>
Dart
embedPrism
(
typename
PFP
::
MAP
&
map
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
unsigned
int
n
,
bool
withBoundary
,
float
bottom_radius
,
float
top_radius
,
float
height
);
template
<
typename
PFP
>
Dart
embedPyramid
(
typename
PFP
::
MAP
&
map
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
unsigned
int
n
,
bool
withBoundary
,
float
radius
,
float
height
);
...
...
include/Algo/Modelisation/polyhedron.hpp
View file @
9584150d
...
...
@@ -234,7 +234,135 @@ Dart createOctahedron(typename PFP::MAP& map, bool withBoundary)
return
createDiamond
<
PFP
>
(
map
,
4
,
withBoundary
);
}
template
<
typename
PFP
>
Dart
embedPrism
(
typename
PFP
::
MAP
&
map
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
unsigned
int
n
,
bool
withBoundary
,
float
bottom_radius
,
float
top_radius
,
float
height
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
unsigned
int
m_nz
=
1
;
Dart
dres
=
Dart
::
nil
();
unsigned
int
nb
=
n
*
2
;
std
::
vector
<
Dart
>
m_tableVertDarts
;
m_tableVertDarts
.
reserve
(
nb
);
// creation of quads around circunference and storing vertices
for
(
unsigned
int
i
=
0
;
i
<
n
;
++
i
)
{
Dart
d
=
map
.
newFace
(
4
,
false
);
m_tableVertDarts
.
push_back
(
d
);
}
// storing a dart from the vertex pointed by phi1(phi1(d))
for
(
unsigned
int
i
=
0
;
i
<
n
;
++
i
)
{
//m_tableVertDarts.push_back(map.phi1(map.phi1(m_tableVertDarts[i])));
m_tableVertDarts
.
push_back
(
map
.
phi_1
(
m_tableVertDarts
[
i
]));
}
// sewing the quads
for
(
unsigned
int
i
=
0
;
i
<
n
-
1
;
++
i
)
{
Dart
d
=
m_tableVertDarts
[
i
];
d
=
map
.
phi_1
(
d
);
Dart
e
=
m_tableVertDarts
[
i
+
1
];
e
=
map
.
phi1
(
e
);
map
.
sewFaces
(
d
,
e
,
false
);
}
//sewing the last with the first
map
.
sewFaces
(
map
.
phi1
(
m_tableVertDarts
[
0
]),
map
.
phi_1
(
m_tableVertDarts
[
n
-
1
]),
false
);
//sewing the top & bottom faces
Dart
top
=
map
.
newFace
(
n
,
false
);
Dart
bottom
=
map
.
newFace
(
n
,
false
);
dres
=
top
;
for
(
unsigned
int
i
=
0
;
i
<
n
;
++
i
)
{
map
.
sewFaces
(
m_tableVertDarts
[
i
],
top
,
false
);
map
.
sewFaces
(
map
.
phi_1
(
m_tableVertDarts
[
n
+
i
]),
bottom
,
false
);
top
=
map
.
phi1
(
top
);
bottom
=
map
.
phi_1
(
bottom
);
}
if
(
map
.
dimension
()
==
3
&&
withBoundary
)
map
.
closeMap
();
float
alpha
=
float
(
2.0
*
M_PI
/
n
);
float
dz
=
height
/
float
(
m_nz
);
for
(
unsigned
int
i
=
0
;
i
<=
m_nz
;
++
i
)
{
float
a
=
float
(
i
)
/
float
(
m_nz
);
float
radius
=
a
*
top_radius
+
(
1.0
f
-
a
)
*
bottom_radius
;
for
(
unsigned
int
j
=
0
;
j
<
n
;
++
j
)
{
float
x
=
radius
*
cos
(
alpha
*
float
(
j
));
float
y
=
radius
*
sin
(
alpha
*
float
(
j
));
position
[
m_tableVertDarts
[
i
*
n
+
j
]
]
=
VEC3
(
x
,
y
,
-
height
/
2
+
dz
*
float
(
i
));
}
}
return
dres
;
}
template
<
typename
PFP
>
Dart
embedPyramid
(
typename
PFP
::
MAP
&
map
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
unsigned
int
n
,
bool
withBoundary
,
float
radius
,
float
height
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
Dart
dres
=
Dart
::
nil
();
std
::
vector
<
Dart
>
m_tableVertDarts
;
m_tableVertDarts
.
reserve
(
n
);
// creation of triangles around circunference and storing vertices
for
(
unsigned
int
i
=
0
;
i
<
n
;
++
i
)
{
Dart
d
=
map
.
newFace
(
3
,
false
);
m_tableVertDarts
.
push_back
(
d
);
}
// sewing the triangles
for
(
unsigned
int
i
=
0
;
i
<
n
-
1
;
++
i
)
{
Dart
d
=
m_tableVertDarts
[
i
];
d
=
map
.
phi_1
(
d
);
Dart
e
=
m_tableVertDarts
[
i
+
1
];
e
=
map
.
phi1
(
e
);
map
.
sewFaces
(
d
,
e
,
false
);
}
//sewing the last with the first
map
.
sewFaces
(
map
.
phi1
(
m_tableVertDarts
[
0
]),
map
.
phi_1
(
m_tableVertDarts
[
n
-
1
]),
false
);
//sewing the bottom face
Dart
base
=
map
.
newFace
(
n
,
false
);
dres
=
base
;
for
(
unsigned
int
i
=
0
;
i
<
n
;
++
i
)
{
map
.
sewFaces
(
m_tableVertDarts
[
i
],
base
,
false
);
base
=
map
.
phi1
(
base
);
}