PPolygonf.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 <PPoint2Df.h>
18 #include <vector>
19 
20 PAPILLON_BEGIN_NAMESPACE
21 
22 class PRectanglef;
23 
29 class PAPILLON_API_CORE PPolygonf : public PObject
30 {
31 public:
35  PPolygonf(const std::vector<PPoint2Df>& points = std::vector<PPoint2Df>());
36 
40  PPolygonf(const PRectanglef& r);
41 
45  PPolygonf(const PPolygonf& other);
46 
50  virtual ~PPolygonf();
51 
55  PPolygonf& operator=(const PPolygonf& other);
56 
60  void Clear();
61 
65  bool IsEmpty() const;
66 
70  papillon::int32 Size() const;
71 
76  PPoint2Df GetPoint(papillon::int32 index) const;
77 
82  PPoint2Df GetFirstPoint() const;
83 
88  PPoint2Df GetLastPoint() const;
89 
93  PRectanglef GetBoundingRectangle() const;
94 
99  PPolygonf GetConvexHull() const;
100 
105  void SetPoint(papillon::int32 index, const PPoint2Df& pt);
106 
113  PPolygonf& AddPoint(float x, float y, papillon::int32 index = -1);
114 
121  PPolygonf& AddPoint(const PPoint2Df& p, papillon::int32 index = -1);
122 
126  PPolygonf Intersected(const PPolygonf& other) const;
127 
131  PPolygonf United(const PPolygonf& other) const;
132 
136  PPolygonf Translated(const PPoint2Df& v) const;
137 };
138 
139 PAPILLON_END_NAMESPACE
Class PPoint2Df: an immutable 2D-point with float coordinates.
The PPoint2Df class represents a 2D-point with float coordinates; PPoint2Df instances are immutable (...
Definition: PPoint2Df.h:28
The PPolygonf class represents a 2D closed polygon with float coordinates.
Definition: PPolygonf.h:29
The PObject class is the root class of all Papillon classes; all PObject behaves like shared referenc...
Definition: PObject.h:27
The PRectanglef class represents an axis-aligned rectangle with float coordinates; PRectanglef instan...
Definition: PRectanglef.h:34
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