VTK-m
2.2
|
Represent a plane with a base point (origin) and normal vector. More...
#include <Geometry.h>
Public Types | |
using | Vector = vtkm::Vec< CoordType, 3 > |
Public Member Functions | |
Plane () | |
Construct a default plane whose base point is the origin and whose normal is (0,0,1) More... | |
Plane (const Vector &origin, const Vector &normal, CoordType tol2=static_cast< CoordType >(1e-8f)) | |
Construct a plane with the given origin and normal. More... | |
bool | IsValid () const |
Return true if the plane's normal is well-defined to within the given tolerance. More... | |
CoordType | DistanceTo (const Vector &point) const |
Return the signed distance from the plane to the point. More... | |
Vector | ClosestPoint (const Vector &point) const |
Return the closest point in the plane to the given point. More... | |
template<bool IsTwoSided> | |
bool | Intersect (const Ray< CoordType, 3, IsTwoSided > &ray, CoordType ¶meter, Vector &point, bool &lineInPlane, CoordType tol=CoordType(1e-6f)) const |
Intersect this plane with the ray (or line if the ray is two-sided). More... | |
bool | Intersect (const LineSegment< CoordType > &segment, CoordType ¶meter, bool &lineInPlane) const |
Intersect this plane with the line segment. More... | |
bool | Intersect (const LineSegment< CoordType > &segment, CoordType ¶meter, Vector &point, bool &lineInPlane) const |
Intersect this plane with the line segment. More... | |
bool | Intersect (const Plane< CoordType > &other, Ray< CoordType, 3, true > &ray, bool &coincident, CoordType tol2=static_cast< CoordType >(1e-6f)) const |
Intersect this plane with another plane. More... | |
Plane (const Vector &normal={ 0, 0, 1 }) | |
Construct a plane through the origin with the given normal. More... | |
Plane (const Vector &origin, const Vector &normal) | |
Construct a plane through the given point with the given normal. More... | |
void | SetOrigin (const Vector &origin) |
Specify the origin of the plane. More... | |
void | SetNormal (const Vector &normal) |
Specify the normal vector to the plane. More... | |
const Vector & | GetOrigin () const |
Specify the origin of the plane. More... | |
const Vector & | GetNormal () const |
Specify the normal vector to the plane. More... | |
Scalar | Value (const Vector &point) const |
Evaluate the value of the implicit function. More... | |
Vector | Gradient (const Vector &) const |
Evaluate the gradient of the implicit function. More... | |
Public Attributes | |
Vector | Origin |
Vector | Normal |
Represent a plane with a base point (origin) and normal vector.
Implicit function for a plane.
A plane is defined by a point in the plane and a normal to the plane. The normal does not have to be a unit vector. The implicit function will still evaluate to 0 at the plane, but the values outside the plane (and the gradient) will be scaled by the length of the normal vector.
using vtkm::Plane::Vector = vtkm::Vec<CoordType, 3> |
vtkm::Plane::Plane | ( | ) |
Construct a default plane whose base point is the origin and whose normal is (0,0,1)
vtkm::Plane::Plane | ( | const Vector & | origin, |
const Vector & | normal, | ||
CoordType | tol2 = static_cast< CoordType >(1e-8f) |
||
) |
Construct a plane with the given origin and normal.
|
inlineexplicit |
Construct a plane through the origin with the given normal.
Construct a plane through the given point with the given normal.
Return the closest point in the plane to the given point.
CoordType vtkm::Plane::DistanceTo | ( | const Vector & | point | ) | const |
Return the signed distance from the plane to the point.
|
inline |
Specify the normal vector to the plane.
The magnitude of the plane does not matter (so long as it is more than zero) in terms of the location of the plane where the implicit function equals 0. However, if offsets away from the plane matter then the magnitude determines the scale of the value away from the plane.
|
inline |
Specify the origin of the plane.
The origin can be any point on the plane.
Evaluate the gradient of the implicit function.
The Gradient()
method for an implicit function takes a vtkm::Vec3f
and returns a vtkm::Vec3f
representing the pointing direction from the implicit function's shape. Gradient calculations are more object shape specific. It is advised to look at the individual shape implementations for specific implicit functions.
bool vtkm::Plane::Intersect | ( | const LineSegment< CoordType > & | segment, |
CoordType & | parameter, | ||
bool & | lineInPlane | ||
) | const |
Intersect this plane with the line segment.
Returns true if there is a non-degenrate intersection (i.e., an isolated point of intersection). Returns false if there is no intersection or if the intersection is degenerate (i.e., the entire line segment lies in the plane). In the latter case, lineInPlane will be true upon exit.
If this method returns true, then parameter will be set to a number in [0,1] indicating where along the line segment the plane hits.
bool vtkm::Plane::Intersect | ( | const LineSegment< CoordType > & | segment, |
CoordType & | parameter, | ||
Vector & | point, | ||
bool & | lineInPlane | ||
) | const |
Intersect this plane with the line segment.
Returns true if there is a non-degenrate intersection (i.e., an isolated point of intersection). Returns false if there is no intersection or if the intersection is degenerate (i.e., the entire line segment lines in the plane). In the latter case, lineInPlane will be true upon exit.
If this method returns true, then parameter will be set to a number in [0,1] indicating where along the line segment the plane hits and point will be set to that location.
bool vtkm::Plane::Intersect | ( | const Plane< CoordType > & | other, |
Ray< CoordType, 3, true > & | ray, | ||
bool & | coincident, | ||
CoordType | tol2 = static_cast< CoordType >(1e-6f) |
||
) | const |
Intersect this plane with another plane.
Returns true if there is a non-degenrate intersection (i.e., a line of intersection). Returns false if there is no intersection or if the intersection is degenerate (i.e., the planes are coincident). In the latter case, coincident will be true upon exit and segment will unmodified.
If this method returns true, then the resulting segment will have its base point on the line of intersection and its second point will be a unit length away in the direction of the cross produce of the input plane normals (this plane crossed with the other).
The tolerance tol is the minimum squared length of the cross-product of the two plane normals. It is also compared to the squared distance of the base point of other away from this plane when considering whether the planes are coincident.
bool vtkm::Plane::Intersect | ( | const Ray< CoordType, 3, IsTwoSided > & | ray, |
CoordType & | parameter, | ||
Vector & | point, | ||
bool & | lineInPlane, | ||
CoordType | tol = CoordType(1e-6f) |
||
) | const |
Intersect this plane with the ray (or line if the ray is two-sided).
Returns true if there is a non-degenrate intersection (i.e., an isolated point of intersection). Returns false if there is no intersection or if the intersection is degenerate (i.e., the entire ray/line lies in the plane). In the latter case, lineInPlane will be true upon exit.
If this method returns true, then parameter will be set to a number indicating where along the ray/line the plane hits and point will be set to that location. If the input is a ray, the parameter will be non-negative.
|
inline |
Return true if the plane's normal is well-defined to within the given tolerance.
|
inline |
Specify the normal vector to the plane.
The magnitude of the plane does not matter (so long as it is more than zero) in terms of the location of the plane where the implicit function equals 0. However, if offsets away from the plane matter then the magnitude determines the scale of the value away from the plane.
|
inline |
Specify the origin of the plane.
The origin can be any point on the plane.
|
inline |
Evaluate the value of the implicit function.
The Value()
method for an implicit function takes a vtkm::Vec3f
and returns a vtkm::FloatDefault
representing the orientation of the point with respect to the implicit function's shape. Negative scalar values represent vector points inside of the implicit function's shape. Positive scalar values represent vector points outside the implicit function's shape. Zero values represent vector points that lie on the surface of the implicit function.
Vector vtkm::Plane::Normal |
Vector vtkm::Plane::Origin |