VTK-m  2.0
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
vtkm::LineSegment< CoordType, Dim > Struct Template Reference

Represent a finite line segment with a pair of points. More...

#include <Geometry.h>

Public Types

using Vector = vtkm::Vec< CoordType, Dim >
 

Public Member Functions

template<int Dim_ = Dim, typename std::enable_if< Dim_==2, int >::type = 0>
VTKM_EXEC_CONT LineSegment ()
 Construct a default segment from (0,0) to (1,0). More...
 
template<int Dim_ = Dim, typename std::enable_if< Dim_==3, int >::type = 0>
VTKM_EXEC_CONT LineSegment ()
 Construct a default segment from (0,0,0) to (1,0,0). More...
 
VTKM_EXEC_CONT LineSegment (const Vector &p0, const Vector &p1)
 Construct a segment spanning points p0 and p1. More...
 
VTKM_EXEC_CONT bool IsSingular (CoordType tol2=static_cast< CoordType >(1.0e-6f)) const
 Return whether this line segment has an infinitesimal extent (i.e., whether the endpoints are coincident) More...
 
template<int Dim_ = Dim, typename std::enable_if< Dim_==3, int >::type = 0>
VTKM_EXEC_CONT Plane< CoordType > PerpendicularBisector () const
 Construct a plane bisecting this line segment (only when Dimension is 3). More...
 
template<int Dim_ = Dim, typename std::enable_if< Dim_==2, int >::type = 0>
VTKM_EXEC_CONT Ray< CoordType, Dim, true > PerpendicularBisector () const
 Construct a perpendicular bisector to this line segment (only when Dimension is 2). More...
 
VTKM_EXEC_CONT Vector Center () const
 Return the midpoint of the line segment. More...
 
VTKM_EXEC_CONT Vector Direction () const
 Return the vector pointing to endpoint 1 from endpoint 0. More...
 
VTKM_EXEC_CONT Vector Evaluate (CoordType param) const
 Compute a point along the line. param values in [0,1] lie on the line segment. More...
 
VTKM_EXEC_CONT CoordType DistanceTo (const Vector &point) const
 Return the minmum distance from point to this line segment. More...
 
VTKM_EXEC_CONT CoordType DistanceTo (const Vector &point, CoordType &param, Vector &projectedPoint) const
 Return the minimum distance between the line segment and point. More...
 
template<int Dim_ = Dim, typename std::enable_if< Dim_==2, int >::type = 0>
VTKM_EXEC_CONT bool IntersectInfinite (const LineSegment< CoordType, Dim > &other, Vector &point, CoordType tol=0.f)
 Compute the non-degenerate point where two (infinite) 2-D line segments intersect, or return false. More...
 

Public Attributes

Vector Endpoints [2]
 

Static Public Attributes

static constexpr int Dimension = Dim
 

Detailed Description

template<typename CoordType = vtkm::FloatDefault, int Dim = 3>
struct vtkm::LineSegment< CoordType, Dim >

Represent a finite line segment with a pair of points.

Member Typedef Documentation

◆ Vector

template<typename CoordType = vtkm::FloatDefault, int Dim = 3>
using vtkm::LineSegment< CoordType, Dim >::Vector = vtkm::Vec<CoordType, Dim>

Constructor & Destructor Documentation

◆ LineSegment() [1/3]

template<typename CoordType = vtkm::FloatDefault, int Dim = 3>
template<int Dim_ = Dim, typename std::enable_if< Dim_==2, int >::type = 0>
VTKM_EXEC_CONT vtkm::LineSegment< CoordType, Dim >::LineSegment ( )

Construct a default segment from (0,0) to (1,0).

◆ LineSegment() [2/3]

template<typename CoordType = vtkm::FloatDefault, int Dim = 3>
template<int Dim_ = Dim, typename std::enable_if< Dim_==3, int >::type = 0>
VTKM_EXEC_CONT vtkm::LineSegment< CoordType, Dim >::LineSegment ( )

Construct a default segment from (0,0,0) to (1,0,0).

◆ LineSegment() [3/3]

template<typename CoordType = vtkm::FloatDefault, int Dim = 3>
VTKM_EXEC_CONT vtkm::LineSegment< CoordType, Dim >::LineSegment ( const Vector p0,
const Vector p1 
)

Construct a segment spanning points p0 and p1.

Member Function Documentation

◆ Center()

