OpenMS
ConvexHull2D.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg$
6 // $Authors: Marc Sturm, Chris Bielow $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/CONCEPT/Types.h>
14 #include <OpenMS/OpenMSConfig.h>
15 
16 #include <vector>
17 #include <map>
18 
19 namespace OpenMS
20 {
46  class OPENMS_DLLAPI ConvexHull2D
47  {
48 public:
50  typedef std::vector<PointType> PointArrayType;
51  typedef PointArrayType::size_type SizeType;
52  typedef PointArrayType::const_iterator PointArrayTypeConstIterator;
53 
54  typedef std::map<PointType::CoordinateType, DBoundingBox<1> > HullPointType;
55 
58 
60  ConvexHull2D(const ConvexHull2D&) = default;
61 
63  ConvexHull2D(ConvexHull2D&&) = default;
64 
67 
70 
72  bool operator==(const ConvexHull2D& rhs) const;
73 
75  void clear();
76 
78  const PointArrayType& getHullPoints() const;
79 
81  void setHullPoints(const PointArrayType& points);
82 
85 
88  bool addPoint(const PointType& point);
89 
92  void addPoints(const PointArrayType& points);
93 
107 
117 
118 
128  bool encloses(const PointType& point) const;
129 
130 protected:
133 
136 
137  };
138 } // namespace OPENMS
139 
Definition: ConvexHull2D.h:47
ConvexHull2D()
default constructor
bool operator==(const ConvexHull2D &rhs) const
equality operator
bool addPoint(const PointType &point)
ConvexHull2D(ConvexHull2D &&)=default
Move constructor.
void setHullPoints(const PointArrayType &points)
accessor for the outer(!) points (no checking is performed if this is actually a convex hull)
DBoundingBox< 2 > getBoundingBox() const
returns the bounding box of the feature hull points
PointArrayType::size_type SizeType
Definition: ConvexHull2D.h:51
PointArrayType outer_points_
just the list of points of the outer hull (derived from map_points_ or given by user)
Definition: ConvexHull2D.h:135
const PointArrayType & getHullPoints() const
accessor for the outer points
DPosition< 2 > PointType
Definition: ConvexHull2D.h:49
PointArrayType::const_iterator PointArrayTypeConstIterator
Definition: ConvexHull2D.h:52
std::vector< PointType > PointArrayType
Definition: ConvexHull2D.h:50
HullPointType map_points_
internal structure maintaining the hull and enabling queries to encloses()
Definition: ConvexHull2D.h:132
ConvexHull2D & operator=(const ConvexHull2D &rhs)
assignment operator
void clear()
removes all points
Size compress()
Allows to reduce the disk/memory footprint of a hull.
void addPoints(const PointArrayType &points)
bool encloses(const PointType &point) const
returns if the point lies in the feature hull
std::map< PointType::CoordinateType, DBoundingBox< 1 > > HullPointType
Definition: ConvexHull2D.h:54
ConvexHull2D & operator=(ConvexHull2D &&) &=default
move assignment operator
ConvexHull2D(const ConvexHull2D &)=default
Copy constructor.
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19