Make segment & triangle aliases instead of subclasses

This commit is contained in:
Nikita Lisitsa 2020-08-30 21:19:16 +03:00
parent 1590ec4ece
commit 44883e0226
2 changed files with 3 additions and 13 deletions

View file

@ -25,7 +25,7 @@ namespace psemek::geom
}
template <typename T>
bool contains(triangle<point<T, 2>> const & t, point<T, 2> const & p)
bool contains(simplex<point<T, 2>, 2> const & t, point<T, 2> const & p)
{
return true
&& orientation(t[0], t[1], p) != sign_t::negative

View file

@ -29,20 +29,10 @@ namespace psemek::geom
simplex(Args ...) -> simplex<std::common_type_t<Args...>, sizeof...(Args) - 1>;
template <typename Point>
struct segment
: simplex<Point, 1>
{};
using segment = simplex<Point, 1>;
template <typename Point>
segment(Point, Point) -> segment<Point>;
template <typename Point>
struct triangle
: simplex<Point, 2>
{};
template <typename Point>
triangle(Point, Point, Point) -> triangle<Point>;
using triangle = simplex<Point, 2>;
template <typename Stream, typename Point, std::size_t K>
Stream & operator << (Stream & os, simplex<Point, K> const & s)