All Projects → sgreben → piecewiselinear

sgreben / piecewiselinear

Licence: MIT license
tiny linear interpolation library for go (factored out from https://github.com/sgreben/yeetgif)

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to piecewiselinear

Fsharp.domain.validation
Designing with types requires a lot of code - this library fixes that
Stars: ✭ 119 (+417.39%)
Mutual labels:  tiny
Webpack Nano
A teensy, squeaky 🐤 clean Webpack CLI
Stars: ✭ 199 (+765.22%)
Mutual labels:  tiny
htcc
🐤 A tiny C language compiler (x86-64) (WIP)
Stars: ✭ 31 (+34.78%)
Mutual labels:  tiny
Vue Final Modal
🍕Vue Final Modal is a tiny, renderless, mobile-friendly, feature-rich modal component for Vue.js.
Stars: ✭ 128 (+456.52%)
Mutual labels:  tiny
Graceful Server
Tiny (~5k), KISS, dependency-free Node.JS library to make your API more graceful
Stars: ✭ 173 (+652.17%)
Mutual labels:  tiny
Huejumper2k
2 Kilobyte 3D racing game in JavaScript
Stars: ✭ 236 (+926.09%)
Mutual labels:  tiny
React Plain Router
🛣 A 2kb React router that works exactly as expected with native Javascript
Stars: ✭ 119 (+417.39%)
Mutual labels:  tiny
lvg
Lion Vector Graphics
Stars: ✭ 106 (+360.87%)
Mutual labels:  tiny
Pristine
Vanilla javascript form validation micro-library
Stars: ✭ 197 (+756.52%)
Mutual labels:  tiny
Tic 80
TIC-80 is a fantasy computer for making, playing and sharing tiny games.
Stars: ✭ 3,176 (+13708.7%)
Mutual labels:  tiny
Busker
An extremely simple web framework.
Stars: ✭ 161 (+600%)
Mutual labels:  tiny
Bahunya
10KB classless CSS framework with responsive typography, navbar, syntax highlighting, etc.
Stars: ✭ 170 (+639.13%)
Mutual labels:  tiny
Cwebsocket
cWebsocket is lightweight websocket server library
Stars: ✭ 241 (+947.83%)
Mutual labels:  tiny
Scoped Style
A tiny css in js library 🚀
Stars: ✭ 129 (+460.87%)
Mutual labels:  tiny
tinyusd
A really small getting-started project for USD on Windows.
Stars: ✭ 29 (+26.09%)
Mutual labels:  tiny
Tiny Renderer
A tiny sotfware 3D renderer in 100 lines of Python
Stars: ✭ 120 (+421.74%)
Mutual labels:  tiny
Tinycreditcard
A clear and animated credit card input workflow implement
Stars: ✭ 236 (+926.09%)
Mutual labels:  tiny
CalDOM
An agnostic, reactive & minimalist (3kb) JavaScript UI library with direct access to native DOM.
Stars: ✭ 176 (+665.22%)
Mutual labels:  tiny
tiny httpd
Minimal HTTP server using good old threads + blocking IO, with a small request router.
Stars: ✭ 64 (+178.26%)
Mutual labels:  tiny
Just
A library of dependency-free JavaScript functions that do just do one thing.
Stars: ✭ 3,837 (+16582.61%)
Mutual labels:  tiny

piecewiselinear

gocover.io Build

A tiny library for linear interpolation. O(log(N)) per evaluation for N control points.

import "github.com/sgreben/piecewiselinear"

Get it

go get -u "github.com/sgreben/piecewiselinear"

Use it

import "github.com/sgreben/piecewiselinear"

func main() {
    f := piecewiselinear.Function{Y:[]float64{0,1,0}} // range: "hat" function
    f.X = piecewiselinear.Span(0, 1, len(f.Y)) // domain: equidistant points along X axis
    fmt.Println(
		f.At(0), // f.At(x) evaluates f at x
		f.At(0.25),
		f.At(0.5),
		f.At(0.75),
		f.At(1.0),
		f.At(123.0),  // outside its domain X the function is constant 0
		f.At(-123.0), //
	)
    // Output:
    // 0 0.5 1 0.5 0 0 0
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].