36 m_y = std::pair<int, int> (bottomY, upperY);
64 inline T getYUp()
const
69 inline T getYDown()
const
74 inline std::pair<T,T> getY()
const
81 inline void setX(
const T& new_x )
86 inline void setYUp(
const T& new_y_up )
88 m_y.second = new_y_up;
91 inline void setYDown(
const T& new_y_down )
93 m_y.first = new_y_down;
96 inline void setY(
const std::pair<T,T>& new_m_y )
101 bool operator< (const gsVSegment<T>& other)
const
103 if(
m_x == other.getX())
105 return m_y.first < other.getYDown();
109 return m_x < other.getX();
113 bool operator== (
const gsVSegment<T>& other )
const
115 if( (
m_x == other.getX() ) && (
m_y.first == other.getYDown() ) && (
m_y.second == other.getYUp() ) )
136 return ( ( other.getYDown() == m_y.first) && (( other.getYUp() == m_y.second)) );
142 return ( ( other.getYUp() == m_y.first) || (( other.getYDown() == m_y.second)) );
148 return (m_y.second - m_y.first);
160 v[2] = other.m_y.first;
161 v[3] = other.m_y.second;
164 std::sort(v.begin(), v.end());
168 other.m_y.first = v[2];
169 other.m_y.second = v[3];
172 if( ((tempa==*
this)&&(tempb==other)) || ((tempa==other)&&(tempb==*
this)))
180 std::ostream &operator<<(std::ostream &os, const gsVSegment<T> a)
182 os<<
"x:"<<a.getX() <<
" , y: ["<< a.getYDown() <<
" ,"<< a.getYUp() <<
"] ";
Class for representing a vertical line segment in 2D. Helper for the class gsAAPolyline.
Definition: gsHDomain.h:33
T m_x
The x-coordinate.
Definition: gsVSegment.h:124
bool isConnected(const gsVSegment &other) const
Definition: gsVSegment.h:140
bool left
Whether the segment is on the left hand-side of the enclosed domain.
Definition: gsVSegment.h:130
gsVSegment(int x, int bottomY, int upperY, bool l)
Default empty constructor.
Definition: gsVSegment.h:33
bool isClosing(const gsVSegment &other) const
Default destructor.
Definition: gsVSegment.h:134
std::pair< T, T > m_y
Lower and upper y–coordinates.
Definition: gsVSegment.h:127
bool cannotDeleteOverlap(gsVSegment< T > &other)
otherwise gets rid of their overlap and returns false.
Definition: gsVSegment.h:152