data class LinearFunction: UnivariateFunction

Linear function of the form f(x) = slope * x + intercept.

Fields

Name Description
val slope: Double

slope of linear function

val intercept: Double

intercept at f(0)

val domain: Range<Double>

defined domain for the function

Constructors

<init>

constructor(slope: Double, intercept: Double, domain: Range<Double>)

Linear function of the form f(x) = slope * x + intercept.

Parameters

Name Description
slope: Double

slope of linear function

intercept: Double

intercept at f(0)

domain: Range<Double>

defined domain for the function

CompanionObject

LinearFunction

data class LinearFunction: UnivariateFunction

Linear function of the form f(x) = slope * x + intercept.

Fields

Name Description
val X_AXIS: LinearFunction

Linear function representing the x axis.

Methods

ofInclusiveYValuesAndUnitSlope

fun ofInclusiveYValuesAndUnitSlope(intercept: Double, pointY: Double): LinearFunction

Returns a linear function starting at (0.0, intercept) and stopping at (pointY - intercept , pointY) with a slope of 1.0 and a closed parameter range.

Parameters

Name Description
intercept: Double

linear function starting at (0.0, intercept)

pointY: Double

linear function stopping at (pointY - intercept , pointY)

ReturnValue

Name Description
LinearFunction

ofInclusiveInterceptAndPoint

fun ofInclusiveInterceptAndPoint(intercept: Double, pointX: Double, pointY: Double): LinearFunction

Returns a linear function constructed by (0.0, intercept) and (pointX, pointY) within a closed parameter range.

Parameters

Name Description
intercept: Double

linear function starting at (0.0, intercept)

pointX: Double

linear function stopping at (pointX, pointY)

pointY: Double

linear function stopping at (pointX, pointY)

ReturnValue

Name Description
LinearFunction

ofInclusiveInterceptAndPointWithoutNaN

fun ofInclusiveInterceptAndPointWithoutNaN(intercept: Double, pointX: Double, pointY: Double): LinearFunction

Returns a linear function by (0.0, intercept) and (pointX, pointY) within a closed parameter range. If the intercept or the pointY is not finite (e.g. NaN), the respective other value is used.

Parameters

Name Description
intercept: Double

linear function starting at (0.0, intercept)

pointX: Double

linear function stopping at (pointX, pointY)

pointY: Double

linear function stopping at (pointX, pointY)

ReturnValue

Name Description
LinearFunction

ofInclusivePoints

fun ofInclusivePoints(point1X: Double, point1Y: Double, point2X: Double, point2Y: Double): LinearFunction

Returns a linear function constructed by (point1X, point1Y) and (point2X, point2Y) within a closed parameter range.

Parameters

Name Description
point1X: Double

x value of starting point

point1Y: Double

y value of starting point

point2X: Double

x value of stopping point

point2Y: Double

y value of stopping point

ReturnValue

Name Description
LinearFunction

linear function with inclusive starting and stopping points

Extensions

ofSpiralCurvature

fun LinearFunction.Companion.ofSpiralCurvature(curvatureStart: Double, curvatureEnd: Double, length: Double): LinearFunction

Receiver

Name Description
LinearFunction.Companion

Parameters

Name Description
curvatureStart: Double
curvatureEnd: Double
length: Double

ReturnValue

Name Description
LinearFunction