23#ifndef VCL_ALGORITHMS_CORE_POLYGON_CORE2_H
24#define VCL_ALGORITHMS_CORE_POLYGON_CORE2_H
26#include <vclib/space/core/polygon.h>
52template<Po
int2Concept Po
intType>
59 (p1.x() - p0.x()) * (
p2.y() - p0.y()) -
60 (
p2.x() - p0.x()) * (p1.y() - p0.y()));
74template<Po
int2Concept Po
intType>
95template<Po
int2IteratorConcept Iterator>
98 using PointType = std::decay_t<
decltype(*begin)>;
99 using ScalarType = PointType::ScalarType;
107 for (++
it;
it != end; ++
it) {
112 sum += (
latest->x() - begin->x()) * (
latest->y() + begin->y());
134template<Po
int2IteratorConcept Iterator>
137 using PointType = std::decay_t<
decltype(*begin)>;
140 PointType
minPoint = *std::min_element(
141 begin, end, [](
const PointType&
a,
const PointType&
b) {
142 return a.y() <
b.y();
146 std::sort(begin, end, [
minPoint](
const PointType&
a,
const PointType&
b) {
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
auto collinearityTest(const PointType &p0, const PointType &p1, const PointType &p2)
Computes the collinearity test between three points. The test returns a positive value if the points ...
Definition core2.h:53
bool areCounterClockwise(const PointType &p0, const PointType &p1, const PointType &p2)
Checks if the three points are counter-clockwise.
Definition core2.h:75
void sortConvexPolygonVertices(Iterator begin, Iterator end)
Sorts the vertices of a convex polygon in counter-clockwise order.
Definition core2.h:135
bool isCounterClockWise(Iterator begin, Iterator end)
Checks if a set of points that form a polygon are in counter-clockwise order.
Definition core2.h:96