Polygon3D.hpp
Go to the documentation of this file.
1 // This is -*-c++-*-
2 //
3 //
4 // Polygon3d.hpp
5 //
6 
7 #ifndef POLYGON3D_HPP
8 #define POLYGON3D_HPP
9 
10 #include "../BasicDatatypes.hpp"
11 #include <iosfwd> // for istream, ostream
12 #include <vector>
13 #include "Point3D.hpp"
14 
15 
16 namespace datatypes
17 {
18 
19 //
20 // A polygon of 3D-points.
21 //
22 // The points can be accessed through the std::vector interface.
23 class Polygon3D : public std::vector<Point3D>,
24  public BasicData
25 {
26 public:
28  typedef std::vector<Point3D> base_class;
29 
33 
35  Polygon3D();
36 
38  Polygon3D(const Point3D&);
39 
41  Polygon3D(const Point3D&, const Point3D&);
42 
44  Polygon3D(const Point3D&, const Point3D&, const Point3D&);
45 
47  Polygon3D(const base_class&);
48 
49  // Estimate the memory usage of this object
50  inline virtual const UINT32 getUsedMemory() const {return ((sizeof(*this)) + sizeof(Point3D)*size());};
51 
52  void sortForAngleXYPlane();
53 
55  bool operator==(const Polygon3D& other) const
56  {
57  return static_cast<const base_class&>(*this)
58  == static_cast<const base_class&>(other);
59  }
60 
70  Polygon3D getMovedPath(double dist) const;
71 
73  //\{
74 
75  std::istream& read (std::istream& is, UINT32 version);
76  void read (const BYTE*& buf, UINT32 version);
77  std::ostream& write (std::ostream& os, UINT32 version) const;
78  void write (BYTE*& buf, UINT32 version) const;
79  std::streamsize getSerializedSize(UINT32 version) const;
80  std::string toString() const;
81 
99  void fromString(const std::string& polyString);
100 
101  //\}
102 };
103 
104 std::ostream& operator<<(std::ostream& os, const Polygon3D& point);
105 
106 } // namespace datatypes
107 
108 #endif
std::string toString() const
Text output for debugging; opposite of fromString().
Definition: Polygon3D.cpp:74
std::streamsize getSerializedSize(UINT32 version) const
Returns the number of bytes this object needs in serialized form.
unsigned char BYTE
This class defines a point in the three-dimensional plane.
Definition: Point3D.hpp:25
virtual const UINT32 getUsedMemory() const
Definition: Polygon3D.hpp:50
double floatingpoint_type
The type of the stored x and y coordinates.
Definition: Point3D.hpp:29
uint32_t UINT32
std::istream & read(std::istream &is, UINT32 version)
Reads this object from an input stream.
Polygon3D getMovedPath(double dist) const
Definition: Polygon3D.cpp:115
bool operator==(const Polygon3D &other) const
Equality predicate.
Definition: Polygon3D.hpp:55
void sortForAngleXYPlane()
Definition: Polygon3D.cpp:91
Polygon3D()
Constructor for an empty polygon.
Definition: Polygon3D.cpp:19
Point3D::floatingpoint_type floatingpoint_type
Definition: Polygon3D.hpp:32
void fromString(const std::string &polyString)
Fill this Polygon3D by parsing the given string and extracting a list of points from the string...
std::vector< Point3D > base_class
The base type. (Naming according to boost convention.)
Definition: Polygon3D.hpp:28
std::ostream & write(std::ostream &os, UINT32 version) const
Writes this object to an output stream.
std::ostream & operator<<(std::ostream &os, const EvalCaseResult &result)


libsick_ldmrs
Author(s): SICK AG , Martin Günther , Jochen Sprickerhof
autogenerated on Mon Oct 26 2020 03:27:30