header_utils
Loading...
Searching...
No Matches
points.h
1
4
5#pragma once
6
7#include "geometry_common.h"
8
10{
11 template <std::ranges::range RANGE, typename T = std::ranges::range_value_t<RANGE>>
12 constexpr bool are_colinear(RANGE const& range, T tolerance = precision_limits<T>::point_on_line_max_distance)
13 {
14 if (std::ranges::size(range) < 3)
15 return true;
16
17 auto it = std::ranges::begin(range);
18
19 const auto line = line_crossing_points(*it++, *it++);
20 const auto end = std::ranges::end(range);
21 while (it != end)
22 {
23 if (line.distance(*it++) > tolerance)
24 return false;
25 }
26
27 return true;
28 }
29}
constexpr auto bit_count
Equal to the number of bits in the type.
Definition bits.h:33