PCB Environment 2

Loading...
Searching...
No Matches
LayoutArea.hpp
1#ifndef GYM_PCB_LAYOUTAREA_H
2#define GYM_PCB_LAYOUTAREA_H
3
4#include "Geometry.hpp"
5
6 class Object;
7
8 class LayoutArea
9{
10 public:
11 LayoutArea();
12
13 const Vector_2& size() const { return mSize; }
14 Real area() const { return mRect.area(); }
15 const Bbox_2& bbox() const { return mBox; }
16 Point_2 origin() const { return mRect.min(); }
17
18 Real aspectRatio() const { return mSize.x() / mSize.y(); }
19
20 Real diagonalLength() const { return mDiagLen; }
21
22 bool isInside(const Point_25&) const;
23 bool isBboxInside(const Object&) const;
24
25 void setOrigin(const Point_2 &v0) { setRect(v0, v0 + mSize); }
26 void setSize(const Vector_2 &size) { setRect(mRect.min(), mRect.min() + size); }
27 void setMaxLayer(uint z) { mMaxLayer = z; }
28 void setBox(const Bbox_2&);
29 void setRect(const Point_2 &min, const Point_2 &max);
30 void setPolygonBbox(const Polygon_2&);
31
32 void expand(const Bbox_2 &box) { setBox(bbox() + box); }
33 private:
34 Iso_rectangle_2 mRect;
35 Bbox_2 mBox;
36 Vector_2 mSize{0.0, 0.0};
37 Real mDiagLen{0.0};
38 uint mMaxLayer{0};
39};
40
41#endif // GYM_PCB_LAYOUTAREA_H
Object
Definition Object.hpp:12
Point_25
Definition Geometry.hpp:131