Pangolin
Header-only C++20 plane computational geometry library
Loading...
Searching...
No Matches
point.hpp File Reference

Public declaration of pgl::Point and point-label helpers. More...

#include "core/transformation.hpp"
#include <cassert>
#include <cmath>
#include <concepts>
#include <cstddef>
#include <functional>
#include <optional>
#include <ostream>
#include <type_traits>
#include <utility>
#include <array>
#include <vector>

Go to the source code of this file.

Classes

struct  pgl::NoLabel
 Sentinel type used when a point carries no extra label. More...
struct  pgl::Point< TNumber, TLabel >
 Two-dimensional point with optional label payload. More...

Namespaces

namespace  pgl

Functions

 pgl::Point () -> Point< int >
template<class Number>
 pgl::Point (Number, Number) -> Point< Number >
template<class Number, class Label>
 pgl::Point (Number, Number, Label) -> Point< Number, std::decay_t< Label > >
template<class LeftNumber, class LeftLabel, class RightNumber, class RightLabel>
constexpr auto pgl::operator- (const Point< LeftNumber, LeftLabel > &left, const Point< RightNumber, RightLabel > &right)
 Translates a point by the opposite of another point.
template<class Number, class Label, class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr auto pgl::operator* (const Point< Number, Label > &point, const Scalar &scalar)
 Scales a point by a scalar.
template<class Scalar, class Number, class Label>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr auto pgl::operator* (const Scalar &scalar, const Point< Number, Label > &point)
 Scales a point by a scalar written on the left.
template<class LeftNumber, class LeftLabel, class RightNumber, class RightLabel>
constexpr auto pgl::operator* (const Point< LeftNumber, LeftLabel > &left, const Point< RightNumber, RightLabel > &right)
 Returns the dot product of two points.
template<class Number, class Label, class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr auto pgl::operator/ (const Point< Number, Label > &point, const Scalar &scalar)
 Divides both coordinates by a scalar.
template<class Number, class Label>
std::ostream & pgl::operator<< (std::ostream &stream, const Point< Number, Label > &point)
 Streams a point as (x,y) or label:(x,y).

Detailed Description

Public declaration of pgl::Point and point-label helpers.

Point is the zero-dimensional primitive at the center of the library. Other shapes, predicates, and algorithms are all expressed in terms of points.