VISR  0.11.1
Versatile Interactive Scene Renderer
interpolation_parameter.hpp
Go to the documentation of this file.
1 /* Copyright Institute of Sound and Vibration Research - All rights reserved */
2 
3 #ifndef VISR_RBBL_INTERPOLATION_PARAMETER_HPP_INCLUDED
4 #define VISR_RBBL_INTERPOLATION_PARAMETER_HPP_INCLUDED
5 
6 #include "export_symbols.hpp"
7 
11 
12 #include <limits>
13 #include <set>
14 #include <vector>
15 
16 namespace visr
17 {
18 namespace rbbl
19 {
20 
24 class VISR_RBBL_LIBRARY_SYMBOL InterpolationParameter
25 {
26 public:
27  using IdType = std::size_t;
28  using IndexType = std::size_t;
29  using WeightType = float;
30  using IndexContainer = std::vector<IndexType>;
31  using WeightContainer = std::vector<WeightType>;
32 
34 
35  explicit InterpolationParameter( IdType id, std::size_t numberOfInterpolants );
36 
37  explicit InterpolationParameter( IdType id, IndexContainer const & indices, WeightContainer const & weights );
38 
39  explicit InterpolationParameter( IdType id, std::initializer_list<IndexType> const & indices, std::initializer_list<WeightType> const & weights );
40 
42 
43  IdType id() const;
44 
45  void setId( IdType newId );
46 
47  IdType static constexpr cInvalidId = std::numeric_limits<IdType>::max();
48 
49  IndexType static constexpr cInvalidIndex = std::numeric_limits<IndexType>::max();
50 
51  std::size_t numberOfInterpolants() const;
52 
53  IndexType index( std::size_t idx ) const;
54 
55  IndexContainer const & indices() const;
56 
57  WeightContainer const & weights() const;
58 
59  WeightType weight( std::size_t idx ) const;
60 
61  void setIndex( std::size_t idx, IndexType newIndex );
62 
63  void setIndices( IndexContainer const & newIndices );
64 
65  void setIndices( std::initializer_list<IndexType> const & newWeights );
66 
67  void setWeight( std::size_t idx, WeightType weight );
68 
69  void setWeights( WeightContainer const & newWeights );
70 
71  void setWeights( std::initializer_list<WeightType> const & newWeights );
72 
73 private:
74  IdType mId;
75 
76  IndexContainer mIndices;
77  WeightContainer mWeights;
78 };
79 
80 inline bool VISR_RBBL_LIBRARY_SYMBOL operator<(InterpolationParameter const & lhs, InterpolationParameter const & rhs )
81 {
82  return lhs.id() < rhs.id();
83 }
84 
85 class InterpolationParameterSet: public std::set<InterpolationParameter>
86 {
87 public:
88  using Base = std::set<InterpolationParameter>;
89 
90  using std::set<InterpolationParameter>::set;
91  // using Base::Base;
92 };
93 
94 } // namespace rbbl
95 } // namespace visr
96 
97 #endif // VISR_RBBL_INTERPOLATION_PARAMETER_HPP_INCLUDED
Definition: interpolation_parameter.hpp:85
std::vector< IndexType > IndexContainer
Definition: interpolation_parameter.hpp:30
Definition: options.cpp:10
Definition: interpolation_parameter.hpp:24
std::vector< WeightType > WeightContainer
Definition: interpolation_parameter.hpp:31
bool operator<(InterpolationParameter const &lhs, InterpolationParameter const &rhs)
Definition: interpolation_parameter.hpp:80
float WeightType
Definition: interpolation_parameter.hpp:29
std::size_t IndexType
Definition: interpolation_parameter.hpp:28
std::size_t IdType
Definition: interpolation_parameter.hpp:27
std::set< InterpolationParameter > Base
Definition: interpolation_parameter.hpp:88
IdType id() const
Definition: interpolation_parameter.cpp:56