AGX Dynamics  2.38.0.2
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 
84  DimensionType getDimensionType() const;
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 
137  {
138  return m_maxDeterminant;
139  }
140 
141 
143  {
144  agxAssert ( m_dimensionType != RegressionPlane::EMPTY );
145  return m_averagePoint;
146  }
147 
148 
150  {
151  agxAssert ( m_dimensionType > RegressionPlane::POINT );
152  return m_lineDirection;
153  }
154 
155 
157  {
158  agxAssert ( m_dimensionType == RegressionPlane::PLANE );
159  return m_plane;
160  }
161 
162 
164  {
165  return m_dimensionType == PLANE;
166  }
167 }
168 
169 
170 #endif
agxPhysics_export.h
agxCollide::RegressionPlane::EMPTY
@ EMPTY
Definition: RegressionPlane.h:45
Referenced.h
agx::Real
double Real
Definition: Real.h:42
agxCollide::RegressionPlane::DimensionType
DimensionType
Dimension type of the sub-space resulted by the regression.
Definition: RegressionPlane.h:44
agxCollide::RegressionPlane::getDimensionType
DimensionType getDimensionType() const
Gets the dimension type of the plane.
Definition: RegressionPlane.h:131
agxAssert
#define agxAssert(expr)
Definition: debug.h:143
agx::VectorPOD< Vec3 >
Plane.h
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition: AddedMassInteraction.h:22
agxCollide::RegressionPlane::LINE
@ LINE
Definition: RegressionPlane.h:47
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agxCollide::RegressionPlane::POINT
@ POINT
Definition: RegressionPlane.h:46
agx::PlaneT
Class representing the mathematical concept of a plane, also called a half- space.
Definition: Plane.h:31
agx::SPDMatrix3x3
Specialized type of matrices for holding symmetric positive definite matrices.
Definition: SPDMatrix3x3.h:48
agxCollide::RegressionPlane
A plane created from points using least squares minimization.
Definition: RegressionPlane.h:39
agxCollide
This namespace consists of a set of classes for handling geometric intersection tests including boole...
Definition: ContactForceFilterParticipant.h:22
agxCollide::RegressionPlane::getAveragePoint
agx::Vec3 getAveragePoint() const
Gets the average point of the plane.
Definition: RegressionPlane.h:142
agxCollide::RegressionPlane::PLANE
@ PLANE
Definition: RegressionPlane.h:48
agxCollide::RegressionPlane::isPlane
bool isPlane() const
Is the regression plane a plane (and not empty, point or line)?
Definition: RegressionPlane.h:163
agxPowerLine::getDimensionType
AGXMODEL_EXPORT agxPowerLine::PhysicalDimension::Type getDimensionType(const std::string &dimensionName)
agxCollide::RegressionPlane::getPlane
agx::Plane getPlane() const
Gets the average point of the plane.
Definition: RegressionPlane.h:156
agx::Vec3T< Real >
agxCollide::RegressionPlane::getLineDirection
agx::Vec3 getLineDirection() const
Gets the average point of the plane.
Definition: RegressionPlane.h:149
agxCollide::RegressionPlane::getMaxDeterminant
agx::Real getMaxDeterminant() const
Returns the maximum determinant from the least squares minimization.
Definition: RegressionPlane.h:136
LocalVector.h
agx_vector_types.h
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58
agxData::LocalVector
Local scope vector.
Definition: LocalVector.h:43