PPolygoni.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
3  * Contact: http://www.digitalbarriers.com/
4  *
5  * This file is part of the Papillon SDK.
6  *
7  * You can't use, modify or distribute any part of this file without
8  * the explicit written agreements of Digital Barriers.
9  */
10 
15 #pragma once
16 #include <PObject.h>
17 #include <PPoint2Di.h>
18 #include <vector>
19 
20 PAPILLON_BEGIN_NAMESPACE
21 
22 class PRectanglei;
23 
30 class PAPILLON_API_CORE PPolygoni : public PObject
31 {
32 public:
36  PPolygoni(const std::vector<PPoint2Di>& points = std::vector<PPoint2Di>());
37 
41  PPolygoni(const PRectanglei& r);
42 
46  PPolygoni(const PPolygoni& other);
47 
51  virtual ~PPolygoni();
52 
56  PPolygoni& operator=(const PPolygoni& other);
57 
61  void Clear();
62 
66  bool IsEmpty() const;
67 
71  papillon::int32 Size() const;
72 
77  PPoint2Di GetPoint(papillon::int32 index) const;
78 
83  PPoint2Di GetFirstPoint() const;
84 
89  PPoint2Di GetLastPoint() const;
90 
94  PRectanglei GetBoundingRectangle() const;
95 
100  PPolygoni GetConvexHull() const;
101 
106  void SetPoint(papillon::int32 index, const PPoint2Di& pt);
107 
114  PPolygoni& AddPoint(papillon::int32 x, papillon::int32 y, papillon::int32 index = -1);
115 
122  PPolygoni& AddPoint(const PPoint2Di& pt, papillon::int32 index = -1);
123 
127  PPolygoni Intersected(const PPolygoni& other) const;
128 
132  PPolygoni United(const PPolygoni& other) const;
133 };
134 
135 PAPILLON_END_NAMESPACE
Class PPoint2Di: an immutable 2D-point with 32-bit int coordinates.
The PObject class is the root class of all Papillon classes; all PObject behaves like shared referenc...
Definition: PObject.h:27
The PRectanglei class represents an axis-aligned rectangle with 32-bit int coordinates; PRectanglei i...
Definition: PRectanglei.h:33
The PPolygoni class represents a 2D closed polygon with 32-bit int coordinates.
Definition: PPolygoni.h:30
Class PObject: the root class of all Papillon classes.
PObject & operator=(const PObject &obj)
Performs a shared copy of other to this object.
Definition: PObject.h:45
The PPoint2Di class represents a 2D-point with 32-bit int coordinates; PPoint2Di instances are immuta...
Definition: PPoint2Di.h:27