VTK-m  2.0
Public Types | Public Member Functions | Public Attributes | List of all members
vtkm::Plane Class Reference

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

VTKM_EXEC_CONT Plane ()
 Construct a default plane whose base point is the origin and whose normal is (0,0,1) More...
 
VTKM_EXEC_CONT Plane (const Vector &origin, const Vector &normal, CoordType tol2=static_cast< CoordType >(1e-8f))
 Construct a plane with the given origin and normal. More...
 
VTKM_EXEC_CONT bool IsValid () const
 Return true if the plane's normal is well-defined to within the given tolerance. More...
 
VTKM_EXEC_CONT CoordType DistanceTo (const Vector &point) const
 Return the signed distance from the plane to the point. More...
 
VTKM_EXEC_CONT Vector ClosestPoint (const Vector &point) const
 Return the closest point in the plane to the given point. More...
 
template<bool IsTwoSided>
VTKM_EXEC_CONT bool 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). More...
 
VTKM_EXEC_CONT bool Intersect (const LineSegment< CoordType > &segment, CoordType &parameter, bool &lineInPlane) const
 Intersect this plane with the line segment. More...
 
VTKM_EXEC_CONT bool Intersect (const LineSegment< CoordType > &segment, CoordType &parameter, Vector &point, bool &lineInPlane) const
 Intersect this plane with the line segment. More...
 
VTKM_EXEC_CONT 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...
 
VTKM_EXEC_CONT Plane ()
 Construct plane passing through origin and normal to z-axis. More...
 
VTKM_EXEC_CONT Plane (const Vector &normal)
 Construct a plane through the origin with the given normal. More...
 
VTKM_EXEC_CONT Plane (const Vector &origin, const Vector &normal)
 Construct a plane through the given point with the given normal. More...
 
VTKM_CONT void SetOrigin (const Vector &origin)
 
VTKM_CONT void SetNormal (const Vector &normal)
 
const VTKM_EXEC_CONT VectorGetOrigin () const
 
const VTKM_EXEC_CONT VectorGetNormal () const
 
VTKM_EXEC_CONT Scalar Value (const Vector &point) const
 
VTKM_EXEC_CONT Vector Gradient (const Vector &) const
 

Public Attributes

Vector Origin
 
Vector Normal
 

Detailed Description

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.

Member Typedef Documentation

◆ Vector

using vtkm::Plane::Vector = vtkm::Vec<CoordType, 3>

Constructor & Destructor Documentation

◆ Plane() [1/5]

VTKM_EXEC_CONT vtkm::Plane::Plane ( )

Construct a default plane whose base point is the origin and whose normal is (0,0,1)

◆ Plane() [2/5]

VTKM_EXEC_CONT 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.

◆ Plane() [3/5]

VTKM_EXEC_CONT vtkm::Plane::Plane ( )
inline

Construct plane passing through origin and normal to z-axis.

◆ Plane() [4/5]

VTKM_EXEC_CONT vtkm::Plane::Plane ( const Vector normal)
inlineexplicit

Construct a plane through the origin with the given normal.

◆ Plane() [5/5]

VTKM_EXEC_CONT vtkm::Plane::Plane ( const Vector origin,
const Vector normal 
)
inline

Construct a plane through the given point with the given normal.

Member Function Documentation

◆ ClosestPoint()

VTKM_EXEC_CONT Vector vtkm::Plane::ClosestPoint ( const Vector point) const

Return the closest point in the plane to the given point.

◆ DistanceTo()

VTKM_EXEC_CONT CoordType vtkm::Plane::DistanceTo ( const Vector point) const

Return the signed distance from the plane to the point.

◆ GetNormal()

const VTKM_EXEC_CONT Vector& vtkm::Plane::GetNormal ( ) const
inline

◆ GetOrigin()

const VTKM_EXEC_CONT Vector& vtkm::Plane::GetOrigin ( ) const
inline

◆ Gradient()

VTKM_EXEC_CONT Vector vtkm::Plane::Gradient ( const Vector ) const
inline

◆ Intersect() [1/4]

VTKM_EXEC_CONT 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.

◆ Intersect() [2/4]

VTKM_EXEC_CONT 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.

◆ Intersect() [3/4]

VTKM_EXEC_CONT 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.

◆ Intersect() [4/4]

template<bool IsTwoSided>
VTKM_EXEC_CONT 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.

◆ IsValid()

VTKM_EXEC_CONT bool vtkm::Plane::IsValid ( ) const
inline

Return true if the plane's normal is well-defined to within the given tolerance.

◆ SetNormal()

VTKM_CONT void vtkm::Plane::SetNormal ( const Vector normal)
inline

◆ SetOrigin()

VTKM_CONT void vtkm::Plane::SetOrigin ( const Vector origin)
inline

◆ Value()

VTKM_EXEC_CONT Scalar vtkm::Plane::Value ( const Vector point) const
inline

Member Data Documentation

◆ Normal

Vector vtkm::Plane::Normal

◆ Origin

Vector vtkm::Plane::Origin

The documentation for this class was generated from the following files: