GraphGenerator.h
Go to the documentation of this file.
1 // *****************************************************************
2 // Filename: GraphGenerator.h
3 // Copyright: Kai Welke, Chair Prof. Dillmann (IAIM),
4 // Institute for Computer Science and Engineering (CSE),
5 // University of Karlsruhe. All rights reserved.
6 // Author: Kai Welke
7 // Date: 08.07.2008
8 // *****************************************************************
9 
10 #pragma once
11 
12 // *****************************************************************
13 // includes
14 // *****************************************************************
15 #include <float.h>
16 
17 #include <vector>
18 
19 #include "Base/DataStructures/Graph/SphericalGraph.h"
20 #include "Base/Math/MathTools.h"
21 #include "Math/Math3d.h"
22 
23 // *****************************************************************
24 // enums
25 // *****************************************************************
27 {
31 };
32 
33 // *****************************************************************
34 // implementation of class Face
35 // *****************************************************************
36 class Face
37 {
38 public:
39  Face(){};
40 
41  Face(int n1, int n2, int n3)
42  {
43  set(n1, n2, n3);
44  };
45 
46  ~Face(){};
47 
48  void
49  set(int n1, int n2, int n3)
50  {
51  m_n1 = n1;
52  m_n2 = n2;
53  m_n3 = n3;
54  };
55 
56  int m_n1;
57  int m_n2;
58  int m_n3;
59 };
60 
61 // *****************************************************************
62 // implementation of CGraphGenerator
63 // *****************************************************************
65 {
66 public:
67  static void generateGraph(CSphericalGraph* pPlainGraph,
68  EPolyhedronType nBaseType,
69  int nLevels,
70  float fRadius);
71 
72 private:
73  static void initBasePolyhedron(EPolyhedronType nBaseType);
74  static void generateTetrahedron();
75  static void generateOctahedron();
76  static void generateIcosahedron();
77  static void subDivide();
78  static void projectToSphere(float fRadius);
79  static void buildNodesAndEdges(CSphericalGraph* pGraph);
80  static int findVertex(Vec3d position, float fEpsilon);
81 
82 private:
83  CGraphGenerator(){};
84  ~CGraphGenerator(){};
85 
86  static vector<Vec3d> m_Vertices;
87  static vector<Face> m_Faces;
88 };
Face::m_n3
int m_n3
Definition: GraphGenerator.h:58
Face::m_n1
int m_n1
Definition: GraphGenerator.h:54
GfxTL::Vec3d
VectorXD< 3, double > Vec3d
Definition: VectorXD.h:737
CGraphGenerator::generateGraph
static void generateGraph(CSphericalGraph *pPlainGraph, EPolyhedronType nBaseType, int nLevels, float fRadius)
Definition: GraphGenerator.cpp:16
Face::Face
Face(int n1, int n2, int n3)
Definition: GraphGenerator.h:41
Face::Face
Face()
Definition: GraphGenerator.h:39
eIcosahedron
@ eIcosahedron
Definition: GraphGenerator.h:30
Face::set
void set(int n1, int n2, int n3)
Definition: GraphGenerator.h:49
Face
Definition: GraphGenerator.h:36
eTetrahedron
@ eTetrahedron
Definition: GraphGenerator.h:28
eOctahedron
@ eOctahedron
Definition: GraphGenerator.h:29
EPolyhedronType
EPolyhedronType
Definition: GraphGenerator.h:26
Face::m_n2
int m_n2
Definition: GraphGenerator.h:57
Face::~Face
~Face()
Definition: GraphGenerator.h:46
CSphericalGraph
Definition: SphericalGraph.h:105
CGraphGenerator
Definition: GraphGenerator.h:64