Flutter Engine
The Flutter Engine
Public Member Functions | Friends | List of all members
myers::Segment Class Reference

#include <Myers.h>

Public Member Functions

constexpr Segment (Point p0, Point p1)
 
const Pointupper () const
 
const Pointlower () const
 
std::tuple< int32_t, int32_t, int32_t, int32_t > bounds () const
 
bool isHorizontal () const
 
bool isVertical () const
 

Friends

constexpr bool operator< (const Segment &s0, const Segment &s1)
 
constexpr bool operator== (const Segment &s0, const Segment &s1)
 
constexpr bool operator!= (const Segment &s0, const Segment &s1)
 

Detailed Description

Definition at line 40 of file Myers.h.

Constructor & Destructor Documentation

◆ Segment()

constexpr myers::Segment::Segment ( Point  p0,
Point  p1 
)
inlineconstexpr

Definition at line 42 of file Myers.h.

43 : Segment{std::minmax(p0, p1)} {}
constexpr Segment(Point p0, Point p1)
Definition: Myers.h:42

Member Function Documentation

◆ bounds()

std::tuple< int32_t, int32_t, int32_t, int32_t > myers::Segment::bounds ( ) const

Definition at line 39 of file Myers.cpp.

39 {
40 auto [left, right] = std::minmax(fUpper.x, fLower.x);
41 return std::make_tuple(left, fUpper.y, right, fLower.y);
42}
int32_t x
Definition: Myers.h:20
int32_t y
Definition: Myers.h:21

◆ isHorizontal()

bool myers::Segment::isHorizontal ( ) const

Definition at line 44 of file Myers.cpp.

44 {
45 return fUpper.y == fLower.y;
46}

◆ isVertical()

bool myers::Segment::isVertical ( ) const

Definition at line 48 of file Myers.cpp.

48 {
49 return fUpper.x == fLower.x;
50}

◆ lower()

const Point & myers::Segment::lower ( ) const

Definition at line 35 of file Myers.cpp.

35 {
36 return fLower;
37}

◆ upper()

const Point & myers::Segment::upper ( ) const

Definition at line 31 of file Myers.cpp.

31 {
32 return fUpper;
33}

Friends And Related Function Documentation

◆ operator!=

constexpr bool operator!= ( const Segment s0,
const Segment s1 
)
friend

Definition at line 74 of file Myers.h.

74 {
75 return std::tie(s0.fUpper, s0.fLower) != std::tie(s1.fUpper, s1.fLower);
76}

◆ operator<

constexpr bool operator< ( const Segment s0,
const Segment s1 
)
friend

Definition at line 66 of file Myers.h.

66 {
67 return std::tie(s0.fUpper, s0.fLower) < std::tie(s1.fUpper, s1.fLower);
68}

◆ operator==

constexpr bool operator== ( const Segment s0,
const Segment s1 
)
friend

Definition at line 70 of file Myers.h.

70 {
71 return std::tie(s0.fUpper, s0.fLower) == std::tie(s1.fUpper, s1.fLower);
72}

The documentation for this class was generated from the following files: