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// *****************************************************************
32
33// *****************************************************************
34// implementation of class Face
35// *****************************************************************
36class Face
37{
38public:
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// *****************************************************************
64class CGraphGenerator
65{
66public:
67 static void generateGraph(CSphericalGraph* pPlainGraph,
68 EPolyhedronType nBaseType,
69 int nLevels,
70 float fRadius);
71
72private:
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
82private:
83 CGraphGenerator(){};
84 ~CGraphGenerator(){};
85
86 static vector<Vec3d> m_Vertices;
87 static vector<Face> m_Faces;
88};
EPolyhedronType
@ eOctahedron
@ eTetrahedron
@ eIcosahedron
static void generateGraph(CSphericalGraph *pPlainGraph, EPolyhedronType nBaseType, int nLevels, float fRadius)
Face(int n1, int n2, int n3)
void set(int n1, int n2, int n3)