coords/ops: add ceil for coords
This commit is contained in:
parent
7ff3991069
commit
457effabf5
@ -1400,10 +1400,26 @@ namespace cruft {
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
template <
|
||||
typename K,
|
||||
typename = std::enable_if_t<
|
||||
is_coord_v<K> && std::is_floating_point_v<typename K::value_type>
|
||||
>
|
||||
> constexpr auto
|
||||
ceil (K const &k)
|
||||
{
|
||||
K res {};
|
||||
for (std::size_t i = 0; i < K::elements; ++i)
|
||||
res[i] = std::ceil (k[i]);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
///------------------------------------------------------------------------
|
||||
/// Return the fractional part of a real value.
|
||||
///
|
||||
/// This is an extraodinarily naive implementation. We avoid doing
|
||||
/// This is an extraordinarily naive implementation. We avoid doing
|
||||
/// explicit casts here in the hope that floor and sub is more efficient
|
||||
/// (ie, keeps floats as floats in registers).
|
||||
template <
|
||||
|
Loading…
x
Reference in New Issue
Block a user