Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v3.1.0-beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
kjerandp committed Feb 21, 2023
2 parents b5fa3b9 + 32dd240 commit f7c49f4
Show file tree
Hide file tree
Showing 90 changed files with 6,452 additions and 3,906 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ node_modules
test
testfiles
dist
**.spec.ts

2 changes: 1 addition & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extension": ["ts"],
"spec": "test/**/*.spec.ts",
"spec": "src/**/*.spec.ts",
"require": "ts-node/register"
}
25 changes: 0 additions & 25 deletions .vscode/launch.json

This file was deleted.

9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const points = [
...
];

const interp = new CurveInterpolator(points, { tension: 0.2 });
const interp = new CurveInterpolator(points, { tension: 0.2, alpha: 0.5 });

// get single point
const position = 0.3 // [0 - 1]
Expand All @@ -45,23 +45,22 @@ const pts = interp.getPoints(segments);

// lookup values along x and y axises
const axis = 1;
const yintersects = interp.lookup(7, axis);
const yintersects = interp.getIntersects(7, axis);

/*
max number of solutions (0 = all (default), 1 = first, -1 = last)
A negative max value counts solutions from end of curve
*/
const axis = 0;
const max = -1;
const xintersects = interp.lookup(3.2, axis, max);
const xintersects = interp.getIntersects(3.2, axis, max);

