Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
polyLine Class Reference

A series of straight line segments, which can also be interpreted as a series of control points for splines, etc. More...

Inheritance diagram for polyLine:
Inheritance graph
[legend]
Collaboration diagram for polyLine:
Collaboration graph
[legend]

Public Member Functions

 polyLine (const pointField &, const bool notImplementedClosed=false)
 Construct from components. More...
 
const pointFieldpoints () const
 Return const-access to the control-points. More...
 
label nSegments () const
 Return the number of line segments. More...
 
point position (const scalar) const
 Return the point position corresponding to the curve parameter. More...
 
point position (const label segment, const scalar) const
 Return the point position corresponding to the local parameter. More...
 
scalar length () const
 Return the length of the curve. More...
 

Protected Member Functions

void calcParam ()
 Precalculate the rational cumulative parameter value. More...
 
label localParameter (scalar &lambda) const
 Return the line segment and the local parameter [0..1]. More...
 

Protected Attributes

pointField points_
 The control points or ends of each segments. More...
 
scalar lineLength_
 The real line length. More...
 
scalarList param_
 The rational (0-1) cumulative parameter value for each point. More...
 

Detailed Description

A series of straight line segments, which can also be interpreted as a series of control points for splines, etc.

A future implementation could also handle a closed polyLine.

Source files

Definition at line 53 of file polyLine.H.

Constructor & Destructor Documentation

◆ polyLine()

polyLine ( const pointField ps,
const bool  notImplementedClosed = false 
)

Construct from components.

Definition at line 61 of file polyLine.C.

References polyLine::calcParam().

Here is the call graph for this function:

Member Function Documentation

◆ calcParam()

void calcParam ( )
protected

Precalculate the rational cumulative parameter value.

and the line-length

Definition at line 30 of file polyLine.C.

References UList< T >::last(), polyLine::lineLength_, Foam::mag(), polyLine::param_, polyLine::points_, List< T >::setSize(), and List< T >::size().

Referenced by polyLine::polyLine().

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

◆ localParameter()

Foam::label localParameter ( scalar &  lambda) const
protected

Return the line segment and the local parameter [0..1].

corresponding to the global lambda [0..1]

Definition at line 85 of file polyLine.C.

References polyLine::nSegments(), and polyLine::param_.

Referenced by BSpline::position(), CatmullRomSpline::position(), and polyLine::position().

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

◆ points()

const Foam::pointField & points ( ) const

Return const-access to the control-points.

Definition at line 73 of file polyLine.C.

References polyLine::points_.

Referenced by BSpline::position(), CatmullRomSpline::position(), and polyLine::position().

Here is the caller graph for this function:

◆ nSegments()

Foam::label nSegments ( ) const

Return the number of line segments.

Definition at line 79 of file polyLine.C.

References polyLine::points_, and List< T >::size().

Referenced by polyLine::localParameter(), BSpline::position(), CatmullRomSpline::position(), and polyLine::position().

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

◆ position() [1/2]

Foam::point position ( const scalar  mu) const

Return the point position corresponding to the curve parameter.

0 <= lambda <= 1

Definition at line 118 of file polyLine.C.

References UList< T >::first(), lambda(), UList< T >::last(), polyLine::localParameter(), Foam::constant::physicoChemical::mu, and polyLine::points_.

Referenced by polyLineEdge::position().

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

◆ position() [2/2]

Foam::point position ( const label  segment,
const scalar  mu 
) const

Return the point position corresponding to the local parameter.

0 <= lambda <= 1 on the given segment

Definition at line 137 of file polyLine.C.

References UList< T >::first(), UList< T >::last(), polyLine::nSegments(), polyLine::points(), and polyLine::points_.

Here is the call graph for this function:

◆ length()

Foam::scalar length ( ) const

Return the length of the curve.

Definition at line 172 of file polyLine.C.

References polyLine::lineLength_.

Member Data Documentation

◆ points_

pointField points_
protected

The control points or ends of each segments.

Definition at line 69 of file polyLine.H.

Referenced by polyLine::calcParam(), polyLine::nSegments(), polyLine::points(), and polyLine::position().

◆ lineLength_

scalar lineLength_
protected

The real line length.

Definition at line 72 of file polyLine.H.

Referenced by polyLine::calcParam(), polyLineEdge::length(), and polyLine::length().

◆ param_

scalarList param_
protected

The rational (0-1) cumulative parameter value for each point.

Definition at line 75 of file polyLine.H.

Referenced by polyLine::calcParam(), and polyLine::localParameter().


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