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 a () const noexcept
 The first point. More...
 
PointRef b () const noexcept
 The second point. More...
 
PointRef first () const noexcept
 The first point. More...
 
PointRef second () const noexcept
 The second (last) point. More...
 
PointRef start () const noexcept
 The start (first) point. More...
 
PointRef end () const noexcept
 The end (second) point. More...
 
PointRef last () const noexcept
 The last (second) point. More...
 
Point centre () const
 Return centre (centroid) More...
 
scalar mag () const
 The magnitude (length) of the line. More...
 
Point vec () const
 Return start-to-end vector. More...
 
Point unitVec () const
 Return the unit vector (start-to-end) More...
 
Pair< Pointbox () const
 The enclosing (bounding) box for the line. 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 and sets both points (one on *this, one on the provided linePointRef. More...
 
template<>
scalar nearestDist (const line< point2D, const point2D & > &e, point2D &thisPt, point2D &edgePt) const
 
template<>
scalar nearestDist (const line< point2D, const point2D & > &edge, point2D &thisPoint, point2D &edgePoint) const
 2D specialisation More...
 

Static Public Member Functions

static Pair< Pointbox (const Point &p0, const Point &p1)
 The enclosing (bounding) box for two points. More...
 

Friends

Istreamoperator>> (Istream &, line &)
 
Ostreamoperator (Ostream &, const line &)
 

Detailed Description

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

A line primitive.

Source files

Definition at line 52 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 45 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 57 of file lineI.H.

◆ line() [3/3]

line ( Istream is)
inlineexplicit

Construct from Istream.

Definition at line 68 of file lineI.H.

Member Function Documentation

◆ a()

PointRef a ( ) const
inlinenoexcept

The first point.

Definition at line 222 of file line.H.

Referenced by Foam::areaInvDistSqrWeightedNormalFaceTriangle(), and Foam::areaNormalFaceTriangle().

Here is the caller graph for this function:

◆ b()

PointRef b ( ) const
inlinenoexcept

The second point.

Definition at line 227 of file line.H.

Referenced by Foam::areaInvDistSqrWeightedNormalFaceTriangle(), and Foam::areaNormalFaceTriangle().

Here is the caller graph for this function:

◆ first()

PointRef first ( ) const
inlinenoexcept

The first point.

Definition at line 232 of file line.H.

◆ second()

PointRef second ( ) const
inlinenoexcept

The second (last) point.

Definition at line 237 of file line.H.

◆ start()

PointRef start ( ) const
inlinenoexcept

The start (first) point.

Definition at line 242 of file line.H.

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

Here is the caller graph for this function:

◆ end()

PointRef end ( ) const
inlinenoexcept

The end (second) point.

Definition at line 247 of file line.H.

◆ last()

PointRef last ( ) const
inlinenoexcept

The last (second) point.

Definition at line 252 of file line.H.

◆ box() [1/2]

Foam::Pair< Point > box ( const Point p0,
const Point p1 
)
inlinestatic

The enclosing (bounding) box for two points.

Definition at line 143 of file lineI.H.

References Foam::max(), Foam::min(), and p0.

Here is the call graph for this function:

◆ centre()

Point centre ( ) const
inline

Return centre (centroid)

Definition at line 83 of file lineI.H.

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

Here is the caller graph for this function:

◆ mag()

Foam::scalar mag ( ) const
inline

The magnitude (length) of the line.

Definition at line 96 of file lineI.H.

References Foam::constant::physicoChemical::b, and Foam::mag().

Referenced by Foam::calcLeVector(), slidingInterface::modifyMotionPoints(), and lumpedPointMovement::setInterpolator().

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

◆ vec()

Point vec ( ) const
inline

Return start-to-end vector.

Definition at line 109 of file lineI.H.

References Foam::constant::physicoChemical::b.

Referenced by Foam::calcLeVector(), plane::lineIntersect(), slidingInterface::modifyMotionPoints(), and lumpedPointMovement::setInterpolator().

Here is the caller graph for this function:

◆ unitVec()

Point unitVec ( ) const
inline

Return the unit vector (start-to-end)

Definition at line 122 of file lineI.H.

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

Referenced by Foam::calcLeVector(), and lumpedPointMovement::setInterpolator().

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

◆ box() [2/2]

Foam::Pair< Point > box ( ) const
inline

The enclosing (bounding) box for the line.

Definition at line 153 of file lineI.H.

Referenced by linePoints::box(), and edge::box().

Here is the caller 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 167 of file lineI.H.

References Foam::constant::physicoChemical::b, Foam::constant::physicoChemical::c1, Foam::constant::physicoChemical::c2, Foam::mag(), and p.

Referenced by treeDataEdge::findNearest(), slidingInterface::modifyMotionPoints(), treeDataEdge::findNearestOp::operator()(), treeDataEdge::overlaps(), 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 199 of file lineI.H.

References Foam::constant::physicoChemical::b, Foam::constant::universal::c, PointHit< PointType >::distance(), edge::end(), stdFoam::end(), Foam::mag(), Foam::magSqr(), Foam::max(), Foam::min(), PointHit< PointType >::point(), 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 32 of file line.C.

References Foam::constant::electromagnetic::e, stdFoam::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 ,
line< Point, PointRef > &   
)
friend

◆ operator

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

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