affine2d

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 1 Imported by: 0

README

go-affine2d

PkgGoDev

Package affine2d implements 2D affine transformations.

License

MIT

Documentation

Overview

Package affine2d implements 2D affine transformations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Transform

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

A Transform is a 2D affine transform.

func Delta

func Delta(origin, unitX []float64) *Transform

Delta returns the transform that transforms the origin to origin and the unit X vector to unitX.

func Identity

func Identity() *Transform

Identity returns a new identity transform.

func NewTransform

func NewTransform(m [6]float64) *Transform

NewTransform returns a new transform with the given coefficients.

func Rotate

func Rotate(theta float64) *Transform

Rotate returns a new rotate transform.

func Scale

func Scale(sx, sy float64) *Transform

Scale returns a new scale transform.

func Shear

func Shear(sx, sy float64) *Transform

Shear returns a new shear transform.

func Translate

func Translate(tx, ty float64) *Transform

Translate returns a new translate transform.

func (*Transform) Float64Array

func (t *Transform) Float64Array() [6]float64

Float64Array returns the coefficients of t's matrix in row order.

func (*Transform) Float64Slice

func (t *Transform) Float64Slice() []float64

Float64Slice returns the coefficients of t's matrix in row order. The returned slice must not be modified.

func (*Transform) Inverse

func (t *Transform) Inverse() *Transform

func (*Transform) Multiply

func (t *Transform) Multiply(u *Transform) *Transform

Multiply returns a new transform which is u then t.

func (*Transform) Rotate

func (t *Transform) Rotate(theta float64) *Transform

Rotate returns a new transform which is t then a rotation.

func (*Transform) Scale

func (t *Transform) Scale(sx, sy float64) *Transform

Scale returns a new transform which is t then a scale.

func (*Transform) Then

func (t *Transform) Then(u *Transform) *Transform

Then returns a transform that is t then u.

func (*Transform) Transform

func (t *Transform) Transform(p []float64) []float64

Transform transforms a single vector.

func (*Transform) TransformDirection

func (t *Transform) TransformDirection(v []float64) []float64

TransformDirection transforms the direction v.

func (*Transform) TransformInPlace added in v0.0.2

func (t *Transform) TransformInPlace(p []float64) []float64

TransformInPlace transforms a single vector in place.

func (*Transform) TransformSlice

func (t *Transform) TransformSlice(ps [][]float64) [][]float64

TransformSlice transforms a slice of vectors.

func (*Transform) TransformSliceInPlace added in v0.0.2

func (t *Transform) TransformSliceInPlace(ps [][]float64) [][]float64

TransformSliceInPlace transforms a slice of vectors in place.

func (*Transform) TransformXY

func (t *Transform) TransformXY(x, y float64) (float64, float64)

TransformXY transforms an X-Y coordinate.

func (*Transform) Translate

func (t *Transform) Translate(tx, ty float64) *Transform

Translate returns a new transform which is t then a translate.

Jump to

Keyboard shortcuts

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