A plane and related functions. More...
#include <gz/math/Plane.hh>
Public Types | |
enum | PlaneSide { NEGATIVE_SIDE = 0 , POSITIVE_SIDE = 1 , NO_SIDE = 2 , BOTH_SIDE = 3 } |
Enum used to indicate a side of the plane, no side, or both sides for entities on the plane. More... | |
Public Member Functions | |
Plane () | |
Constructor. | |
Plane (const Vector3< T > &_normal, const Vector2< T > &_size, T _offset) | |
Constructor. | |
Plane (const Vector3< T > &_normal, T _offset=0.0) | |
Constructor from a normal and a distance. | |
T | Distance (const Vector3< T > &_origin, const Vector3< T > &_dir) const |
Get distance to the plane give an origin and direction. | |
T | Distance (const Vector3< T > &_point) const |
The distance to the plane from the given point. The distance can be negative, which indicates the point is on the negative side of the plane. | |
std::optional< Vector3< T > > | Intersection (const Vector3< T > &_point, const Vector3< T > &_gradient, const double &_tolerance=1e-6) const |
Get the intersection of an infinite line with the plane, given the line's gradient and a point in parametrized space. | |
Vector3< T > & | Normal () |
Get the plane normal. | |
const Vector3< T > & | Normal () const |
Get the plane normal. | |
T | Offset () const |
Get the plane offset. | |
void | Set (const Vector3< T > &_normal, const Vector2< T > &_size, T _offset) |
Set the plane. | |
void | Set (const Vector3< T > &_normal, T _offset) |
Set the plane. | |
PlaneSide | Side (const math::AxisAlignedBox &_box) const |
The side of the plane a box is on. | |
PlaneSide | Side (const Vector3< T > &_point) const |
The side of the plane a point is on. | |
Vector2< T > & | Size () |
Get the plane size. | |
const Vector2< T > & | Size () const |
Get the plane size. | |
Detailed Description
class gz::math::Plane< T >
A plane and related functions.
Member Enumeration Documentation
◆ PlaneSide
Enum used to indicate a side of the plane, no side, or both sides for entities on the plane.
- See also
- Side
Constructor & Destructor Documentation
◆ Plane() [1/3]
◆ Plane() [2/3]
Constructor from a normal and a distance.
- Parameters
-
[in] _normal The plane normal [in] _offset Offset along the normal
◆ Plane() [3/3]
|
inline |
Constructor.
- Parameters
-
[in] _normal The plane normal [in] _size Size of the plane [in] _offset Offset along the normal
References Plane< T >::Set().
Member Function Documentation
◆ Distance() [1/2]
|
inline |
Get distance to the plane give an origin and direction.
- Parameters
-
[in] _origin the origin [in] _dir a direction
- Returns
- the shortest distance
◆ Distance() [2/2]
The distance to the plane from the given point. The distance can be negative, which indicates the point is on the negative side of the plane.
- Parameters
-
[in] _point 3D point to calculate distance from.
- Returns
- Distance from the point to the plane.
- See also
- Side
Referenced by Plane< T >::Side(), and Plane< T >::Side().
◆ Intersection()
|
inline |
Get the intersection of an infinite line with the plane, given the line's gradient and a point in parametrized space.
- Parameters
-
[in] _point A point that lies on the line. [in] _gradient The gradient of the line. [in] _tolerance The tolerance for determining a line is parallel to the plane. Optional, default=10^-16
- Returns
- The point of intersection. std::nullopt if the line is parallel to the plane (including lines on the plane).
References Vector3< T >::Cross(), Vector3< T >::Dot(), Plane< T >::Normal(), Plane< T >::Offset(), and Plane< T >::Size().
◆ Normal() [1/2]
◆ Normal() [2/2]
Get the plane normal.
Referenced by Plane< T >::Intersection().
◆ Offset()
|
inline |
Get the plane offset.
Referenced by Plane< T >::Intersection().
◆ Set() [1/2]
|
inline |
Set the plane.
- Parameters
-
[in] _normal The plane normal [in] _size Size of the plane [in] _offset Offset along the normal
◆ Set() [2/2]
Set the plane.
- Parameters
-
[in] _normal The plane normal [in] _offset Offset along the normal
Referenced by Plane< T >::Plane().
◆ Side() [1/2]
|
inline |
The side of the plane a box is on.
- Parameters
-
[in] _box The 3D box to check.
- Returns
- Plane::NEGATIVE_SIDE if the distance from the box to the plane is negative, Plane::POSITIVE_SIDE if the distance from the box to the plane is positive, or Plane::BOTH_SIDE if the box is on the plane.
References Plane< T >::BOTH_SIDE, AxisAlignedBox::Center(), Plane< T >::Distance(), Plane< T >::NEGATIVE_SIDE, and Plane< T >::POSITIVE_SIDE.
◆ Side() [2/2]
The side of the plane a point is on.
- Parameters
-
[in] _point The 3D point to check.
- Returns
- Plane::NEGATIVE_SIDE if the distance from the point to the plane is negative, Plane::POSITIVE_SIDE if the distance from the point to the plane is positive, or Plane::NO_SIDE if the point is on the plane.
References Plane< T >::Distance(), Plane< T >::NEGATIVE_SIDE, Plane< T >::NO_SIDE, and Plane< T >::POSITIVE_SIDE.
◆ Size() [1/2]
◆ Size() [2/2]
Get the plane size.
Referenced by Plane< T >::Intersection().
The documentation for this class was generated from the following file: