knot

package
Version: v0.0.0-...-f5958bd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2019 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArbitraryKnotBuilder

type ArbitraryKnotBuilder struct {
	// contains filtered or unexported fields
}

func NewArbitraryKnotBuilder

func NewArbitraryKnotBuilder(paddingCount int, knots ...float64) *ArbitraryKnotBuilder

NewArbitraryKnotBuilder Create an arbitrary knot with this

func (*ArbitraryKnotBuilder) Append

func (*ArbitraryKnotBuilder) Build

func (b *ArbitraryKnotBuilder) Build() Knot

type Knot

type Knot interface {
	// Len
	// Total length of the knots, including paddings
	Len() int
	// Padding
	// How many paddings are on each end?
	Padding() int
	// Count
	// Length of the knots without paddings
	Count() int

	// Will return value considering padding, i.e. if padding = 4, then At(0) = Knot[4]
	At(idx int) float64
	// Will return value considering padding, i.e. if padding = 4, then Index(0.0) = 0
	Index(x float64) int
	String() string

	IsSorted() bool
	IsUnique() bool
}

Knot Definition of Knot

Knot := {k_0 < k_1 < k_2 < ... < k_count}

For example, if [0, 1] with interval of 0.1, then the knots are

Knot = {0, 0.1, 0.2, ... , 0.9, 1.0}

So, for valid calculation at the both ends, additional padding should be appended i.e. if we need y = spline(1.0), then the knots should be

Knot = {0, 0.1, 0.2, ... , 0.9, 1.0, 1.1}
since B-Splines are defined on [k_i, k_(i+1)).

If padding is included, then we interpret knots as:

k_-p, k_(-p+1), ... , k_-1, k_0, k_1, ... , k_count, k_(count+1), ... , k_(count+p)
--------------------------  ^^^^^^^^^^^^^^^^^^^^^^^  ------------------------------
        PADDINGS                    KNOTS                       PADDINGS

func NewUniformKnot

func NewUniformKnot(start, end float64, count, paddings int) Knot

NewUniformKnot Creates a new Knot with uniform intervals

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL