AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
RegressionPlane.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#ifndef AGX_REGRESSIONPLANE_H
18#define AGX_REGRESSIONPLANE_H
19
21#include <agx/Referenced.h>
22
24#include <agx/Plane.h>
25
26#include <agxData/LocalVector.h>
27
28namespace agx {
29 class SPDMatrix3x3;
30}
31
32namespace agxCollide {
33
40 {
41
42 public:
50
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:
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
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
#define AGXPHYSICS_EXPORT
A plane created from points using least squares minimization.
agx::Real getMaxDeterminant() const
Returns the maximum determinant from the least squares minimization.
bool isPlane() const
Is the regression plane a plane (and not empty, point or line)?
agx::Vec3 getLineDirection() const
Gets the average point of the plane.
RegressionPlane(const agx::Vec3 &linearCoefficients, const agx::SPDMatrix3x3 &quadraticCoefficients, const agx::Vec3 &averagePoint, const size_t numPoints)
Creates a RegressionPlane from the coefficients precomputed from a number of 3D points.
DimensionType
Dimension type of the sub-space resulted by the regression.
agx::Plane getPlane() const
Gets the average point of the plane.
RegressionPlane(const agx::Vec3Vector &points)
DimensionType getDimensionType() const
Gets the dimension type of the plane.
agx::Vec3 getAveragePoint() const
Gets the average point of the plane.
RegressionPlane(const agxData::LocalVector< agx::Vec3 > &points)
Creates a RegressionPlane from a number of 3D-points.
Only use as member allocated variable.
Definition Value.h:285
Class representing the mathematical concept of a plane, also called a half- space.
Definition agx/Plane.h:32
Specialized type of matrices for holding symmetric positive definite matrices.
#define agxAssert(expr)
Definition debug.h:143
#define AGX_FORCE_INLINE
Definition macros.h:58
This namespace consists of a set of classes for handling geometric intersection tests including boole...
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
double Real
Definition Real.h:42