AGX Dynamics  2.37.3.2
ConvexHull2D.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #pragma once
18 
19 #include <agxUtil/PointCurve.h>
20 
21 #include <agx/agx_vector_types.h>
22 #include <agx/Plane.h>
23 
24 namespace agxUtil
25 {
30  {
31  public:
36  struct Point
37  {
40  explicit operator const agx::Vec3&() const { return projected; }
41  };
42 
43  public:
48 
49  public:
53  ConvexHull2D();
54 
61  ConvexHull2D( const agx::Vec3Vector& points, const agx::Plane& plane );
62 
71  ConvexHull2D( const agx::Vec3Vector& points, const agx::Plane& plane, agx::UInt numSubQuadrangles );
72 
78  const Point& operator[]( agx::UInt index ) const;
79 
83  const Point& front() const;
84 
88  const Point& back() const;
89 
93  agx::UInt size() const;
94 
98  const_iterator begin() const;
99 
103  const_iterator end() const;
104 
111  const HullContainer& computeHullJarvisMarch( const agx::Vec3Vector& points, const agx::Plane& plane );
112 
123  const HullContainer& computeHullQuadrangles( const agx::Vec3Vector& points, const agx::Plane& plane, agx::UInt numSubQuadrangles );
124 
129  agx::Real calculateArea() const;
130 
136  agx::Real calculatePerimeter() const;
137 
141  const HullContainer& getHull() const;
142 
148  Curve asCurve( agx::Bool closed = true ) const;
149 
150  private:
151  HullContainer m_hull;
152  };
153 
155  {
156  return m_hull[ index ];
157  }
158 
160  {
161  return m_hull.front();
162  }
163 
165  {
166  return m_hull.back();
167  }
168 
170  {
171  return m_hull.size();
172  }
173 
175  {
176  return m_hull.begin();
177  }
178 
180  {
181  return m_hull.end();
182  }
183 }
const Point & front() const
Definition: ConvexHull2D.h:159
const Point & back() const
Definition: ConvexHull2D.h:164
bool Bool
Definition: Integer.h:48
Point in hull containing the point projected onto the plane and the original point.
Definition: ConvexHull2D.h:36
const Point * const_iterator
Definition: Vector.h:256
#define AGXPHYSICS_EXPORT
const_iterator end() const
Definition: ConvexHull2D.h:179
Class representing the mathematical concept of a plane, also called a half- space.
Definition: Plane.h:31
agx::Vec3 original
Original point.
Definition: ConvexHull2D.h:39
Utility class curve defined by a set of points.
Definition: PointCurve.h:41
Utility class to create a convex hull in a plane given point cloud.
Definition: ConvexHull2D.h:29
Segment data with begin and end point.
Definition: PointCurve.h:51
uint32_t UInt
Definition: Integer.h:34
agx::UInt size() const
Definition: ConvexHull2D.h:169
const Point & operator[](agx::UInt index) const
Access hull points of given index.
Definition: ConvexHull2D.h:154
HullContainer::const_iterator const_iterator
Definition: ConvexHull2D.h:45
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
const_iterator begin() const
Definition: ConvexHull2D.h:174
agx::Vec3 projected
Hull point projected onto the given plane.
Definition: ConvexHull2D.h:38
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
double Real
Definition: Real.h:42
The agxUtil namespace contain classes and methods for utility functionality.