26 #include "../../algorithm.h"
27 #include "../../physical_quantity.h"
28 #include "../../range.h"
33 template <
typename Derived, std::
size_t N >
42 [[nodiscard]] Derived& impl()
44 return static_cast< Derived&
>( *this );
47 [[nodiscard]] Derived
const& impl()
const
49 return static_cast< Derived const&
>( *this );
60 std::array< float, N >
res;
61 for ( std::size_t
const i :
range(
N ) )
63 return Derived{
res };
69 : data_( std::move( cont ) )
73 template <
typename... T >
75 : data_( { float( t )... } )
77 static_assert(
sizeof...( T ) ==
N,
"Number of parameters has to be N" );
100 [[nodiscard]] constexpr
float operator[]( std::size_t i )
const
112 return { impl() * -1.f };
115 [[nodiscard]] constexpr std::size_t
size()
const
130 template <
typename Derived, std::
size_t N >
137 template <
typename T >
146 typename =
typename std::enable_if_t< std::is_arithmetic_v< T > > >
150 for ( std::size_t
const i :
range(
N ) )
157 template <
typename Derived, std::
size_t N,
typename T >
169 typename =
typename std::enable_if_t< std::is_arithmetic_v< T > > >
173 for ( std::size_t
const i :
range(
N ) )
174 res[i] /= float( s );
180 template <
typename Derived, std::
size_t N >
183 return sum(
range(
N ), [&]( std::size_t i ) {
191 template <
typename Derived, std::
size_t N >
202 template <
typename Derived, std::
size_t N >
210 template <
typename Derived, std::
size_t N >
218 template <
typename Derived, std::
size_t N >
222 for ( std::size_t
const i :
range(
N ) )
227 template <
typename Derived, std::
size_t N >
231 return Derived{ a > b ? *a : *b };
234 template <
typename Derived, std::
size_t N >
235 constexpr Derived
const&
238 return Derived{ a < b ? *a : *b };
243 template <
typename Derived, std::
size_t N >
248 for ( std::size_t
const i :
range(
N ) )
255 template <
typename Derived, std::
size_t N >
260 for ( std::size_t
const i :
range(
N ) )
267 typename UnaryFunction = std::identity,
268 typename Derived = std::decay_t< mapped_t< Container, UnaryFunction > > >
269 constexpr min_max< Derived >
272 min_max< Derived > bound_cube;
274 bound_cube.max = std::numeric_limits< Derived >::lowest();
275 for (
auto const& item : cont ) {
276 auto const& p =
f( item );
283 template <
typename Derived, std::
size_t N >
290 for ( std::size_t
const i :
range(
N ) )
291 res[i] = from[i] + ( goal[i] - from[i] ) * factor;
Definition: vec_point_base.h:35
constexpr const_iterator begin() const
Definition: vec_point_base.h:80
constexpr vec_point_base() noexcept=default
static Derived make_filled_with(value_type val)
Definition: vec_point_base.h:58
constexpr iterator end()
Definition: vec_point_base.h:95
constexpr float & operator[](std::size_t i)
Definition: vec_point_base.h:105
static constexpr std::size_t dimensions
Definition: vec_point_base.h:53
float value_type
Definition: vec_point_base.h:54
typename container::iterator iterator
Definition: vec_point_base.h:56
constexpr Derived operator-() const
Definition: vec_point_base.h:110
constexpr const_iterator end() const
Definition: vec_point_base.h:85
constexpr friend auto operator<=>(vec_point_base const &, vec_point_base const &)=default
constexpr float operator[](std::size_t i) const
Definition: vec_point_base.h:100
constexpr container const & operator*() const
Definition: vec_point_base.h:120
constexpr iterator begin()
Definition: vec_point_base.h:90
std::array< float, N > container
Definition: vec_point_base.h:37
typename container::const_iterator const_iterator
Definition: vec_point_base.h:55
constexpr vec_point_base(T... t)
Definition: vec_point_base.h:74
constexpr std::size_t size() const
Definition: vec_point_base.h:115
constexpr bool vec_point_derived_test(vec_point_base< Derived, N > const &)
Definition: vec_point_base.h:131
MIT License.
Definition: impl.h:31
concept vec_point_derived
Definition: vec_point_base.h:138
constexpr float dot(quaternion const &q, quaternion const &s)
Definition: quaternion.h:101
constexpr Derived dimensional_max(vec_point_base< Derived, N > const &a, vec_point_base< Derived, N > const &b)
Calculates a C, where C[i] = max(A[i], B[i]) holds for 0 <= i < N.
Definition: vec_point_base.h:245
constexpr min_max< Derived > dimensional_min_max_elem(Container const &cont, UnaryFunction &&f=std::identity{})
Definition: vec_point_base.h:270
constexpr T sum(Container &&cont, UnaryCallable &&f=std::identity(), T init={})
Applies f(x) to each item of container 'cont', returns the sum of all the return values of each call ...
Definition: algorithm.h:250
constexpr auto length2_of(vec_point_base< Derived, N > const &a)
Returns squared distance of A from [0,0,0], this is a squared length of vector represented by A.
Definition: vec_point_base.h:192
constexpr Derived dimensional_min(vec_point_base< Derived, N > const &a, vec_point_base< Derived, N > const &b)
Calculates a C, where C[i] = min(A[i], B[i]) holds for 0 <= i < N.
Definition: vec_point_base.h:257
constexpr auto sqrt(physical_quantity< Len, Mass, Time, Current, Temp, Mol, Li, Angle, Byte > val)
Square root of physical quantity is square root of it's value and the exponents are divided in half.
Definition: physical_quantity.h:215
constexpr point< N > operator*(point< N > a, point< N > const &b)
Multiplication of points multiplies each coordinate of A by coordinate of B on same dimension.
Definition: point.h:74
constexpr float length_of(vec_point_base< Derived, N > const &a)
Returns distance of A from [0,0,0], this is a length of vector represented by A.
Definition: vec_point_base.h:203
constexpr Derived abs(vec_point_base< Derived, N > const &a)
Creates absolute version of A - removing signs on all dimensions.
Definition: vec_point_base.h:219
constexpr Derived normalized(vec_point_base< Derived, N > const &a)
Calculates normalized version of A, this means that length(A) equals to 1.
Definition: vec_point_base.h:211
constexpr pose lin_interp(pose const &from, pose const &goal, float factor)
linear interpolation between base se and goal pose, with factor 0 'base' is returned,...
Definition: pose.h:114
constexpr auto pow(physical_quantity< Len, Mass, Time, Current, Temp, Mol, Li, Angle, Byte > val)
Power of physical quantity is power of root of it's value and the exponents are multiplied by the val...
Definition: physical_quantity.h:247
T res
Definition: algorithm.h:505
requires(!range_container< Container >) const expr std
Returns index of an element in tuple 't', for which call to predicate f(x) holds true,...
Definition: algorithm.h:127
constexpr Derived max(vec_point_base< Derived, N > const &a, vec_point_base< Derived, N > const &b)
Definition: vec_point_base.h:229
constexpr Derived const & min(vec_point_base< Derived, N > const &a, vec_point_base< Derived, N > const &b)
Definition: vec_point_base.h:236
constexpr view< iterators::numeric_iterator< Numeric > > range(Numeric from, Numeric to)
Builds numeric view over interval [from, to)
Definition: range.h:34
constexpr Derived operator/(vec_point_base< Derived, N > const &a, T s)
Divides each coordinate of A by item 's' of type T, if T satifies std::is_arithmetic.
Definition: vec_point_base.h:170
UnaryCallable && f
Definition: algorithm.h:161
N
Definition: static_storage.h:97