37,436 Pages

Template documentation (for the template shown above, sometimes hidden or invisible)

## Contents

Template interface for the evaluate function in Module:CurveTable.

A curve table is a collection of coordinates that form a series of consecutive line pieces. The parts between the given coordinates are linear. This template calculates the of a given in a given curve table.

## Usage

`{{CurveTable|coordinates|value}}`

### Parameters

<unnamed 1>
A series of points in the curve table. Each point must be denoted as `x,y` (where `x` and `y` are numerical) (without a space after the comma) and points are separated by a single whitespace. At least one point must be given.
<unnamed 2>
The value to evaluate in the given curve table.
round
Sets the rounding mode for the returned value(s). Not giving this parameter or giving an empty string results in no rounding. Recognized rounding modes are:
• ceil
• trunc

## Examples

Description Wikicode Expected result Actual result
Single point, evaluate at this point `{{CurveTable|4,3|4}}` 3 3
Single point, evaluate before this point `{{CurveTable|4,3|3}}` 3 3
Single point, evaluate at negative index `{{CurveTable|4,3|-6}}` 3 3
Two points, evaluate on second point `{{CurveTable|3,5 7,9|7}}` 9 9
Two points, evaluate in between points `{{CurveTable|3,5 7,9|5}}` 7 7
Two points, evaluate before first point `{{CurveTable|3,5 7,9|1}}` 3 3
Two points, evaluate after last point `{{CurveTable|3,5 7,9|11}}` 13 13
Three points, evaluate in between first two points `{{CurveTable|4,10 12,14 20,22|8}}` 12 12
Three points, evaluate in between last two points `{{CurveTable|4,10 12,14 20,22|16}}` 18 18
Three points, evaluate before first two points `{{CurveTable|4,10 12,14 20,22|0}}` 8 8
Three points, evaluate after last two points `{{CurveTable|4,10 12,14 20,22|24}}` 26 26
Does no rounding by default `{{CurveTable|0,0 2,1|-1|1}}` -0.5-0.5 -0.5
Ceil rounds towards infinity `{{CurveTable|0,0 2,1|-1|1|round=ceil}}` -0-1 -0
Floor rounds towards negative infinity `{{CurveTable|0,0 2,1|-1|1|round=floor}}` -1-0 -1
Trunc rounds towards zero `{{CurveTable|0,0 2,1|-1|1|round=trunc}}` 0-0 0
Nearest rounds towards infinity `{{CurveTable|0,0 2,1|-1|1|round=nearest}}` 0-1 0
Documentation transcluded from Template:CurveTable/doc.
Community content is available under CC-BY-SA unless otherwise noted.