Skip to content

Commit

Permalink
Begin outlining a new Node class
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonCampolattaro committed Jul 2, 2020
1 parent 5402eea commit a8cb911
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 7 deletions.
48 changes: 48 additions & 0 deletions Octree/include/CGAL/Octree/Node.h
@@ -0,0 +1,48 @@
#ifndef OCTREE_NODE_H
#define OCTREE_NODE_H

#include <array>
#include <memory>

namespace CGAL {
namespace Octree {

template <typename Value>
class Node {

public:

typedef std::array<Node<Value>, 8> Child_list;

private:

Value m_value;

const Node<Value> *m_parent;
uint8_t m_depth;

std::unique_ptr<Child_list> m_children;

public:

Node(Value value, Node<Value> *parent = nullptr) {

m_value = value;
m_parent = parent;
if (parent)
m_depth = parent->m_depth + 1;
}

void split() {

}

void unsplit() {

}

};
}
}

#endif //OCTREE_NODE_H
16 changes: 16 additions & 0 deletions Octree/include/CGAL/Octree/Octree_node.h
Expand Up @@ -174,10 +174,26 @@ namespace CGAL {
/// \name Child Accessors
/// @{

/*!
* \brief Access the child nodes of this node by their indices
*
* \todo
*
* \param index
* \return
*/
Node &operator[](int index) {
return (*m_children)[index];
}

/*!
* \brief Read-only access the child nodes of this node by their indices
*
* \todo
*
* \param index
* \return
*/
const Node &operator[](int index) const {
return (*m_children)[index];
}
Expand Down
16 changes: 9 additions & 7 deletions Octree/test/Octree/CMakeLists.txt
Expand Up @@ -2,14 +2,16 @@
# This is the CMake script for compiling a CGAL application.

cmake_minimum_required(VERSION 3.1...3.14)
project( Octree )
project(Octree)

find_package(CGAL REQUIRED QUIET OPTIONAL_COMPONENTS Core )
find_package(CGAL REQUIRED QUIET OPTIONAL_COMPONENTS Core)

create_single_source_cgal_program( "octree_test.cpp" )
create_single_source_cgal_program( "test_octree_equality.cpp" )
create_single_source_cgal_program( "test_octree_refine.cpp" )
create_single_source_cgal_program("octree_test.cpp")
create_single_source_cgal_program("test_octree_equality.cpp")
create_single_source_cgal_program("test_octree_refine.cpp")

create_single_source_cgal_program( "test_node_index.cpp" )
create_single_source_cgal_program( "test_tree_walk.cpp" )
create_single_source_cgal_program("test_node.cpp")

create_single_source_cgal_program("test_node_index.cpp")
create_single_source_cgal_program("test_tree_walk.cpp")

7 changes: 7 additions & 0 deletions Octree/test/Octree/test_node.cpp
@@ -0,0 +1,7 @@

#include <CGAL/Octree/Node.h>

int main(void) {

return 0;
}
1 change: 1 addition & 0 deletions Octree/test/Octree/test_tree_walk.cpp
Expand Up @@ -3,6 +3,7 @@
#include <CGAL/Octree.h>
#include <CGAL/Octree/IO.h>
#include <CGAL/Octree/Tree_walker_criterion.h>
#include <CGAL/Octree/Node.h>

#include <CGAL/Simple_cartesian.h>
#include <CGAL/Point_set_3.h>
Expand Down

0 comments on commit a8cb911

Please sign in to comment.