RobWorkProject
24.12.4-
|
A quadratic surface. More...
#include <QuadraticSurface.hpp>
Inherits ImplicitSurface.
Public Types | |
typedef rw::core::Ptr< QuadraticSurface > | Ptr |
Smart pointer type for QuadraticSurface. | |
typedef rw::core::Ptr< const QuadraticSurface > | CPtr |
Smart pointer type for const QuadraticSurface. | |
typedef rw::geometry::ImplicitSurface::CPtr | TrimmingRegion |
A trimming region is defined using an ImplicitSurface. More... | |
Public Types inherited from ImplicitSurface | |
typedef rw::core::Ptr< ImplicitSurface > | Ptr |
Smart pointer type for ImplicitSurface. | |
typedef rw::core::Ptr< const ImplicitSurface > | CPtr |
Smart pointer type for const ImplicitSurface. | |
Public Types inherited from Surface | |
typedef rw::core::Ptr< Surface > | Ptr |
Smart pointer type for Surface. | |
typedef rw::core::Ptr< const Surface > | CPtr |
Smart pointer type for const Surface. | |
Public Member Functions | |
QuadraticSurface (const Eigen::Diagonal< Eigen::Matrix3d > &A, const Eigen::Vector3d &a, double u, const std::vector< TrimmingRegion > &conditions=std::vector< TrimmingRegion >()) | |
Construct new quadratic surface of the implicit form \( x^T A x + 2 a^T x + u = 0\) when A is diagonal. More... | |
QuadraticSurface (const Eigen::DiagonalMatrix< double, 3, 3 > &A, const Eigen::Vector3d &a, double u, const std::vector< TrimmingRegion > &conditions=std::vector< TrimmingRegion >()) | |
QuadraticSurface (const Eigen::SelfAdjointView< const Eigen::Matrix3d, Eigen::Upper > &A, const Eigen::Vector3d &a, double u, const std::vector< TrimmingRegion > &conditions=std::vector< TrimmingRegion >()) | |
Construct new quadratic surface of the implicit form \( x^T A x + 2 a^T x + u = 0\) when A is non-diagonal. More... | |
QuadraticSurface (const Eigen::SelfAdjointView< Eigen::Matrix3d, Eigen::Upper > &A, const Eigen::Vector3d &a, double u, const std::vector< TrimmingRegion > &conditions=std::vector< TrimmingRegion >()) | |
QuadraticSurface (const Eigen::SelfAdjointView< const Eigen::Matrix3d, Eigen::Lower > &A, const Eigen::Vector3d &a, double u, const std::vector< TrimmingRegion > &conditions=std::vector< TrimmingRegion >()) | |
Construct new quadratic surface of the implicit form \( x^T A x + 2 a^T x + u = 0\) when A is non-diagonal. More... | |
QuadraticSurface (const Eigen::SelfAdjointView< Eigen::Matrix3d, Eigen::Lower > &A, const Eigen::Vector3d &a, double u, const std::vector< TrimmingRegion > &conditions=std::vector< TrimmingRegion >()) | |
virtual | ~QuadraticSurface () |
Destructor. | |
QuadraticSurface::Ptr | transform (const rw::math::Transform3D< double > &T) const |
Move the surface. More... | |
QuadraticSurface::Ptr | transform (const rw::math::Vector3D< double > &P) const |
Move the surface without rotation. More... | |
QuadraticSurface::Ptr | scale (double factor) const |
Get a scaled version of the surface. More... | |
QuadraticSurface::Ptr | clone () const |
Clone the surface. More... | |
virtual std::pair< double, double > | extremums (const rw::math::Vector3D< double > &direction) const |
Find the extent of the surface along a specific direction. More... | |
virtual rw::core::Ptr< TriMesh > | getTriMesh (const std::vector< rw::math::Vector3D< double >> &border=std::vector< rw::math::Vector3D< double >>()) const |
Discretize the surface into a triangle mesh representation. More... | |
virtual void | setDiscretizationResolution (double resolution) |
Set the resolution used for discretization in the getTriMesh function. More... | |
virtual bool | equals (const Surface &surface, double threshold) const |
Check if this surface is identical to other surface . More... | |
virtual double | operator() (const rw::math::Vector3D< double > &x) const |
Evaluate the implicit function, \( F(\mathbf{x}) \), for the surface. More... | |
virtual bool | insideTrimmingRegion (const rw::math::Vector3D< double > &P) const |
Check if point, P, on surface lies inside the trimming region. More... | |
virtual rw::math::Vector3D< double > | normal (const rw::math::Vector3D< double > &x) const |
Get the normal of the surface at a specific point, x, lying on the surface. More... | |
virtual rw::math::Vector3D< double > | gradient (const rw::math::Vector3D< double > &x) const |
Get the gradient, \(\nabla \mathbf{F}\), of the surface at a specific point, x, lying on the surface. More... | |
virtual void | reuseTrimmingRegions (rw::geometry::ImplicitSurface::Ptr surface) const |
Let other surface reuse this surfaces trimming regions, if there are identical region definitions. More... | |
const Eigen::Matrix3d & | A () const |
Get the 3 x 3 symmetric matrix for the second order term in the implicit formulation. | |
const Eigen::Vector3d & | a () const |
Get the 3d vector for the first order term in the implicit formulation. | |
double | u () const |
Get the scalar for the zero order term in the implicit formulation. | |
double | determinantA () const |
Get the determinant of the \( \mathbf{A} \) matrix. More... | |
QuadraticSurface::Ptr | normalize () const |
Normalize the implicit expression such that the largest coefficient becomes one. More... | |
const std::vector< TrimmingRegion > & | getTrimmingConditions () const |
Get the trimming conditions for the surface. More... | |
void | setTrimmingConditions (const std::vector< TrimmingRegion > &conditions) |
Set the trimming conditions of this surface. More... | |
void | addTrimmingCondition (const TrimmingRegion &condition) |
Add a trimming condition to this surface. More... | |
std::pair< QuadraticSurface, rw::math::Rotation3D<> > | diagonalize () const |
Get a diagonalization of the surface. More... | |
bool | diagonalized () const |
Check if this surface is diagonalized. More... | |
Public Member Functions inherited from ImplicitSurface | |
ImplicitSurface () | |
Constructor. | |
virtual | ~ImplicitSurface () |
Destructor. | |
ImplicitSurface::Ptr | transform (const rw::math::Transform3D< double > &T) const |
Move the surface. More... | |
ImplicitSurface::Ptr | transform (const rw::math::Vector3D< double > &P) const |
Move the surface without rotation. More... | |
ImplicitSurface::Ptr | scale (double factor) const |
Get a scaled version of the surface. More... | |
ImplicitSurface::Ptr | clone () const |
Clone the surface. More... | |
Public Member Functions inherited from Surface | |
Surface () | |
Constructor. | |
virtual | ~Surface () |
Destructor. | |
Surface::Ptr | transform (const rw::math::Transform3D< double > &T) const |
Move the surface. More... | |
Surface::Ptr | transform (const rw::math::Vector3D< double > &P) const |
Move the surface without rotation. More... | |
Surface::Ptr | scale (double factor) const |
Get a scaled version of the surface. More... | |
Surface::Ptr | clone () const |
Clone the surface. More... | |
Static Public Member Functions | |
static QuadraticSurface::Ptr | makePlane (const rw::math::Vector3D< double > &n, double d) |
Represent a plane as a QuadraticSurface. More... | |
Normal forms of Quadratic Surfaces | |
Functions for creation of standard Quadratic Surfaces. | |
static QuadraticSurface::Ptr | makeEllipsoid (double a, double b, double c) |
Create an ellipsoid with radii a, b, and c respectively. More... | |
static QuadraticSurface::Ptr | makeSpheroid (double a, double b) |
Create a spheroid (special case of the ellipsoid). More... | |
static QuadraticSurface::Ptr | makeSphere (double radius) |
Create a sphere (special case of the ellipsoid and spheroid). More... | |
static QuadraticSurface::Ptr | makeEllipticParaboloid (double a, double b) |
Create an elliptic paraboloid. More... | |
static QuadraticSurface::Ptr | makeCircularParaboloid (double a) |
Create a circular paraboloid (special case of elliptic paraboloid). More... | |
static QuadraticSurface::Ptr | makeHyperbolicParaboloid (double a, double b) |
Create a hyperbolic paraboloid. More... | |
static QuadraticSurface::Ptr | makeEllipticHyperboloidOneSheet (double a, double b, double c) |
Create an elliptic hyperboloid of one sheet. More... | |
static QuadraticSurface::Ptr | makeCircularHyperboloidOneSheet (double a, double b) |
Create a circular hyperboloid of one sheet (special case of the elliptic hyperboloid of one sheet). More... | |
static QuadraticSurface::Ptr | makeEllipticHyperboloidTwoSheets (double a, double b, double c) |
Create an elliptic hyperboloid of two sheets. More... | |
static QuadraticSurface::Ptr | makeCircularHyperboloidTwoSheets (double a, double b) |
Create a circular hyperboloid of two sheets (special case of the elliptic hyperboloid of two sheets). More... | |
static QuadraticSurface::Ptr | makeEllipticCone (double a, double b, double c) |
Create an elliptic cone. More... | |
static QuadraticSurface::Ptr | makeCircularCone (double a, double b) |
Create a circular cone (special case of the elliptic cone). More... | |
static QuadraticSurface::Ptr | makeEllipticCylinder (double a, double b) |
Create an elliptic cylinder. More... | |
static QuadraticSurface::Ptr | makeCircularCylinder (double radius, bool outward=true) |
Create a circular cylinder (special case of the elliptic cylinder). More... | |
static QuadraticSurface::Ptr | makeHyperbolicCylinder (double a, double b) |
Create a hyperbolic cylinder. More... | |
static QuadraticSurface::Ptr | makeParabolicCylinder (double a) |
Create a parabolic cylinder. More... | |
A quadratic surface.
The general quadratic surface is described as an implicit surface of the form:
\( x^T A x + 2 a^T x + u = 0\)
where
A is a symmetric matrix, \( A \in \mathbb{R}^{3\times3} \) , and \( a \in \mathbb{R}^3, u \in \mathbb{R}\)
A trimming region is defined using an ImplicitSurface.
A point is only considered part of this surface, if all trimming conditions evaluate to a negative value.
QuadraticSurface | ( | const Eigen::Diagonal< Eigen::Matrix3d > & | A, |
const Eigen::Vector3d & | a, | ||
double | u, | ||
const std::vector< TrimmingRegion > & | conditions = std::vector< TrimmingRegion >() |
||
) |
Construct new quadratic surface of the implicit form \( x^T A x + 2 a^T x + u = 0\) when A is diagonal.
Some functions, such as getTriMesh and extremums, work on a diagonalized surface. When this constructor is used, some effort is saved as the surface is already known to be diagonalized.
For a diagonalized surface, all scaled, cloned and translated surfaces will also be diagonalized surfaces.
A | [in] the diagonal of the A matrix. |
a | [in] the vector \( a \in \mathbb{R}^3\) . |
u | [in] the scalar offset \( u \in \mathbb{R} \) . |
conditions | [in] (optional) list of trimming conditions. |
QuadraticSurface | ( | const Eigen::DiagonalMatrix< double, 3, 3 > & | A, |
const Eigen::Vector3d & | a, | ||
double | u, | ||
const std::vector< TrimmingRegion > & | conditions = std::vector< TrimmingRegion >() |
||
) |
QuadraticSurface | ( | const Eigen::SelfAdjointView< const Eigen::Matrix3d, Eigen::Upper > & | A, |
const Eigen::Vector3d & | a, | ||
double | u, | ||
const std::vector< TrimmingRegion > & | conditions = std::vector< TrimmingRegion >() |
||
) |
Construct new quadratic surface of the implicit form \( x^T A x + 2 a^T x + u = 0\) when A is non-diagonal.
A | [in] a view of the upper part of the symmetric matrix \( A \in \mathbb{R}^{3\times3} \) . Use the Eigen function A.selfadjointView<Eigen::Upper>() to extract the upper part. |
a | [in] the vector \( a \in \mathbb{R}^3\) . |
u | [in] the scalar offset \( u \in \mathbb{R} \) . |
conditions | [in] (optional) list of trimming conditions. |
QuadraticSurface | ( | const Eigen::SelfAdjointView< Eigen::Matrix3d, Eigen::Upper > & | A, |
const Eigen::Vector3d & | a, | ||
double | u, | ||
const std::vector< TrimmingRegion > & | conditions = std::vector< TrimmingRegion >() |
||
) |
A | [in] a view of the upper part of the symmetric matrix \( A \in \mathbb{R}^{3\times3} \) . Use the Eigen function A.selfadjointView<Eigen::Upper>() to extract the upper part. |
a | [in] the vector \( a \in \mathbb{R}^3\) . |
u | [in] the scalar offset \( u \in \mathbb{R} \) . |
conditions | [in] (optional) list of trimming conditions. |
QuadraticSurface | ( | const Eigen::SelfAdjointView< const Eigen::Matrix3d, Eigen::Lower > & | A, |
const Eigen::Vector3d & | a, | ||
double | u, | ||
const std::vector< TrimmingRegion > & | conditions = std::vector< TrimmingRegion >() |
||
) |
Construct new quadratic surface of the implicit form \( x^T A x + 2 a^T x + u = 0\) when A is non-diagonal.
A | [in] a view of the lower part of the symmetric matrix \( A \in \mathbb{R}^{3\times3} \) . Use the Eigen function A.selfadjointView<Eigen::Lower>() to extract the lower part. |
a | [in] the vector \( a \in \mathbb{R}^3\) . |
u | [in] the scalar offset \( u \in \mathbb{R} \) . |
conditions | [in] (optional) list of trimming conditions. |
QuadraticSurface | ( | const Eigen::SelfAdjointView< Eigen::Matrix3d, Eigen::Lower > & | A, |
const Eigen::Vector3d & | a, | ||
double | u, | ||
const std::vector< TrimmingRegion > & | conditions = std::vector< TrimmingRegion >() |
||
) |
A | [in] a view of the lower part of the symmetric matrix \( A \in \mathbb{R}^{3\times3} \) . Use the Eigen function A.selfadjointView<Eigen::Lower>() to extract the lower part. |
a | [in] the vector \( a \in \mathbb{R}^3\) . |
u | [in] the scalar offset \( u \in \mathbb{R} \) . |
conditions | [in] (optional) list of trimming conditions. |
|
inline |
Add a trimming condition to this surface.
condition | [in] the condition to add. |
QuadraticSurface::Ptr clone | ( | ) | const |
Clone the surface.
|
inline |
Get the determinant of the \( \mathbf{A} \) matrix.
std::pair<QuadraticSurface, rw::math::Rotation3D<> > diagonalize | ( | ) | const |
Get a diagonalization of the surface.
|
inline |
Check if this surface is diagonalized.
|
virtual |
Check if this surface is identical to other surface .
surface | [in] other surface to compare to. |
threshold | [in] threshold for when surfaces can be considered identical. |
Implements ImplicitSurface.
|
virtual |
Find the extent of the surface along a specific direction.
If the surface has no lower bound, the value -std::numeric_limits<double>::max() can be returned to indicate that the surface has unbounded minimum value in the given direction.
If the surface has no upper bound, the value std::numeric_limits<double>::max() can be returned to indicate that the surface has unbounded maximum value in the given direction.
direction | [in] a normalized direction vector. |
Implements ImplicitSurface.
|
virtual |
Discretize the surface into a triangle mesh representation.
If the border of a trimmed surface must fit with other surface triangulations, a discretized border must be given to this triangulation function.
If the same border points are used for different surfaces for their common edges, the triangulations will fit together.
border | [in] (optional) an ordered list of points on the surface, that forms the border of the patch to triangulate. |
Implements ImplicitSurface.
|
inline |
Get the trimming conditions for the surface.
|
virtual |
Get the gradient, \(\nabla \mathbf{F}\), of the surface at a specific point, x, lying on the surface.
The gradient is the vector of partial derivatives \( \nabla \mathbf{F} = \begin{bmatrix}\frac{\partial F}{\partial x} & \frac{\partial F}{\partial y} & \frac{\partial F}{\partial z} \end{bmatrix}^T \)
x | [in] a point on the surface. |
Implements ImplicitSurface.
|
virtual |
Check if point, P, on surface lies inside the trimming region.
P | [in] the point to check. |
Reimplemented from ImplicitSurface.
|
static |
Create a circular cone (special case of the elliptic cone).
Circular Cone (special case of elliptic cone)."
a | [in] radius of the circle in the \( x_1\) and \( x_2\) directions when \( x_3=c\) . |
b | [in] rate of change for the radius. |
|
static |
Create a circular cylinder (special case of the elliptic cylinder).
Circular Cylinder (special case of elliptic cylinder)."
radius | [in] radius in the \( x_1\) and \( x_2\) directions. |
outward | [in] (optional) set to false to create inner surface of cylinder, with normals pointing inwards. |
|
static |
Create a circular hyperboloid of one sheet (special case of the elliptic hyperboloid of one sheet).
Surface: Circular Hyperboloid of One Sheet (special case of elliptic hyperboloid of one sheet)."
a | [in] radius of the circle in the \( x_1\) and \( x_2\) directions when \( x_3=0\) . |
b | [in] radius is scaled along \( x_3\) , to \( \frac{a}{c}\sqrt{x_3^2+c^2}\) . |
|
static |
Create a circular hyperboloid of two sheets (special case of the elliptic hyperboloid of two sheets).
Quadratic Surface: Circular Hyperboloid of Two Sheets (special case of elliptic hyperboloid of two sheets)."
a | [in] radius of the circle in the \( x_1\) and \( x_2\) directions when \( x_3=\pm\sqrt{2}b\) . |
b | [in] distance from origo to each of the the two sheets. |
|
static |
Create a circular paraboloid (special case of elliptic paraboloid).
Circular Paraboloid (special case of elliptic paraboloid)."
a | [in] radius of the circle when \( x_3=1\) . |
|
static |
Create an ellipsoid with radii a, b, and c respectively.
Ellipsoid."
a | [in] radius in the \( x_1 \) direction. |
b | [in] radius in the \( x_2 \) direction. |
c | [in] radius in the \( x_3 \) direction. |
|
static |
Create an elliptic cone.
The cone is a singular (or degenerate) surface as it has a point where the gradient vanishes. In the origo the gradient will always be zero, and no normal can be determined.
Elliptic Cone."
a | [in] radius of the ellipse in the \( x_1\) direction when \( x_3=c\) . |
b | [in] radius of the ellipse in the \( x_2\) direction when \( x_3=c\) . |
c | [in] rate of change for the radius. |
|
static |
Create an elliptic cylinder.
Elliptic Cylinder."
a | [in] radius in the \( x_1\) direction. |
b | [in] radius in the \( x_2\) direction. |
|
static |
Create an elliptic hyperboloid of one sheet.
Surface: Elliptic Hyperboloid of One Sheet."
a | [in] radius of the ellipse in the \( x_1\) direction when \( x_3=0\) . |
b | [in] radius of the ellipse in the \( x_2\) direction when \( x_3=0\) . |
c | [in] radius is scaled with the factor \( \frac{1}{c}\sqrt{x_3^2+c^2}\) . |
|
static |
Create an elliptic hyperboloid of two sheets.
Quadratic Surface: Elliptic Hyperboloid of Two Sheets."
a | [in] radius of the ellipse in the \( x_1\) direction when \( x_3=\pm\sqrt{2}c\) . |
b | [in] radius of the ellipse in the \( x_2\) direction when \( x_3=\pm\sqrt{2}c\) . |
c | [in] distance from origo to each of the the two sheets. |
|
static |
Create an elliptic paraboloid.
Elliptic Paraboloid."
a | [in] radius of the ellipse in the \( x_1\) direction when \( x_3=1\) . |
b | [in] radius of the ellipse in the \( x_2\) direction when \( x_3=1\) . |
|
static |
Create a hyperbolic cylinder.
Hyperbolic Cylinder."
a | [in] width in the \( x_1\) direction at \( x_2=0\) . |
b | [in] controls the rate of change in the \( x_1\) direction. |
|
static |
Create a hyperbolic paraboloid.
Surface: Hyperbolic Paraboloid."
a | [in] width in the \( x_1\) direction when \( x_3=1\) . |
b | [in] width in the \( x_2\) direction when \( x_3=-1\) . |
|
static |
Create a parabolic cylinder.
Parabolic Cylinder."
a | [in] controls the focal length of the parabola. |
|
static |
Represent a plane as a QuadraticSurface.
A plane is a particularly simple type of quadratic surface, where \( \mathbf{A}=\mathbf{0}\) .
Even though a plane is not strictly a quadratic surface, is is often convenient to be able to treat it like a quadratic surface.
n | [in] the normal of the plane. |
d | [in] the distance from the plane to the origo. |
|
static |
Create a sphere (special case of the ellipsoid and spheroid).
(special case of ellipsoid and spheroid)."
radius | [in] radius of the sphere. |
|
static |
Create a spheroid (special case of the ellipsoid).
(special case of ellipsoid)."
a | [in] radius in the \( x_1 \) and \( x_2 \) directions. |
b | [in] radius in the \( x_3 \) direction. |
|
virtual |
Get the normal of the surface at a specific point, x, lying on the surface.
For the point on the implicit surface, where \( F(\mathbf{x})=0 \) , the normal is the direction of the gradient \(\frac{\nabla \mathbf{F}}{\|\nabla \mathbf{F}\|}\) .
x | [in] a point on the surface. |
Reimplemented from ImplicitSurface.
QuadraticSurface::Ptr normalize | ( | ) | const |
Normalize the implicit expression such that the largest coefficient becomes one.
For a quadratic surface, a scaling of \( \mathbf{A}, \mathbf{a} \) and u with a common factor, will give the exact same surface. This means that the numerical values can get arbitrarily big or small. This functions scales the expression such that the largest element becomes 1.
|
virtual |
Evaluate the implicit function, \( F(\mathbf{x}) \), for the surface.
x | [in] the point to evaluate. |
Implements ImplicitSurface.
|
virtual |
Let other surface reuse this surfaces trimming regions, if there are identical region definitions.
This allows for some implementations to save a small amount of memory.
surface | [in/out] the other surface. |
Reimplemented from ImplicitSurface.
QuadraticSurface::Ptr scale | ( | double | factor | ) | const |
Get a scaled version of the surface.
factor | [in] the factor to scale with. |
|
inlinevirtual |
Set the resolution used for discretization in the getTriMesh function.
The meaning of this parameter depends on the type of surface.
resolution | [in] the resolution parameter. |
Implements ImplicitSurface.
|
inline |
Set the trimming conditions of this surface.
conditions | [in] a vector of conditions. |
QuadraticSurface::Ptr transform | ( | const rw::math::Transform3D< double > & | T | ) | const |
Move the surface.
T | [in] the transform to the new surface. |
QuadraticSurface::Ptr transform | ( | const rw::math::Vector3D< double > & | P | ) | const |
Move the surface without rotation.
If there is no rotation, this function is better to use than transform(const rw::math::Transform3D<>&) const for some surfaces. This is because certain properties can be preserved.
P | [in] the translation vector to the new surface. |