opensurgsim
OctreeNodePlyReaderDelegate-inl.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_DATASTRUCTURES_OCTREENODEPLYREADERDELEGATE_INL_H
17 #define SURGSIM_DATASTRUCTURES_OCTREENODEPLYREADERDELEGATE_INL_H
18 
19 namespace SurgSim
20 {
21 namespace DataStructures
22 {
23 
24 template <typename Data>
26  m_octree(std::make_shared<OctreeNode<Data>>())
27 {
28  static_assert(std::is_default_constructible<Data>::value, "OctreeNode Data needs default constructor.");
29 }
30 
31 template <typename Data>
33  m_octree(octree)
34 {
35  static_assert(std::is_default_constructible<Data>::value, "OctreeNode Data needs default constructor");
36  SURGSIM_ASSERT(!m_octree->hasChildren()) << "Can't process an octree that already has children in it.";
37 }
38 
39 template <typename Data>
41 {
42 
43 }
44 
45 template <typename Data>
46 std::shared_ptr<OctreeNode<Data>> OctreeNodePlyReaderDelegate<Data>::getOctree()
47 {
48  return m_octree;
49 }
50 
51 template <typename Data>
52 void OctreeNodePlyReaderDelegate<Data>::processVoxel(const std::string& elementName)
53 {
54  SurgSim::Math::Vector3d position;
55  position[0] = m_voxel.x;
56  position[1] = m_voxel.y;
57  position[2] = m_voxel.z;
58  m_octree->addData(position, m_numLevels);
59 }
60 
61 template <typename Data>
63 {
64  m_octree->m_boundingBox = m_boundingBox;
65 }
66 
67 }
68 }
69 
70 #endif
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
void processVoxel(const std::string &elementName) override
Callback function to process one voxel.
Definition: OctreeNodePlyReaderDelegate-inl.h:52
Eigen::AlignedBox< double, 3 > m_boundingBox
Bounding box, will be initialized from the file.
Definition: OctreeNodePlyReaderDelegate.h:92
Definition: MockObjects.h:47
#define SURGSIM_ASSERT(condition)
Assert that condition is true.
Definition: Assert.h:77
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
virtual ~OctreeNodePlyReaderDelegate()
Destructor.
Definition: OctreeNodePlyReaderDelegate-inl.h:40
void initializeOctree() override
Set up the octree, this is left up to the derived classes.
Definition: OctreeNodePlyReaderDelegate-inl.h:62
OctreeNodePlyReaderDelegate()
Constructor.
Definition: OctreeNodePlyReaderDelegate-inl.h:25
std::shared_ptr< OctreeNode< Data > > getOctree()
Definition: OctreeNodePlyReaderDelegate-inl.h:46
int m_numLevels
Calculated number of levels for the octree.
Definition: OctreeNodePlyReaderDelegate.h:119
Octree data structure.
Definition: OctreeNode.h:131