// get bounding box
const bbox = interp.getBoundingBox();
```

Online example on ObservableHQ:
- https://observablehq.com/@kjerandp/curveinterpolator-v2
- https://observablehq.com/@kjerandp/curve-interpolator-v1
- https://observablehq.com/@kjerandp/curve-interpolator-demo

## Docs
Docs are generated using typedoc in `./docs`. To create:
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/search.js

Large diffs are not rendered by default.

920 changes: 752 additions & 168 deletions docs/classes/CurveInterpolator.html

Large diffs are not rendered by default.

797 changes: 0 additions & 797 deletions docs/classes/CurveInterpolator2D.html

This file was deleted.

436 changes: 436 additions & 0 deletions docs/classes/LinearCurveMapper.html

Large diffs are not rendered by default.

534 changes: 534 additions & 0 deletions docs/classes/NumericalCurveMapper.html

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions docs/classes/Point.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h4>Hierarchy</h4>
<ul class="tsd-hierarchy">
<li><span class="target">Point</span></li></ul></section><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/6ce0bfa/src/point.ts#L6">point.ts:6</a></li></ul></aside>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/9dcc271/src/core/point.ts#L6">core/point.ts:6</a></li></ul></aside>
<section class="tsd-panel-group tsd-index-group">
<section class="tsd-panel tsd-index-panel">
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
Expand Down Expand Up @@ -74,29 +74,29 @@ <h5>z: <span class="tsd-signature-type">number</span><span class="tsd-signature-
<h5>w: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = null</span></h5></li></ul></div>
<h4 class="tsd-returns-title">Returns <a href="Point.html" class="tsd-signature-type" data-tsd-kind="Class">Point</a></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/6ce0bfa/src/point.ts#L12">point.ts:12</a></li></ul></aside></li></ul></section></section>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/9dcc271/src/core/point.ts#L12">core/point.ts:12</a></li></ul></aside></li></ul></section></section>
<section class="tsd-panel-group tsd-member-group">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="w" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>w</span><a href="#w" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature">w<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/6ce0bfa/src/point.ts#L10">point.ts:10</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/9dcc271/src/core/point.ts#L10">core/point.ts:10</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="x" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>x</span><a href="#x" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature">x<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/6ce0bfa/src/point.ts#L7">point.ts:7</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/9dcc271/src/core/point.ts#L7">core/point.ts:7</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="y" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>y</span><a href="#y" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature">y<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/6ce0bfa/src/point.ts#L8">point.ts:8</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/9dcc271/src/core/point.ts#L8">core/point.ts:8</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="z" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>z</span><a href="#z" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature">z<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/6ce0bfa/src/point.ts#L9">point.ts:9</a></li></ul></aside></section></section>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/9dcc271/src/core/point.ts#L9">core/point.ts:9</a></li></ul></aside></section></section>
<section class="tsd-panel-group tsd-member-group">
<h2>Accessors</h2>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"><a id="0" class="tsd-anchor"></a>
Expand All @@ -106,7 +106,7 @@ <h3 class="tsd-anchor-link"><span>0</span><a href="#0" aria-label="Permalink" cl
<li class="tsd-description">
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/6ce0bfa/src/point.ts#L19">point.ts:19</a></li></ul></aside></li>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/9dcc271/src/core/point.ts#L19">core/point.ts:19</a></li></ul></aside></li>
<li class="tsd-signature" id="0.0-2"><span class="tsd-signature-symbol">set</span> 0<span class="tsd-signature-symbol">(</span>x<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
<li class="tsd-description">
<div class="tsd-parameters">
Expand All @@ -116,15 +116,15 @@ <h4 class="tsd-parameters-title">Parameters</h4>
<h5>x: <span class="tsd-signature-type">number</span></h5></li></ul></div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/6ce0bfa/src/point.ts#L23">point.ts:23</a></li></ul></aside></li></ul></section>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/9dcc271/src/core/point.ts#L23">core/point.ts:23</a></li></ul></aside></li></ul></section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"><a id="1" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>1</span><a href="#1" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<ul class="tsd-signatures tsd-kind-accessor tsd-parent-kind-class">
<li class="tsd-signature" id="1.1-1"><span class="tsd-signature-symbol">get</span> 1<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li>
<li class="tsd-description">
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/6ce0bfa/src/point.ts#L27">point.ts:27</a></li></ul></aside></li>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/9dcc271/src/core/point.ts#L27">core/point.ts:27</a></li></ul></aside></li>
<li class="tsd-signature" id="1.1-2"><span class="tsd-signature-symbol">set</span> 1<span class="tsd-signature-symbol">(</span>y<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
<li class="tsd-description">
<div class="tsd-parameters">
Expand All @@ -134,15 +134,15 @@ <h4 class="tsd-parameters-title">Parameters</h4>
<h5>y: <span class="tsd-signature-type">number</span></h5></li></ul></div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/6ce0bfa/src/point.ts#L31">point.ts:31</a></li></ul></aside></li></ul></section>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/9dcc271/src/core/point.ts#L31">core/point.ts:31</a></li></ul></aside></li></ul></section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"><a id="2" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>2</span><a href="#2" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<ul class="tsd-signatures tsd-kind-accessor tsd-parent-kind-class">
<li class="tsd-signature" id="2.2-1"><span class="tsd-signature-symbol">get</span> 2<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li>
<li class="tsd-description">
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/6ce0bfa/src/point.ts#L35">point.ts:35</a></li></ul></aside></li>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/9dcc271/src/core/point.ts#L35">core/point.ts:35</a></li></ul></aside></li>
<li class="tsd-signature" id="2.2-2"><span class="tsd-signature-symbol">set</span> 2<span class="tsd-signature-symbol">(</span>z<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
<li class="tsd-description">
<div class="tsd-parameters">
Expand All @@ -152,15 +152,15 @@ <h4 class="tsd-parameters-title">Parameters</h4>
<h5>z: <span class="tsd-signature-type">number</span></h5></li></ul></div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/6ce0bfa/src/point.ts#L39">point.ts:39</a></li></ul></aside></li></ul></section>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/9dcc271/src/core/point.ts#L39">core/point.ts:39</a></li></ul></aside></li></ul></section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"><a id="3" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>3</span><a href="#3" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<ul class="tsd-signatures tsd-kind-accessor tsd-parent-kind-class">
<li class="tsd-signature" id="3.3-1"><span class="tsd-signature-symbol">get</span> 3<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li>
<li class="tsd-description">
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/6ce0bfa/src/point.ts#L43">point.ts:43</a></li></ul></aside></li>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/9dcc271/src/core/point.ts#L43">core/point.ts:43</a></li></ul></aside></li>
<li class="tsd-signature" id="3.3-2"><span class="tsd-signature-symbol">set</span> 3<span class="tsd-signature-symbol">(</span>w<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
<li class="tsd-description">
<div class="tsd-parameters">
Expand All @@ -170,15 +170,15 @@ <h4 class="tsd-parameters-title">Parameters</h4>
<h5>w: <span class="tsd-signature-type">number</span></h5></li></ul></div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/6ce0bfa/src/point.ts#L47">point.ts:47</a></li></ul></aside></li></ul></section>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/9dcc271/src/core/point.ts#L47">core/point.ts:47</a></li></ul></aside></li></ul></section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"><a id="length" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>length</span><a href="#length" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<ul class="tsd-signatures tsd-kind-accessor tsd-parent-kind-class">
<li class="tsd-signature" id="length.length-1"><span class="tsd-signature-symbol">get</span> length<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li>
<li class="tsd-description">
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/6ce0bfa/src/point.ts#L51">point.ts:51</a></li></ul></aside></li></ul></section></section></div>
<li>Defined in <a href="https://github.com/kjerandp/curve-interpolator/blob/9dcc271/src/core/point.ts#L51">core/point.ts:51</a></li></ul></aside></li></ul></section></section></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<div class="tsd-navigation settings">
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
Expand Down
Loading

0 comments on commit f7c49f4

Please sign in to comment.