BV_splitter.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  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of Open Source Robotics Foundation nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
38 #ifndef FCL_BV_SPLITTER_H
39 #define FCL_BV_SPLITTER_H
40 
41 #include <vector>
42 #include <iostream>
43 #include "fcl/math/triangle.h"
44 #include "fcl/math/bv/kIOS.h"
45 #include "fcl/math/bv/OBBRSS.h"
48 
49 namespace fcl
50 {
51 
52 namespace detail
53 {
54 
57 {
61 };
62 
64 template <typename BV>
65 class FCL_EXPORT BVSplitter : public BVSplitterBase<BV>
66 {
67 public:
68 
69  using S = typename BV::S;
70 
72 
74  virtual ~BVSplitter();
75 
77  void set(
78  Vector3<S>* vertices_, Triangle* tri_indices_, BVHModelType type_);
79 
82  void computeRule(
83  const BV& bv, unsigned int* primitive_indices, int num_primitives);
84 
86  bool apply(const Vector3<S>& q) const;
87 
89  void clear();
90 
91 private:
92 
99 
104 
107 
110 
113 
116 
118  void computeRule_bvcenter(
119  const BV& bv, unsigned int* primitive_indices, int num_primitives);
120 
123  void computeRule_mean(
124  const BV& bv, unsigned int* primitive_indices, int num_primitives);
125 
128  void computeRule_median(
129  const BV& bv, unsigned int* primitive_indices, int num_primitives);
130 
131  template <typename, typename>
132  friend struct ApplyImpl;
133 
134  template <typename, typename>
135  friend struct ComputeRuleCenterImpl;
136 
137  template <typename, typename>
138  friend struct ComputeRuleMeanImpl;
139 
140  template <typename, typename>
141  friend struct ComputeRuleMedianImpl;
142 };
143 
144 template <typename S, typename BV>
145 void computeSplitVector(const BV& bv, Vector3<S>& split_vector);
146 
147 template <typename S, typename BV>
148 void computeSplitValue_bvcenter(const BV& bv, S& split_value);
149 
150 template <typename S, typename BV>
152  const BV& bv,
153  Vector3<S>* vertices,
154  Triangle* triangles,
155  unsigned int* primitive_indices,
156  int num_primitives,
157  BVHModelType type,
158  const Vector3<S>& split_vector,
159  S& split_value);
160 
161 template <typename S, typename BV>
163  const BV& bv,
164  Vector3<S>* vertices,
165  Triangle* triangles,
166  unsigned int* primitive_indices,
167  int num_primitives,
168  BVHModelType type,
169  const Vector3<S>& split_vector,
170  S& split_value);
171 
172 } // namespace detail
173 } // namespace fcl
174 
176 
177 #endif
BVH_internal.h
fcl::detail::SPLIT_METHOD_MEDIAN
@ SPLIT_METHOD_MEDIAN
Definition: BV_splitter.h:59
fcl::detail::BVSplitter::split_method
SplitMethodType split_method
The split algorithm used.
Definition: BV_splitter.h:115
triangle.h
fcl::detail::computeSplitValue_bvcenter
void computeSplitValue_bvcenter(const BV &bv, S &split_value)
Definition: BV_splitter-inl.h:550
fcl::detail::computeSplitValue_mean
void computeSplitValue_mean(const BV &bv, Vector3< S > *vertices, Triangle *triangles, unsigned int *primitive_indices, int num_primitives, BVHModelType type, const Vector3< S > &split_vector, S &split_value)
Definition: BV_splitter-inl.h:558
fcl::detail::SplitMethodType
SplitMethodType
Three types of split algorithms are provided in FCL as default.
Definition: BV_splitter.h:56
fcl::BVHModelType
BVHModelType
BVH model type.
Definition: BVH_internal.h:75
fcl::Triangle
Triangle with 3 indices for points.
Definition: triangle.h:48
fcl::detail::ComputeRuleMeanImpl
Definition: BV_splitter-inl.h:149
fcl::Vector3
Eigen::Matrix< S, 3, 1 > Vector3
Definition: types.h:70
BV_splitter_base.h
fcl::detail::BVSplitter::type
BVHModelType type
Whether the geometry is mesh or point cloud.
Definition: BV_splitter.h:112
fcl::detail::computeSplitVector
void computeSplitVector(const BV &bv, Vector3< S > &split_vector)
Definition: BV_splitter-inl.h:523
fcl::detail::BVSplitter::split_axis
int split_axis
The axis based on which the split decision is made. For most BV, the axis is aligned with one of the ...
Definition: BV_splitter.h:97
fcl::detail::ComputeRuleMedianImpl
Definition: BV_splitter-inl.h:202
fcl::detail::ApplyImpl
Definition: BV_splitter-inl.h:99
fcl::detail::BVSplitterBase
Base interface for BV splitting algorithm.
Definition: BV_splitter_base.h:56
BV_splitter-inl.h
fcl::detail::SPLIT_METHOD_MEAN
@ SPLIT_METHOD_MEAN
Definition: BV_splitter.h:58
fcl::detail::SPLIT_METHOD_BV_CENTER
@ SPLIT_METHOD_BV_CENTER
Definition: BV_splitter.h:60
OBBRSS.h
fcl::detail::computeSplitValue_median
void computeSplitValue_median(const BV &bv, Vector3< S > *vertices, Triangle *triangles, unsigned int *primitive_indices, int num_primitives, BVHModelType type, const Vector3< S > &split_vector, S &split_value)
Definition: BV_splitter-inl.h:603
fcl::detail::BVSplitter::split_vector
Vector3< S > split_vector
Definition: BV_splitter.h:98
fcl::detail::BVSplitter::vertices
Vector3< S > * vertices
The mesh vertices or points handled by the splitter.
Definition: BV_splitter.h:106
fcl::detail::BVSplitter::tri_indices
Triangle * tri_indices
The triangles handled by the splitter.
Definition: BV_splitter.h:109
fcl::detail::BVSplitter
A class describing the split rule that splits each BV node.
Definition: BV_splitter.h:65
fcl::detail::BVSplitter::S
typename BV::S S
Definition: BV_splitter.h:69
fcl::detail::BVSplitter::split_value
S split_value
The split threshold, different primitives are splitted according whether their projection on the spli...
Definition: BV_splitter.h:103
fcl::detail::ComputeRuleCenterImpl
Definition: BV_splitter-inl.h:117
kIOS.h
fcl
Main namespace.
Definition: broadphase_bruteforce-inl.h:45


fcl
Author(s):
autogenerated on Tue Dec 5 2023 03:40:48