Documentation ¶
Overview ¶
Package f64 provides float64 operations for all listed vectors, as well as interpolation.
Index ¶
- Variables
- func Grid2DPositions(min, stride, max Vec2) <-chan Vec2
- type Function2D
- type Vec2
- func (v Vec2) Abs() (res Vec2)
- func (v Vec2) Add(o Vec2) (res Vec2)
- func (v *Vec2) At(dim int) float64
- func (v Vec2) Div(s float64) Vec2
- func (v Vec2) Dot(o Vec2) (d float64)
- func (v Vec2) Eq(o Vec2) bool
- func (v *Vec2) Get() []float64
- func (v Vec2) Inv() (res Vec2)
- func (v Vec2) Mag() float64
- func (v Vec2) Mul(s float64) (res Vec2)
- func (v Vec2) MulV(o Vec2) (res Vec2)
- func (v Vec2) Neg() Vec2
- func (v *Vec2) Set(vs ...float64)
- func (v Vec2) Sub(o Vec2) Vec2
- func (v Vec2) Unit() Vec2
- func (v *Vec2) Vec2() Vec2
- func (v *Vec2) Vec3() Vec3
- func (v *Vec2) Vec4() Vec4
- func (v *Vec2) VecN() VecN
- func (v Vec2) Within(o Vec2) bool
- type Vec3
- func (v Vec3) Abs() (res Vec3)
- func (v Vec3) Add(o Vec3) (res Vec3)
- func (v *Vec3) At(dim int) float64
- func (v Vec3) Cross(b Vec3) Vec3
- func (v Vec3) Div(s float64) Vec3
- func (v Vec3) Dot(o Vec3) (d float64)
- func (v Vec3) Eq(o Vec3) bool
- func (v *Vec3) Get() []float64
- func (v Vec3) Inv() (res Vec3)
- func (v Vec3) Mag() float64
- func (v Vec3) Mul(s float64) (res Vec3)
- func (v Vec3) MulV(o Vec3) (res Vec3)
- func (v Vec3) Neg() Vec3
- func (v *Vec3) Set(vs ...float64)
- func (v Vec3) Sub(o Vec3) Vec3
- func (v Vec3) Unit() Vec3
- func (v *Vec3) Vec2() Vec2
- func (v *Vec3) Vec3() Vec3
- func (v *Vec3) Vec4() Vec4
- func (v *Vec3) VecN() VecN
- func (v Vec3) Within(o Vec3) bool
- type Vec4
- func (v Vec4) Abs() (res Vec4)
- func (v Vec4) Add(o Vec4) (res Vec4)
- func (v *Vec4) At(dim int) float64
- func (v Vec4) Div(s float64) Vec4
- func (v Vec4) Dot(o Vec4) (d float64)
- func (v Vec4) Eq(o Vec4) bool
- func (v *Vec4) Get() []float64
- func (v Vec4) Inv() (res Vec4)
- func (v Vec4) Mag() float64
- func (v Vec4) Mul(s float64) (res Vec4)
- func (v Vec4) MulV(o Vec4) (res Vec4)
- func (v Vec4) Neg() Vec4
- func (v *Vec4) Set(vs ...float64)
- func (v Vec4) Sub(o Vec4) Vec4
- func (v Vec4) Unit() Vec4
- func (v *Vec4) Vec2() Vec2
- func (v *Vec4) Vec3() Vec3
- func (v *Vec4) Vec4() Vec4
- func (v *Vec4) VecN() VecN
- func (v Vec4) Within(o Vec4) bool
- type VecC
- type VecN
- func (v VecN) Abs() (res VecN)
- func (v VecN) Add(o VecN) (res VecN)
- func (v *VecN) At(dim int) float64
- func (v VecN) Div(s float64) VecN
- func (v VecN) Dot(o VecN) (d float64)
- func (v VecN) Eq(o VecN) bool
- func (v *VecN) Get() []float64
- func (v VecN) Inv() (res VecN)
- func (v VecN) Mag() float64
- func (v VecN) Mul(s float64) (res VecN)
- func (v VecN) MulV(o VecN) (res VecN)
- func (v VecN) Neg() VecN
- func (v *VecN) Set(vs ...float64)
- func (v VecN) Sub(o VecN) VecN
- func (v VecN) Unit() VecN
- func (v *VecN) Vec2() Vec2
- func (v *VecN) Vec3() Vec3
- func (v *VecN) Vec4() Vec4
- func (v *VecN) VecN() VecN
- func (v VecN) Within(o VecN) bool
- type VecS
- func (v VecS) Abs() (res VecS)
- func (v VecS) Add(o VecS) (res VecS)
- func (v *VecS) At(dim string) float64
- func (v VecS) Div(s float64) VecS
- func (v VecS) Dot(o VecS) (d float64)
- func (v VecS) Eq(o VecS) bool
- func (v VecS) Inv() (res VecS)
- func (v VecS) Mag() float64
- func (v VecS) Mul(s float64) (res VecS)
- func (v VecS) MulV(o VecS) (res VecS)
- func (v VecS) Neg() VecS
- func (v VecS) Sub(o VecS) VecS
- func (v VecS) Unit() VecS
- func (v VecS) Within(o VecS) bool
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBadGrid is returned if the samples given don't form a grid ErrBadGrid = errors.New("provided samples do not form a grid") // ErrBadCoord is returned if you interpolate coords outside of the sample range ErrBadCoord = errors.New("provided coordinate is outside of the sample range") // ErrNotEnough is returned if less than 9 samples are provided ErrNotEnough = errors.New("need to provide at least 9 samples") )
Functions ¶
func Grid2DPositions ¶
Grid2DPositions returns a channel of 2d positions across the defined grid.
Types ¶
type Function2D ¶
Interpolator2D is an interpolation method created using a set of samples and an interpolation algorithm.
func Grid2D ¶
func Grid2D(samples []Vec3, filter filters.GridFilter) (Function2D, error)
Grid2D creates a 2D grid-based interpolator using the provided filter. The Z axis of a sample is the value that will be interpolated.
func MicroSphere2D ¶
func MicroSphere2D(samples []Vec3) Function2D
MicroSphere2D is a 2D interpolator that uses microsphere projection to interpolate over non grid-aligned samples. The Z axis of the samples is the value that will be interpolated.
func (Function2D) Fallback ¶
func (interp Function2D) Fallback(next Function2D) Function2D
Fallback allows you to create a new interpolator that will use the interpolation from next if the interpolation from interp fails.
func (Function2D) Multi ¶
func (interp Function2D) Multi(positions <-chan Vec2) <-chan Vec3
Multi takes a channel of positions and returns a channel of results. Ordering is not guaranteed, and the result channel will be closed when all incoming positions have been processed. Only valid positions will be returned on the channel.
type Vec2 ¶
type Vec2 [2]float64
Vec2 is a 2-dimentional float64 vector
type Vec3 ¶
type Vec3 [3]float64
Vec3 is a 3-dimentional float64 vector
type Vec4 ¶
type Vec4 [4]float64
Vec4 is a 4-dimentional float64 vector
type VecC ¶
type VecC interface { At(dim int) float64 Get() []float64 Set(vs ...float64) Vec2() Vec2 Vec3() Vec3 Vec4() Vec4 VecN() VecN }
VecC provides a dimensionless interface for all cartesian vecs.
type VecN ¶
type VecN []float64
VecN is an n-dimentional float64 vector