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 "Base/DataStructures/Graph/SphericalGraph.h"
16 #include "Base/Math/MathTools.h"
17 #include "Math/Math3d.h"
18 #include <vector>
19 #include <float.h>
20 
21 // *****************************************************************
22 // enums
23 // *****************************************************************
25 {
29 };
30 
31 // *****************************************************************
32 // implementation of class Face
33 // *****************************************************************
34 class Face
35 {
36 public:
37  Face() {};
38  Face(int n1, int n2, int n3)
39  {
40  set(n1, n2, n3);
41  };
42  ~Face() {};
43 
44  void set(int n1, int n2, int n3)
45  {
46  m_n1 = n1;
47  m_n2 = n2 ;
48  m_n3 = n3;
49  };
50 
51  int m_n1;
52  int m_n2;
53  int m_n3;
54 };
55 
56 // *****************************************************************
57 // implementation of CGraphGenerator
58 // *****************************************************************
60 {
61 public:
62  static void generateGraph(CSphericalGraph* pPlainGraph, EPolyhedronType nBaseType, int nLevels, float fRadius);
63 
64 private:
65  static void initBasePolyhedron(EPolyhedronType nBaseType);
66  static void generateTetrahedron();
67  static void generateOctahedron();
68  static void generateIcosahedron();
69  static void subDivide();
70  static void projectToSphere(float fRadius);
71  static void buildNodesAndEdges(CSphericalGraph* pGraph);
72  static int findVertex(Vec3d position, float fEpsilon);
73 
74 private:
75  CGraphGenerator() {};
76  ~CGraphGenerator() {};
77 
78  static vector<Vec3d> m_Vertices;
79  static vector<Face> m_Faces;
80 };
81 
Face::m_n3
int m_n3
Definition: GraphGenerator.h:53
Face::m_n1
int m_n1
Definition: GraphGenerator.h:49
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:38
Face::Face
Face()
Definition: GraphGenerator.h:37
eIcosahedron
@ eIcosahedron
Definition: GraphGenerator.h:28
Face::set
void set(int n1, int n2, int n3)
Definition: GraphGenerator.h:44
Face
Definition: GraphGenerator.h:34
eTetrahedron
@ eTetrahedron
Definition: GraphGenerator.h:26
eOctahedron
@ eOctahedron
Definition: GraphGenerator.h:27
GfxTL::Vec3d
VectorXD< 3, double > Vec3d
Definition: VectorXD.h:695
EPolyhedronType
EPolyhedronType
Definition: GraphGenerator.h:24
Face::m_n2
int m_n2
Definition: GraphGenerator.h:52
Face::~Face
~Face()
Definition: GraphGenerator.h:42
CSphericalGraph
Definition: SphericalGraph.h:93
CGraphGenerator
Definition: GraphGenerator.h:59