Advertisement
samuelYeh

Untitled

Nov 20th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <utility>
  3.  
  4. using namespace std;
  5.  
  6. class coordinate {
  7. public:
  8.     coordinate(int, int, int, int, int, int, int, int, int);
  9.     ~coordinate();
  10.  
  11. private:
  12.     int a, b, c, d, e, w, x, y, z;
  13. };
  14.  
  15. coordinate::coordinate(int a, int b, int c, int d, int e, int w, int x, int y, int z) {
  16.     this->a = a;
  17.     this->b = b;
  18.     this->c = c;
  19.     this->d = d;
  20.     this->e = e;
  21.     this->w = w;
  22.     this->x = x;
  23.     this->y = y;
  24.     this->z = z;
  25. }
  26.  
  27. coordinate::~coordinate() {
  28. }
  29.  
  30. typedef union data {
  31.     int value;
  32.     coordinate point;
  33. } Data;
  34.  
  35. typedef enum type {
  36.     v, p
  37. } Type;
  38.  
  39. class Node {
  40. public:
  41.     Node(Type, char, int, coordinate);
  42.  
  43. private:
  44.     Type type;
  45.     Node* left;
  46.     Node* right;
  47.     Data data;
  48.     char axis;
  49. };
  50.  
  51. Node::Node(Type type, char axis = ' ', int value = 0, coordinate point = coordinate(0,0,0,0,0,0,0,0,0)) {
  52.     this->type = type;
  53.     switch(this->type) {
  54.     case v:
  55.         this->axis = axis;
  56.         this->data.value = value;
  57.         break;
  58.     case p:
  59.         this->data.point = point;
  60.         break;
  61.     default:
  62.         break;
  63.     }
  64. }
  65.  
  66. class KDTree {
  67. public:
  68.     KDTree();
  69.     ~KDTree();
  70.     void insert();
  71. private:
  72.     Node* root;
  73. };
  74.  
  75. KDTree::KDTree() {
  76.     this->root = nullptr;
  77. }
  78.  
  79. KDTree::~KDTree() {
  80. }
  81.  
  82. int main()
  83. {
  84.     return 0;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement