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
datatypes::Polygon3D::base_class
std::vector< Point3D > base_class
The base type. (Naming according to boost convention.)
Definition: Polygon3D.hpp:28
datatypes::Polygon3D::sortForAngleXYPlane
void sortForAngleXYPlane()
Definition: Polygon3D.cpp:91
datatypes::Polygon3D::Polygon3D
Polygon3D()
Constructor for an empty polygon.
Definition: Polygon3D.cpp:19
datatypes::Polygon3D
Definition: Polygon3D.hpp:23
datatypes::BasicData
Definition: BasicDatatypes.hpp:95
datatypes::Polygon3D::fromString
void fromString(const std::string &polyString)
Fill this Polygon3D by parsing the given string and extracting a list of points from the string.
datatypes::Polygon3D::toString
std::string toString() const
Text output for debugging; opposite of fromString().
Definition: Polygon3D.cpp:74
Point3D.hpp
datatypes::Polygon3D::write
std::ostream & write(std::ostream &os, UINT32 version) const
Writes this object to an output stream.
datatypes::Polygon3D::operator==
bool operator==(const Polygon3D &other) const
Equality predicate.
Definition: Polygon3D.hpp:55
datatypes::Point3D
This class defines a point in the three-dimensional plane.
Definition: Point3D.hpp:25
datatypes::operator<<
std::ostream & operator<<(std::ostream &os, const EvalCaseResult &result)
Definition: EvalCaseResult.cpp:72
datatypes::Polygon3D::read
std::istream & read(std::istream &is, UINT32 version)
Reads this object from an input stream.
datatypes::Polygon3D::getSerializedSize
std::streamsize getSerializedSize(UINT32 version) const
Returns the number of bytes this object needs in serialized form.
datatypes::Point3D::floatingpoint_type
double floatingpoint_type
The type of the stored x and y coordinates.
Definition: Point3D.hpp:29
datatypes::Polygon3D::getMovedPath
Polygon3D getMovedPath(double dist) const
Definition: Polygon3D.cpp:115
BYTE
unsigned char BYTE
Definition: BasicDatatypes.hpp:31
UINT32
uint32_t UINT32
Definition: BasicDatatypes.hpp:26
datatypes::Polygon3D::getUsedMemory
virtual const UINT32 getUsedMemory() const
Definition: Polygon3D.hpp:50
datatypes::Polygon3D::floatingpoint_type
Point3D::floatingpoint_type floatingpoint_type
Definition: Polygon3D.hpp:32
datatypes
Definition: BasicDatatypes.hpp:91


libsick_ldmrs
Author(s): SICK AG , Martin Günther , Jochen Sprickerhof
autogenerated on Wed Oct 26 2022 02:11:57