RobWorkProject
24.12.4-
|
Torus defined as an implicit surface. More...
#include <ImplicitTorus.hpp>
Inherits ImplicitSurface.
Public Types | |
typedef rw::core::Ptr< ImplicitTorus > | Ptr |
Smart pointer type for ImplicitTorus. | |
typedef rw::core::Ptr< const ImplicitTorus > | CPtr |
Smart pointer type for const ImplicitTorus. | |
typedef 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 | |
ImplicitTorus (double R, double r) | |
Construct circular torus. More... | |
ImplicitTorus (double R1, double R2, double r1, double r2) | |
Construct elliptic torus. More... | |
virtual | ~ImplicitTorus () |
Destructor. | |
ImplicitTorus::Ptr | transform (const rw::math::Transform3D< double > &T) const |
Move the surface. More... | |
ImplicitTorus::Ptr | transform (const rw::math::Vector3D< double > &P) const |
Move the surface without rotation. More... | |
ImplicitTorus::Ptr | scale (double factor) const |
Get a scaled version of the surface. More... | |
ImplicitTorus::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 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... | |
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... | |
Torus defined as an implicit surface.
The torus is described as an implicit surface of the form:
\( \left(x^T x + R^2 - r^2 \right)^2 - 4 R^2 x^T \begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{bmatrix} x = 0\)
or equivalently:
\( \left(x^T x - R^2 - r^2 \right)^2 - 4 R^2 (r^2 - {x_3}^2) = 0\)
where R is the distance from the center of the torus to the center of the tube, r is the radius of the tube, and \( x \in \mathbb{R}^3\).
Alternatively, a torus with an elliptic tube can be specified. This surface has the more generic form:
\( \left( x^T \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & \frac{{r_1}^2}{{r_2}^2} \end{bmatrix} x + R^2 - {r_1}^2 \right)^2 - 4 R^2 x^T \begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{bmatrix} x = 0\)
or equivalently:
\( \left( x^T \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & \frac{{r_1}^2}{{r_2}^2} \end{bmatrix} x - R^2 - {r_1}^2 \right)^2 - 4 R^2 \left({r_1}^2 - \frac{{r_1}^2}{{r_2}^2} {x_3}^2 \right) = 0\)
The elliptic torus with elliptic tube has the much more complex form:
\( \left( ({R_2}^2+t){x_1}^2 + ({R_1}^2+t){x_2}^2 - ({R_1}^2+t)({R_2}^2+t) - 4 R_1 R_2 t \right)^2 - 4 t (R_2 {x_1}^2 + R_1 {x_2}^2 - (R_1+R_2)(R_1 R_2 + t))^2 = 0\)
where
\( t = {r_1}^2 (1-\frac{{x_3}^2}{{r_2}^2}) \)
Notice that many functions are not yet implemented for this last type of elliptic torus. These functions might throw an exception.
typedef ImplicitSurface::CPtr TrimmingRegion |
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.
ImplicitTorus | ( | double | R, |
double | r | ||
) |
Construct circular torus.
R | [in] distance from center of torus to center of tube. |
r | [in] radius of the tube. |
ImplicitTorus | ( | double | R1, |
double | R2, | ||
double | r1, | ||
double | r2 | ||
) |
Construct elliptic torus.
R1 | [in] distance from center of torus to center of tube in first direction. |
R2 | [in] distance from center of torus to center of tube in second direction. |
r1 | [in] radius of the tube in first direction. |
r2 | [in] radius of the tube in second direction. |
|
inline |
Add a trimming condition to this surface.
condition | [in] the condition to add. |
ImplicitTorus::Ptr clone | ( | ) | const |
Clone the surface.
|
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.
|
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.
|
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.
ImplicitTorus::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. |
ImplicitTorus::Ptr transform | ( | const rw::math::Transform3D< double > & | T | ) | const |
Move the surface.
T | [in] the transform to the new surface. |
ImplicitTorus::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. |