Make segment & triangle aliases instead of subclasses
This commit is contained in:
parent
1590ec4ece
commit
44883e0226
2 changed files with 3 additions and 13 deletions
|
|
@ -25,7 +25,7 @@ namespace psemek::geom
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
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
|
return true
|
||||||
&& orientation(t[0], t[1], p) != sign_t::negative
|
&& orientation(t[0], t[1], p) != sign_t::negative
|
||||||
|
|
|
||||||
|
|
@ -29,20 +29,10 @@ namespace psemek::geom
|
||||||
simplex(Args ...) -> simplex<std::common_type_t<Args...>, sizeof...(Args) - 1>;
|
simplex(Args ...) -> simplex<std::common_type_t<Args...>, sizeof...(Args) - 1>;
|
||||||
|
|
||||||
template <typename Point>
|
template <typename Point>
|
||||||
struct segment
|
using segment = simplex<Point, 1>;
|
||||||
: simplex<Point, 1>
|
|
||||||
{};
|
|
||||||
|
|
||||||
template <typename Point>
|
template <typename Point>
|
||||||
segment(Point, Point) -> segment<Point>;
|
using triangle = simplex<Point, 2>;
|
||||||
|
|
||||||
template <typename Point>
|
|
||||||
struct triangle
|
|
||||||
: simplex<Point, 2>
|
|
||||||
{};
|
|
||||||
|
|
||||||
template <typename Point>
|
|
||||||
triangle(Point, Point, Point) -> triangle<Point>;
|
|
||||||
|
|
||||||
template <typename Stream, typename Point, std::size_t K>
|
template <typename Stream, typename Point, std::size_t K>
|
||||||
Stream & operator << (Stream & os, simplex<Point, K> const & s)
|
Stream & operator << (Stream & os, simplex<Point, K> const & s)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue