@@ -57,13 +57,51 @@ class Point
5757 friend dbIStream& operator >>(dbIStream& stream, Point& p);
5858 friend dbOStream& operator <<(dbOStream& stream, const Point& p);
5959
60- private :
60+ protected :
6161 int x_ = 0 ;
6262 int y_ = 0 ;
6363};
6464
6565std::ostream& operator <<(std::ostream& os, const Point& pIn);
6666
67+ class Point3D
68+ {
69+ public:
70+ Point3D () = default ;
71+ Point3D (int x, int y, int z) : x_(x), y_(y), z_(z) {}
72+ Point3D& operator =(const Point3D&) = default ;
73+ Point3D (const Point3D& p) : x_(p.x()), y_(p.y()), z_(p.z()) {}
74+ Point3D (const Point& p, int z) : x_(p.x()), y_(p.y()), z_(z) {}
75+
76+ bool operator ==(const Point3D& rhs) const ;
77+ bool operator !=(const Point3D& rhs) const { return !(*this == rhs); }
78+ bool operator <(const Point3D& rhs) const ;
79+ bool operator >=(const Point3D& rhs) const { return !(*this < rhs); }
80+
81+ int z () const { return z_; }
82+ void setZ (int z) { z_ = z; }
83+ int x () const { return x_; }
84+ void setX (int x) { x_ = x; }
85+ int y () const { return y_; }
86+ void setY (int y) { y_ = y; }
87+ void set (const int x, const int y, const int z)
88+ {
89+ setX (x);
90+ setY (y);
91+ setZ (z);
92+ }
93+
94+ friend dbIStream& operator >>(dbIStream& stream, Point3D& p);
95+ friend dbOStream& operator <<(dbOStream& stream, const Point3D& p);
96+
97+ private:
98+ int x_ = 0 ;
99+ int y_ = 0 ;
100+ int z_ = 0 ;
101+ };
102+
103+ std::ostream& operator <<(std::ostream& os, const Point3D& pIn);
104+
67105/*
68106an Oct represents a 45-degree routing segment as 2 connected octagons
69107
@@ -443,6 +481,16 @@ inline bool Point::operator<(const Point& rhs) const
443481 return std::tie (x_, y_) < std::tie (rhs.x_ , rhs.y_ );
444482}
445483
484+ inline bool Point3D::operator ==(const Point3D& rhs) const
485+ {
486+ return std::tie (x_, y_, z_) == std::tie (rhs.x_ , rhs.y_ , rhs.z_ );
487+ }
488+
489+ inline bool Point3D::operator <(const Point3D& rhs) const
490+ {
491+ return std::tie (x_, y_, z_) < std::tie (rhs.x_ , rhs.y_ , rhs.z_ );
492+ }
493+
446494inline bool Rect::operator <(const Rect& rhs) const
447495{
448496 return std::tie (xlo_, ylo_, xhi_, yhi_)
0 commit comments