Rumba C++ SDK
BVH3.h
Go to the documentation of this file.
1 /*
2 
3  *
4  ***
5  *****
6  ********************* Mercenaries Engineering SARL
7  ***************** Copyright (C) 2018
8  *************
9  ********* http://www.mercenaries-engineering.com
10  ***********
11  **** ****
12  ** **
13 
14 */
15 #pragma once
16 
17 #include <gsl/span>
18 #include <functional>
19 
20 #include "Value.h"
21 
22  namespace maquina
23  {
25  class MAQUINA_EXPORT BVH3 : public Value
26  {
27  public:
28 
29  BVH3();
30 
32 
33  BVH3(const Value &v);
34 
36  BVH3(
37  const gsl::span<const Imath::V3f> &points,
38  int obj_per_leaf=4
39  );
40 
42  BVH3(
43  const gsl::span<const Imath::Box3f> &boxes,
44  int obj_per_leaf=4
45  );
46 
48 
51  void select(
52  const Imath::V3f &position, // The position from where the selection is done
53  float max_distance, // The maximum distance selection
54  std::vector<uint32_t> &result // The selected object indices. The vector is not cleared. New indices are pushed at the end.
55  ) const;
56 
58 
74  int closest(
75  const Imath::V3f &position,
76  float& max_distance,
77  const std::function<float(int entry, const Imath::V3f& p)>& distance,
78  bool use_square_distance
79  ) const;
80 
82  BVH3(std::shared_ptr<Impl> impl) { _impl=impl; }
83  };
84  }
Definition: ImathFrame.h:42
A bounding volume hierarchy to quickly select 3d shapes.
Definition: BVH3.h:25
MAQUINA_EXPORT void select(const std::vector< Node > &nodes, SelectionMode mode=SelectionMode::Replace)
Update the active selection with a list of nodes according to the selection mode. ...
This version of the SDK is unstable, i-e, it may change with no warning.
Definition: AddCurveAction.h:20
#define MAQUINA_EXPORT
Definition: Export.h:31
Base class of all Rumba values.
Definition: Value.h:34