Added LowPassFilter and support for smooth scatter rotation and zoom.
This commit is contained in:
@@ -132,6 +132,27 @@ is compatible with arrays of absolute points.
|
||||
context.stroke()
|
||||
|
||||
</script>
|
||||
<h2>
|
||||
Low Pass Filter
|
||||
</h2>
|
||||
<p>
|
||||
Low Pass Filter muffles fast (high-frequency) changes to the signal.
|
||||
For more information visit the <a href="http://en.wikipedia.org/wiki/Low-pass_filter">wikipedia article</a>.
|
||||
</p>
|
||||
<script class="doctest">
|
||||
let lpf = new LowPassFilter(0.5)
|
||||
Doctest.expect(lpf.smoothArray([10,8,9,10,12,8,50,10,12,8]), [10,9,9,10,11,9,30,20,16,12])
|
||||
|
||||
Doctest.expect(lpf.next(20), 10.0)
|
||||
Doctest.expect(lpf.next(20), 12.5)
|
||||
Doctest.expect(lpf.next(20), 14.375)
|
||||
Doctest.expect(lpf.next(20), 15.78125)
|
||||
|
||||
lpf = new LowPassFilter(0.2)
|
||||
lpf.setup([10,10,10,10,10,10,10,10,10,10])
|
||||
Doctest.expect(lpf.next(20), 12.0)
|
||||
Doctest.expect(lpf.next(10), 10.32)
|
||||
</script>
|
||||
<h2>
|
||||
References
|
||||
</h2>
|
||||
|
||||
Reference in New Issue
Block a user