AGX Dynamics  2.37.2.0
RegressionPlane.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 #ifndef AGX_REGRESSIONPLANE_H
18 #define AGX_REGRESSIONPLANE_H
19 
20 #include <agx/agx_vector_types.h>
21 #include <agx/Referenced.h>
22 
23 #include <agx/agxPhysics_export.h>
24 #include <agx/Plane.h>
25 
26 #include <agxData/LocalVector.h>
27 
28 namespace agx {
29  class SPDMatrix3x3;
30 }
31 
32 namespace agxCollide {
33 
40  {
41 
42  public:
48  PLANE
49  };
50 
65  RegressionPlane(const agx::Vec3Vector& points);
66 
78  RegressionPlane ( const agx::Vec3& linearCoefficients,
79  const agx::SPDMatrix3x3& quadraticCoefficients,
80  const agx::Vec3& averagePoint,
81  const size_t numPoints);
82 
85 
90  agx::Vec3 getAveragePoint() const;
91 
96  agx::Vec3 getLineDirection() const;
97 
102  agx::Plane getPlane() const;
103 
105  bool isPlane() const;
106 
108  agx::Real getMaxDeterminant() const;
109 
110  private:
111  RegressionPlane();
112 
113 
114  void computeRegressionPlane (
115  agx::Vec3 linearCoefficients,
116  agx::SPDMatrix3x3 quadraticCoefficients,
117  size_t numPoints);
118 
119  private:
120  agx::Plane m_plane;
121  agx::Vec3 m_averagePoint;
122  agx::Vec3 m_lineDirection;
123  DimensionType m_dimensionType;
124 
125  agx::Real m_maxDeterminant;
126  };
127 
128 
129 
130  // implementations
132  {
133  return m_dimensionType;
134  }
135 
136  AGX_FORCE_INLINE agx::Real RegressionPlane::getMaxDeterminant() const
137  {
138  return m_maxDeterminant;
139  }
140 
141 
142  AGX_FORCE_INLINE agx::Vec3 RegressionPlane::getAveragePoint() const
143  {
144  agxAssert ( m_dimensionType != RegressionPlane::EMPTY );
145  return m_averagePoint;
146  }
147 
148 
149  AGX_FORCE_INLINE agx::Vec3 RegressionPlane::getLineDirection() const
150  {
151  agxAssert ( m_dimensionType > RegressionPlane::POINT );
152  return m_lineDirection;
153  }
154 
155 
156  AGX_FORCE_INLINE agx::Plane RegressionPlane::getPlane() const
157  {
158  agxAssert ( m_dimensionType == RegressionPlane::PLANE );
159  return m_plane;
160  }
161 
162 
163  AGX_FORCE_INLINE bool RegressionPlane::isPlane() const
164  {
165  return m_dimensionType == PLANE;
166  }
167 }
168 
169 
170 #endif
DimensionType
Dimension type of the sub-space resulted by the regression.
This namespace consists of a set of classes for handling geometric intersection tests including boole...
A plane created from points using least squares minimization.
#define AGXPHYSICS_EXPORT
#define AGX_FORCE_INLINE
Definition: Object.h:59
Class representing the mathematical concept of a plane, also called a half- space.
Definition: Plane.h:31
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Specialized type of matrices for holding symmetric positive definite matrices.
Definition: SPDMatrix3x3.h:48
#define agxAssert(expr)
Definition: debug.h:143
AGXMODEL_EXPORT agxPowerLine::PhysicalDimension::Type getDimensionType(const std::string &dimensionName)
Local scope vector.
Definition: LocalVector.h:43
double Real
Definition: Real.h:42