template<typename CoordType = vtkm::FloatDefault, int Dim = 3>
VTKM_EXEC_CONT Vector vtkm::LineSegment< CoordType, Dim >::Center ( ) const
inline

Return the midpoint of the line segment.

◆ Direction()

template<typename CoordType = vtkm::FloatDefault, int Dim = 3>
VTKM_EXEC_CONT Vector vtkm::LineSegment< CoordType, Dim >::Direction ( ) const
inline

Return the vector pointing to endpoint 1 from endpoint 0.

This vector is not of unit length and in the case of degenerate lines, may have zero length. Call vtkm::Normal() on the return value if you want a normalized result.

◆ DistanceTo() [1/2]

template<typename CoordType = vtkm::FloatDefault, int Dim = 3>
VTKM_EXEC_CONT CoordType vtkm::LineSegment< CoordType, Dim >::DistanceTo ( const Vector point) const

Return the minmum distance from point to this line segment.

Note that when the endpoints are coincident, this simplifies the distance between point and either endpoint. Otherwise, the distance returned is either the perpendicular distance from point to the line segment or the distance to the nearest endpoint (whichever is smaller).

◆ DistanceTo() [2/2]

template<typename CoordType = vtkm::FloatDefault, int Dim = 3>
VTKM_EXEC_CONT CoordType vtkm::LineSegment< CoordType, Dim >::DistanceTo ( const Vector point,
CoordType &  param,
Vector projectedPoint 
) const

Return the minimum distance between the line segment and point.

◆ Evaluate()

template<typename CoordType = vtkm::FloatDefault, int Dim = 3>
VTKM_EXEC_CONT Vector vtkm::LineSegment< CoordType, Dim >::Evaluate ( CoordType  param) const

Compute a point along the line. param values in [0,1] lie on the line segment.

◆ IntersectInfinite()

template<typename CoordType = vtkm::FloatDefault, int Dim = 3>
template<int Dim_ = Dim, typename std::enable_if< Dim_==2, int >::type = 0>
VTKM_EXEC_CONT bool vtkm::LineSegment< CoordType, Dim >::IntersectInfinite ( const LineSegment< CoordType, Dim > &  other,
Vector point,
CoordType  tol = 0.f 
)

Compute the non-degenerate point where two (infinite) 2-D line segments intersect, or return false.

If true is returned, then the lines intersect in a unique point and point is set to that location.

If false is returned, then the lines are parallel and either they are coincident (intersect everywhere) or offset (intersect nowhere).

The tolerance tol is the minimum acceptable denominator used to compute the intersection point coordinates and thus dictates the maximum distance from the segments at which intersections will be reported as valid.

◆ IsSingular()

template<typename CoordType = vtkm::FloatDefault, int Dim = 3>
VTKM_EXEC_CONT bool vtkm::LineSegment< CoordType, Dim >::IsSingular ( CoordType  tol2 = static_cast< CoordType >(1.0e-6f)) const

Return whether this line segment has an infinitesimal extent (i.e., whether the endpoints are coincident)

◆ PerpendicularBisector() [1/2]

template<typename CoordType = vtkm::FloatDefault, int Dim = 3>
template<int Dim_ = Dim, typename std::enable_if< Dim_==3, int >::type = 0>
VTKM_EXEC_CONT Plane<CoordType> vtkm::LineSegment< CoordType, Dim >::PerpendicularBisector ( ) const

Construct a plane bisecting this line segment (only when Dimension is 3).

◆ PerpendicularBisector() [2/2]

template<typename CoordType = vtkm::FloatDefault, int Dim = 3>
template<int Dim_ = Dim, typename std::enable_if< Dim_==2, int >::type = 0>
VTKM_EXEC_CONT Ray<CoordType, Dim, true> vtkm::LineSegment< CoordType, Dim >::PerpendicularBisector ( ) const

Construct a perpendicular bisector to this line segment (only when Dimension is 2).

Member Data Documentation

◆ Dimension

template<typename CoordType = vtkm::FloatDefault, int Dim = 3>
constexpr int vtkm::LineSegment< CoordType, Dim >::Dimension = Dim
staticconstexpr

◆ Endpoints

template<typename CoordType = vtkm::FloatDefault, int Dim = 3>
Vector vtkm::LineSegment< CoordType, Dim >::Endpoints[2]

The documentation for this struct was generated from the following file: