Loading...
Searching...
No Matches
line< Point, PointRef > Class Template Reference

A line primitive. More...

#include <line.H>

Inheritance diagram for line< Point, PointRef >:

Public Member Functions

 line (const Point &from, const Point &to)
 Construct from two points.
 line (const UList< Point > &points, const FixedList< label, 2 > &indices)
 Construct from two points in the list of points.
 line (Istream &is)
 Construct from Istream.
PointRef a () const noexcept
 The first point.
PointRef b () const noexcept
 The second point.
PointRef first () const noexcept
 The first point.
PointRef second () const noexcept
 The second (last) point.
PointRef start () const noexcept
 The start (first) point.
PointRef end () const noexcept
 The end (second) point.
PointRef last () const noexcept
 The last (second) point.
Point centre () const
 Return centre (centroid).
scalar mag () const
 The magnitude (length) of the line.
scalar magSqr () const
 The magnitude squared (length squared) of the line.
Point vec () const
 Return start-to-end vector.
Point unitVec () const
 Return the unit vector (start-to-end).
Pair< Pointbox () const
 The enclosing (bounding) box for the line.
PointHit< PointnearestDist (const Point &p) const
 Return nearest distance to line from a given point.
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.
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

Static Public Member Functions

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

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 179 of file line.H.

Constructor & Destructor Documentation

◆ line() [1/3]

template<class Point, class PointRef>
line ( const Point & from,
const Point & to )
inline

Construct from two points.

Definition at line 44 of file lineI.H.

Referenced by treeDataEdge::line(), and nearestDist().

Here is the caller graph for this function:

◆ line() [2/3]

template<class Point, class PointRef>
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 56 of file lineI.H.

References points.

◆ line() [3/3]

template<class Point, class PointRef>
line ( Istream & is)
inlineexplicit

Construct from Istream.

Definition at line 68 of file lineI.H.

Member Function Documentation

◆ a()

template<class Point, class PointRef>
PointRef a ( ) const
inlinenoexcept

The first point.

Definition at line 227 of file line.H.

Referenced by Foam::areaInvDistSqrWeightedNormalFaceTriangle(), Foam::areaNormalFaceTriangle(), mag(), magSqr(), nearestDist(), and vec().

Here is the caller graph for this function:

◆ b()

template<class Point, class PointRef>
PointRef b ( ) const
inlinenoexcept

The second point.

Definition at line 232 of file line.H.

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

Here is the caller graph for this function:

◆ first()

template<class Point, class PointRef>
PointRef first ( ) const
inlinenoexcept

The first point.

Definition at line 237 of file line.H.

◆ second()

template<class Point, class PointRef>
PointRef second ( ) const
inlinenoexcept

The second (last) point.

Definition at line 242 of file line.H.

◆ start()

template<class Point, class PointRef>
PointRef start ( ) const
inlinenoexcept

The start (first) point.

Definition at line 247 of file line.H.

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

Here is the caller graph for this function:

◆ end()

template<class Point, class PointRef>
PointRef end ( ) const
inlinenoexcept

The end (second) point.

Definition at line 252 of file line.H.

Referenced by nearestDist().

Here is the caller graph for this function:

◆ last()

template<class Point, class PointRef>
PointRef last ( ) const
inlinenoexcept

The last (second) point.

Definition at line 257 of file line.H.

◆ box() [1/2]

template<class Point, class PointRef>
Foam::Pair< Point > box ( const Point & p0,
const Point & p1 )
inlinestatic

The enclosing (bounding) box for two points.

Definition at line 155 of file lineI.H.

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

Here is the call graph for this function:

◆ centre()

template<class Point, class PointRef>
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()

template<class Point, class PointRef>
Foam::scalar mag ( ) const
inline

The magnitude (length) of the line.

Definition at line 96 of file lineI.H.

References a(), and b.

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

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

◆ magSqr()

template<class Point, class PointRef>
Foam::scalar magSqr ( ) const
inline

The magnitude squared (length squared) of the line.

Definition at line 109 of file lineI.H.

References a(), and b.

Here is the call graph for this function:

◆ vec()

template<class Point, class PointRef>
Point vec ( ) const
inline

Return start-to-end vector.

Definition at line 122 of file lineI.H.

References a(), and b.

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

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

◆ unitVec()

template<class Point, class PointRef>
Point unitVec ( ) const
inline

Return the unit vector (start-to-end).

Definition at line 135 of file lineI.H.

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

Referenced by Foam::calcLeVector(), refinementFeatures::findNearestEdge(), and refinementFeatures::findNearestRegionEdge().

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

◆ box() [2/2]

template<class Point, class PointRef>
Foam::Pair< Point > box ( ) const
inline

The enclosing (bounding) box for the line.

Definition at line 166 of file lineI.H.

References box().

Referenced by box().

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

◆ nearestDist() [1/4]

template<class Point, class PointRef>
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 179 of file lineI.H.

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

Referenced by treeDataEdge::findNearest(), treeDataFace::getVolumeType(), slidingInterface::modifyMotionPoints(), nearestDist(), treeDataEdge::findNearestOp::operator()(), and faceCollapser::setRefinement().

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

◆ nearestDist() [2/4]

template<class Point, class PointRef>
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 211 of file lineI.H.

References a(), b, b(), PointHit< PointType >::distance(), edge::end(), end(), line(), Foam::mag(), Foam::magSqr(), Foam::max(), Foam::min(), nearestDist(), PointHit< PointType >::point(), s(), edge::start(), and 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 31 of file line.C.

◆ nearestDist() [4/4]

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

2D specialisation

◆ operator>>

template<class Point, class PointRef>
Istream & operator>> ( Istream & ,
line< Point, PointRef > &  )
friend

◆ operator

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

The documentation for this class was generated from the following files:
  • src/OpenFOAM/meshes/primitiveShapes/line/line.H
  • src/OpenFOAM/meshes/primitiveShapes/line/lineI.H