34 #include <cugar/basic/types.h> 112 static const uint32 kInvalid = uint32(-1);
122 m_packed_info( 7u | (index << 3) ) {}
129 CUGAR_HOST_DEVICE
Kd_node(
const uint32 split_dim,
const float split_plane, uint32 index) :
130 m_packed_info( split_dim | (index << 3) ),
131 m_split_plane( split_plane ) {}
136 CUGAR_HOST_DEVICE
Kd_node(
const uint32 packed_info,
const float split_plane) :
137 m_packed_info( packed_info ),
138 m_split_plane(split_plane) {}
144 return (m_packed_info & 7u) == 7u;
150 return m_packed_info >> 3u;
156 return m_packed_info >> 3u;
161 CUGAR_HOST_DEVICE uint32
get_child(
const uint32 i)
const 170 return is_leaf() ? false :
true;
187 CUGAR_HOST_DEVICE uint32
get_split_dim()
const {
return (m_packed_info & 7u); }
196 #if defined(CUGAR_DEVICE_COMPILATION) 197 const uint2 u = *
reinterpret_cast<const uint2*
>(node);
198 return Kd_node(u.x,__uint_as_float(u.y));
207 #if defined(CUGAR_DEVICE_COMPILATION) 208 const uint2 u = __ldg(reinterpret_cast<const uint2*>(node));
209 return Kd_node(u.x,__uint_as_float(u.y));
215 uint32 m_packed_info;
CUGAR_HOST_DEVICE uint32 get_child(const uint32 i) const
Definition: kd_node.h:161
CUGAR_HOST_DEVICE uint32 is_leaf() const
Definition: kd_node.h:142
Definition: kd_node.h:110
CUGAR_HOST_DEVICE bool has_child(const uint32 i) const
Definition: kd_node.h:168
CUGAR_HOST_DEVICE Kd_node(uint32 index)
Definition: kd_node.h:121
CUGAR_HOST_DEVICE uint32 get_split_dim() const
Definition: kd_node.h:187
CUGAR_HOST_DEVICE Kd_node()
Definition: kd_node.h:116
Define a vector_view POD type and plain_view() for std::vector.
Definition: diff.h:38
CUGAR_HOST_DEVICE uint32 get_leaf_index() const
Definition: kd_node.h:154
CUGAR_HOST_DEVICE float get_split_plane() const
Definition: kd_node.h:191
CUGAR_HOST_DEVICE uint32 get_right() const
Definition: kd_node.h:180
CUGAR_HOST_DEVICE Kd_node(const uint32 split_dim, const float split_plane, uint32 index)
Definition: kd_node.h:129
CUGAR_HOST_DEVICE Kd_node(const uint32 packed_info, const float split_plane)
Definition: kd_node.h:136
CUGAR_HOST_DEVICE uint32 get_left() const
Definition: kd_node.h:174
CUGAR_HOST_DEVICE uint32 get_child_offset() const
Definition: kd_node.h:148