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

Public declaration of pgl::Segment. More...

#include "implementation/orientation.hpp"
#include <array>
#include <cassert>
#include <cmath>
#include <concepts>
#include <cstddef>
#include <functional>
#include <ostream>
#include <type_traits>
#include <utility>
#include <variant>
#include <vector>
#include <optional>

Go to the source code of this file.

Classes

struct  pgl::Segment< TPoint, TLabel >
 Unoriented closed segment between two endpoints plus optional segment label. More...

Namespaces

namespace  pgl

Functions

 pgl::Segment () -> Segment< Point<>, NoLabel >
template<class PointType>
 pgl::Segment (PointType, PointType) -> Segment< PointType, NoLabel >
template<class PointType, class A>
 pgl::Segment (PointType, PointType, A) -> Segment< PointType, std::decay_t< A > >
template<class Number>
 pgl::Segment (Number, Number, Number, Number) -> Segment< Point< Number >, NoLabel >
template<class PointType, class LabelType, class TranslationNumber, class TranslationLabel>
constexpr auto pgl::operator- (const Segment< PointType, LabelType > &segment, const Point< TranslationNumber, TranslationLabel > &translation)
 Translates a segment by the opposite of a point.
template<class PointType, class LabelType, class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr auto pgl::operator* (const Segment< PointType, LabelType > &segment, const Scalar &scalar)
 Scales a segment by a scalar.
template<class Scalar, class PointType, class LabelType>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr auto pgl::operator* (const Scalar &scalar, const Segment< PointType, LabelType > &segment)
 Scales a segment by a scalar written on the left.
template<class PointType, class LabelType, class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr auto pgl::operator/ (const Segment< PointType, LabelType > &segment, const Scalar &scalar)
 Divides both endpoints by a scalar.
template<class PointType, class LabelType>
std::ostream & pgl::operator<< (std::ostream &stream, const Segment< PointType, LabelType > &segment)
 Streams a segment as p--q, or label:{p--q} when it carries a label.

Detailed Description

Public declaration of pgl::Segment.

Segment is the basic finite 1D primitive. It stores two endpoints in sorted order and exposes the public contract for segment operations.