coal
3.0.4
Coal, The Collision Detection Library. Previously known as HPP-FCL, fork of FCL -- The Flexible Collision Library
Toggle main menu visibility
Loading...
Searching...
No Matches
morton.h
Go to the documentation of this file.
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Copyright (c) 2011-2014, Willow Garage, Inc.
5
* Copyright (c) 2014-2016, Open Source Robotics Foundation
6
* Copyright (c) 2016, Toyota Research Institute
7
* All rights reserved.
8
*
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
11
* are met:
12
*
13
* * Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
* * Redistributions in binary form must reproduce the above
16
* copyright notice, this list of conditions and the following
17
* disclaimer in the documentation and/or other materials provided
18
* with the distribution.
19
* * Neither the name of Open Source Robotics Foundation nor the names of its
20
* contributors may be used to endorse or promote products derived
21
* from this software without specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
* POSSIBILITY OF SUCH DAMAGE.
35
*/
36
38
39
#ifndef COAL_MORTON_H
40
#define COAL_MORTON_H
41
42
#include "
coal/BV/AABB.h
"
43
#include <cstdint>
44
#include <bitset>
45
46
namespace
coal
{
47
49
namespace
detail
{
50
51
template
<
typename
S>
52
uint32_t quantize(S x, uint32_t n);
53
55
COAL_DLLAPI
56
uint32_t morton_code(uint32_t x, uint32_t y, uint32_t z);
57
59
COAL_DLLAPI
60
uint64_t morton_code60(uint32_t x, uint32_t y, uint32_t z);
61
66
template
<
typename
S,
typename
T>
67
struct
morton_functor {};
68
70
template
<
typename
S>
71
struct
morton_functor<S, uint32_t> {
72
morton_functor(
const
AABB& bbox);
73
74
uint32_t operator()(
const
Vec3s& point)
const
;
75
76
const
Vec3s
base;
77
const
Vec3s
inv;
78
79
static
constexpr
size_t
bits();
80
};
81
82
using
morton_functoru32f = morton_functor<float, uint32_t>;
83
using
morton_functoru32d = morton_functor<CoalScalar, uint32_t>;
84
86
template
<
typename
S>
87
struct
morton_functor<S, uint64_t> {
88
morton_functor(
const
AABB& bbox);
89
90
uint64_t operator()(
const
Vec3s& point)
const
;
91
92
const
Vec3s
base;
93
const
Vec3s
inv;
94
95
static
constexpr
size_t
bits();
96
};
97
100
template
<
typename
S,
size_t
N>
101
struct
morton_functor<S, std::bitset<N>> {
102
static_assert
(N % 3 == 0,
"Number of bits must be a multiple of 3"
);
103
104
morton_functor(
const
AABB& bbox);
105
106
std::bitset<N> operator()(
const
Vec3s& point)
const
;
107
108
const
Vec3s
base;
109
const
Vec3s
inv;
110
111
static
constexpr
size_t
bits();
112
};
113
114
}
// namespace detail
116
}
// namespace coal
117
118
#include "
coal/broadphase/detail/morton-inl.h
"
119
120
#endif
AABB.h
morton-inl.h
coal::detail
Definition
broadphase_dynamic_AABB_tree-inl.h:53
coal
Main namespace.
Definition
broadphase_bruteforce.h:44
coal::Vec3s
Eigen::Matrix< CoalScalar, 3, 1 > Vec3s
Definition
data_types.h:77
include
coal
broadphase
detail
morton.h
Generated by
1.17.0