SPH
Public Member Functions | List of all members
Curve Class Reference

Represents a user-defined function, defined by a set of points interpolated by either piecewise linear curve or cubic spline. More...

#include <Curve.h>

Public Member Functions

 Curve ()
 Creates an identity function, defined in interval [0, 1]. More...
 
 Curve (const Interval &rangeX, const Interval &rangeY)
 Creates a linear function, mapping interval rangeX to interval rangeY. More...
 
 Curve (Array< CurvePoint > &&curve)
 Creates a function from provided set of points. More...
 
 Curve (const Curve &curve)
 
Curveoperator= (const Curve &curve)
 
Float operator() (const Float x) const
 Evaluates the function and returns the result. More...
 
Size getPointCnt () const
 Returns the number of points defining the curve. More...
 
const CurvePointgetPoint (const Size idx) const
 Returns the position of idx-th point. More...
 
void setPoint (const Size idx, const CurvePoint &newPoint)
 Modifies the position of idx-th points. More...
 
void addPoint (const CurvePoint &newPoint)
 Adds a new point to the curve. More...
 
void deletePoint (const Size idx)
 Removes idx-th point from curve. More...
 
bool getSegment (const Size idx) const
 Returns the interpolation type of idx-th segment. More...
 
void setSegment (const Size idx, const bool cubic)
 Modifies the interpolation type of idx-th segment. More...
 
Interval rangeX () const
 Returns the extent of the curve in x-direction. More...
 
Interval rangeY () const
 Returns the extent of the curve in y-direction. More...
 

Detailed Description

Represents a user-defined function, defined by a set of points interpolated by either piecewise linear curve or cubic spline.

Definition at line 19 of file Curve.h.

Constructor & Destructor Documentation

◆ Curve() [1/4]

Curve::Curve ( )

Creates an identity function, defined in interval [0, 1].

Definition at line 64 of file Curve.cpp.

◆ Curve() [2/4]

Curve::Curve ( const Interval rangeX,
const Interval rangeY 
)

Creates a linear function, mapping interval rangeX to interval rangeY.

Definition at line 71 of file Curve.cpp.

◆ Curve() [3/4]

Curve::Curve ( Array< CurvePoint > &&  curve)

Creates a function from provided set of points.

The points do not have to be sorted.

Definition at line 78 of file Curve.cpp.

◆ Curve() [4/4]

Curve::Curve ( const Curve curve)

Definition at line 86 of file Curve.cpp.

Member Function Documentation

◆ addPoint()

void Curve::addPoint ( const CurvePoint newPoint)

Adds a new point to the curve.

The interpolation type of the newly created segment is copied from the split segment.

Definition at line 108 of file Curve.cpp.

◆ deletePoint()

void Curve::deletePoint ( const Size  idx)

Removes idx-th point from curve.

Definition at line 120 of file Curve.cpp.

◆ getPoint()

const CurvePoint & Curve::getPoint ( const Size  idx) const

Returns the position of idx-th point.

Definition at line 99 of file Curve.cpp.

◆ getPointCnt()

Size Curve::getPointCnt ( ) const

Returns the number of points defining the curve.

Definition at line 95 of file Curve.cpp.

◆ getSegment()

bool Curve::getSegment ( const Size  idx) const

Returns the interpolation type of idx-th segment.

If true, the segment is interpolated using cubic spline, otherwise it uses a linear function.

Definition at line 126 of file Curve.cpp.

◆ operator()()

Float Curve::operator() ( const Float  x) const

Evaluates the function and returns the result.

Definition at line 150 of file Curve.cpp.

◆ operator=()

Curve & Curve::operator= ( const Curve curve)

Definition at line 90 of file Curve.cpp.

◆ rangeX()

Interval Curve::rangeX ( ) const

Returns the extent of the curve in x-direction.

Definition at line 134 of file Curve.cpp.

◆ rangeY()

Interval Curve::rangeY ( ) const

Returns the extent of the curve in y-direction.

Definition at line 142 of file Curve.cpp.

◆ setPoint()

void Curve::setPoint ( const Size  idx,
const CurvePoint newPoint 
)

Modifies the position of idx-th points.

Definition at line 103 of file Curve.cpp.

◆ setSegment()

void Curve::setSegment ( const Size  idx,
const bool  cubic 
)

Modifies the interpolation type of idx-th segment.

Definition at line 130 of file Curve.cpp.


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