Documentation ¶
Index ¶
- Variables
- func MinMax(pts ...Pt) (Pt, Pt)
- type AssertV1
- type Chain
- type D2
- type Limit
- type Limiter
- type Point
- type Polar
- type Pt
- func (pt Pt) Add(v V) Pt
- func (pt Pt) Angle() angle.Rad
- func (pt Pt) AssertEqual(actual interface{}, t cmpr.Tolerance) error
- func (pt Pt) Distance(pt2 Pt) float64
- func (pt Pt) Mag() float64
- func (pt Pt) Mag2() float64
- func (pt Pt) Multiply(scale float64) Pt
- func (pt Pt) Polar() Polar
- func (pt Pt) Pt() Pt
- func (pt Pt) String() string
- func (pt Pt) Subtract(pt2 Pt) V
- func (pt Pt) V() V
- type Pt1
- type Pt1V1
- type Pt1c0
- type Pt2
- type Pt2c1
- type Pt2c1Wrapper
- type Rotate
- type Scale
- type T
- type T0Wrapper
- type TGen
- type TransformSet
- type Translate
- type V
- func (v V) Abs() V
- func (v V) Add(v2 V) V
- func (v V) Angle() angle.Rad
- func (v V) AssertEqual(actual interface{}, t cmpr.Tolerance) error
- func (v V) Cross(v2 V) float64
- func (v V) Dot(v2 V) float64
- func (v V) Mag() float64
- func (v V) Mag2() float64
- func (v V) Multiply(scale float64) V
- func (v V) Polar() Polar
- func (v V) Product(v2 V) V
- func (v V) Pt() Pt
- func (v V) String() string
- func (v V) Subtract(v2 V) V
- func (v V) V() V
- type V1
- type V1Wrapper
- type V1c0
- type VLimiter
- type Vector
Constants ¶
This section is empty.
Variables ¶
var Prec = 4
Prec is the precision for the String method on F
Functions ¶
Types ¶
type AssertV1 ¶
type AssertV1 struct{}
AssertV1 checks that the derivative is close the derivative approximation. A good base check that an algorithm isn't completely wrong.
type Chain ¶
type Chain []TGen
Chain combines multiple TGens into one
func (Chain) Pair ¶
Pair calls pair on all the TGen in the chain and computes both the transform and it's inverse.
type D2 ¶
type D2 struct {
X, Y float64
}
D2 is an abstract two dimensional struct holding the methods shared by both Pt and V.
type Limit ¶
type Limit byte
Limit is used to indicate if a parametric method is bounded to [0,1] or unbounded
const ( // LimitUndefined indicates that the requested parametric method is not // defined. LimitUndefined Limit = iota // LimitBounded indicates that the behavior of a parametric funnction // outside the range [0,1] is not defined. LimitBounded // LimitUnbounded indicates that passing parametric values outside the range // [0,1] should behave predictibly. LimitUnbounded )
type Polar ¶
Polar is an abstract D2 using polar coordinates. It can be useful for defining Pt or V values.
type Pt ¶
type Pt D2
Pt represets a two dimensional point.
func (Pt) AssertEqual ¶
AssertEqual fulfils geomtest.AssertEqualizer
func (Pt) Mag2 ¶
Mag2 returns the square of the magnitude. For comparisions this can be more efficient as it avoids a sqrt call.
type Pt1V1 ¶
Pt1V1 has one argument parametric methods for both Pt1 and V1, typically this represents a curve and it's derivative.
type Pt1c0 ¶
type Pt1c0 interface {
Pt1c0() Pt1
}
Pt1c0 returns a Pt1, it may cache some computation to optimize future calls to Pt1
type Pt2c1Wrapper ¶
type Pt2c1Wrapper struct {
Pt2
}
Pt2c1Wrapper wraps any Pt2 to convert it to a Pt2c1
func (Pt2c1Wrapper) Pt2c1 ¶
func (pt2c1 Pt2c1Wrapper) Pt2c1(t0 float64) Pt1
Pt2c1 curries the first argument using a T0Wrapper
type Rotate ¶
Rotate generates a rotation transform
type T ¶
type T [3][3]float64
T represets a transform matrix
func IndentityTransform ¶
func IndentityTransform() *T
IndentityTransform returns an Identity matrix
func (*T) AssertEqual ¶
AssertEqual fulfils geomtest.AssertEqualizer
type TGen ¶
TGen is a Transform generator. If both the T and it's inverse are needed, Pair may reduce some duplicate calculations.
type TransformSet ¶
type TransformSet struct {
Head, Middle, Tail []*T
}
TransformSet builds up a chain of transformaitions.
func (*TransformSet) AddBoth ¶
func (ts *TransformSet) AddBoth(t TGen) *TransformSet
AddBoth appends the transform and it's inverse to the head and tail.
func (*TransformSet) GetT ¶
func (ts *TransformSet) GetT() *T
Get produces a transform produces a transform by applying the transforms in head, then middle then applying tail in reverse.
type Translate ¶
type Translate V
Translate generates a translation transform
type V ¶
type V D2
V represents a Vector, the difference between two points.
func (V) AssertEqual ¶
AssertEqual fulfils geomtest.AssertEqualizer
func (V) Mag2 ¶
Mag2 returns the square magnitude of the vector. This can be useful for comparisons to avoid the additional cost of a Sqrt call.
type V1Wrapper ¶
V1Wrapper takes any Pt1 and approximates V1
type V1c0 ¶
type V1c0 interface {
V1c0() V1
}
V1c0 returns a V1, it may cache some computation to optimize future callse to V1