MeshLib C++ Docs
Loading...
Searching...
No Matches
MRAABBTreeNode.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRBox.h"
4#include "MRId.h"
5#include "MRVector2.h"
6#include "MRVector3.h"
7
8namespace MR
9{
10
13
14template<typename L, typename B>
16{
17 using LeafTag = L;
18 using LeafId = Id<L>;
19 using BoxT = B;
20};
21
23
24template<typename V>
28
29template<typename T>
31{
32 using LeafId = typename T::LeafId;
33 using BoxT = typename T::BoxT;
34
36 NodeId l, r;
38 bool leaf() const { return !r.valid(); }
40 LeafId leafId() const { assert( leaf() ); return LeafId( int( l ) ); }
41 void setLeafId( LeafId id ) { l = NodeId( int( id ) ); r = NodeId(); }
42
43 AABBTreeNode() noexcept = default;
44 explicit AABBTreeNode( NoInit ) noexcept : box( noInit ), l( noInit ), r( noInit ){}
45};
46
47template<typename T>
49
51{
52 NodeId aNode;
53 NodeId bNode;
54};
55
57
58}
#define MRMESH_CLASS
Definition MRMeshFwd.h:87
stores index of some element, it is made as template class to avoid mixing faces, edges and vertices
Definition MRId.h:19
std::vector<T>-like container that requires specific indexing type,
Definition MRVector.h:23
Vector< AABBTreeNode< T >, NodeId > AABBTreeNodeVec
Definition MRAABBTreeNode.h:48
AABBTreeTraits< FaceTag, Box3f > FaceTreeTraits3
Definition MRAABBTreeNode.h:22
LineTreeTraits< Vector2f > LineTreeTraits2
Definition MRAABBTreeNode.h:26
AABBTreeTraits< UndirectedEdgeTag, Box< V > > LineTreeTraits
Definition MRAABBTreeNode.h:25
LineTreeTraits< Vector3f > LineTreeTraits3
Definition MRAABBTreeNode.h:27
constexpr NoInit noInit
Definition MRMeshFwd.h:98
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
typename Traits::LeafId LeafId
Definition MRAABBTreeNode.h:32
NodeId r
Definition MRAABBTreeNode.h:36
NodeId l
Definition MRAABBTreeNode.h:36
AABBTreeNode() noexcept=default
bool leaf() const
returns true if this is a leaf node without children nodes but with a LeafId reference
Definition MRAABBTreeNode.h:38
BoxT box
Definition MRAABBTreeNode.h:35
void setLeafId(LeafId id)
Definition MRAABBTreeNode.h:41
LeafId leafId() const
returns face (for the leaf node only)
Definition MRAABBTreeNode.h:40
typename Traits::BoxT BoxT
Definition MRAABBTreeNode.h:33
Definition MRAABBTreeNode.h:16
L LeafTag
Definition MRAABBTreeNode.h:17
Id< L > LeafId
Definition MRAABBTreeNode.h:18
B BoxT
Definition MRAABBTreeNode.h:19
Definition MRMeshFwd.h:97
Definition MRAABBTreeNode.h:51
NodeId bNode
Definition MRAABBTreeNode.h:53
NodeId aNode
Definition MRAABBTreeNode.h:52