line< Point, PointRef > Class Template Reference

A line primitive. More...

Public Member Functions

 line (const Point &from, const Point &to)
 Construct from two points. More...
 
 line (const UList< Point > &points, const FixedList< label, 2 > &indices)
 Construct from two points in the list of points. More...
 
 line (Istream &is)
 Construct from Istream. More...
 
PointRef first () const noexcept
 Return first point. More...
 
PointRef second () const noexcept
 Return second (last) point. More...
 
PointRef last () const noexcept
 Return last (second) point. More...
 
PointRef start () const noexcept
 Return first point. More...
 
PointRef end () const noexcept
 Return second (last) point. More...
 
Point centre () const
 Return centre (centroid) More...
 
scalar mag () const
 Return scalar magnitude. More...
 
Point vec () const
 Return start-to-end vector. More...
 
Point unitVec () const
 Return the unit vector (start-to-end) More...
 
PointHit< PointnearestDist (const Point &p) const
 Return nearest distance to line from a given point. More...
 
scalar nearestDist (const line< Point, const Point & > &edge, Point &thisPoint, Point &edgePoint) const
 Return nearest distance from line to line. Returns distance. More...
 
scalar nearestDist (const line< point2D, const point2D & > &e, point2D &thisPt, point2D &edgePt) const
 
scalar nearestDist (const line< point2D, const point2D & > &edge, point2D &thisPoint, point2D &edgePoint) const
 2D specialisation More...
 

Friends

Istreamoperator>> (Istream &is, line &l)
 
Ostreamoperator (Ostream &os, const line &l)
 

Detailed Description

template<class Point, class PointRef>
class Foam::line< Point, PointRef >

A line primitive.

Source files

Definition at line 67 of file line.H.

Constructor & Destructor Documentation

◆ line() [1/3]

line ( const Point from,
const Point to 
)
inline

Construct from two points.

Definition at line 35 of file lineI.H.

◆ line() [2/3]

line ( const UList< Point > &  points,
const FixedList< label, 2 > &  indices 
)
inline

Construct from two points in the list of points.

The indices could be from edge etc.

Definition at line 43 of file lineI.H.

◆ line() [3/3]

line ( Istream is)
inlineexplicit

Construct from Istream.

Definition at line 55 of file lineI.H.

Member Function Documentation

◆ first()

PointRef first
inlinenoexcept

Return first point.

Definition at line 64 of file lineI.H.

Referenced by Foam::calcEdgeNormalFromFace().

Here is the caller graph for this function:

◆ second()

PointRef second
inlinenoexcept

Return second (last) point.

Definition at line 71 of file lineI.H.

◆ last()

PointRef last
inlinenoexcept

Return last (second) point.

Definition at line 78 of file lineI.H.

Referenced by Foam::calcEdgeNormalFromFace().

Here is the caller graph for this function:

◆ start()

PointRef start
inlinenoexcept

Return first point.

Definition at line 85 of file lineI.H.

Referenced by plane::lineIntersect(), and slidingInterface::modifyMotionPoints().

Here is the caller graph for this function:

◆ end()

PointRef end
inlinenoexcept

Return second (last) point.

Definition at line 91 of file lineI.H.

◆ centre()

Point centre
inline

Return centre (centroid)

Definition at line 98 of file lineI.H.

Referenced by Foam::calcEdgeNormalFromFace(), and surfaceFeatures::nearestSurfEdge().

Here is the caller graph for this function:

◆ mag()

Foam::scalar mag
inline

Return scalar magnitude.

Definition at line 105 of file lineI.H.

Referenced by Foam::calcEdgeNormalFromFace(), and slidingInterface::modifyMotionPoints().

Here is the caller graph for this function:

◆ vec()

Point vec
inline

Return start-to-end vector.

Definition at line 112 of file lineI.H.

Referenced by Foam::calcEdgeNormalFromFace(), plane::lineIntersect(), and slidingInterface::modifyMotionPoints().

Here is the caller graph for this function:

◆ unitVec()

Point unitVec
inline

Return the unit vector (start-to-end)

Definition at line 119 of file lineI.H.

References Foam::mag(), s(), and Foam::Zero.

Here is the call graph for this function:

◆ nearestDist() [1/4]

Foam::PointHit< Point > nearestDist ( const Point p) const

Return nearest distance to line from a given point.

If the nearest point is on the line, return a hit

Definition at line 129 of file lineI.H.

References b, Foam::mag(), and p.

Referenced by treeDataFace::getVolumeType(), slidingInterface::modifyMotionPoints(), and faceCollapser::setRefinement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nearestDist() [2/4]

Foam::scalar nearestDist ( const line< Point, const Point & > &  edge,
Point thisPoint,
Point edgePoint 
) const

Return nearest distance from line to line. Returns distance.

and sets both points (one on *this, one on the provided linePointRef.

Definition at line 161 of file lineI.H.

References b, PointHit< PointType >::distance(), edge::end(), Foam::mag(), Foam::magSqr(), Foam::max(), Foam::min(), PointHit< PointType >::rawPoint(), s(), and edge::start().

Here is the call graph for this function:

◆ nearestDist() [3/4]

scalar nearestDist ( const line< point2D, const point2D & > &  e,
point2D thisPt,
point2D edgePt 
) const

Definition at line 38 of file line.C.

References e, UList< T >::end(), Foam::mag(), Foam::max(), Foam::min(), Vector2D< Cmpt >::perp(), and s().

Here is the call graph for this function:

◆ nearestDist() [4/4]

scalar nearestDist ( const line< point2D, const point2D & > &  edge,
point2D thisPoint,
point2D edgePoint 
) const

2D specialisation

Friends And Related Function Documentation

◆ operator>>

Istream & operator>> ( Istream is,
line< Point, PointRef > &  l 
)
friend

◆ operator

Ostream & operator ( Ostream os,
const line< Point, PointRef > &  l 
)
friend

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