d3

package
v0.0.0-...-c743823 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Prec = 4

Prec is the precision for the String method on F

Functions

This section is empty.

Types

type D3

type D3 struct {
	X, Y, Z float64
}

func (D3) Mag

func (d D3) Mag() float64

func (D3) Mag2

func (d D3) Mag2() float64

func (D3) String

func (d D3) String() string

type Point

type Point interface {
	Pt() Pt
}

type Pt

type Pt D3

func (Pt) Add

func (pt Pt) Add(v V) Pt

func (Pt) Distance

func (pt Pt) Distance(pt2 Pt) float64

Distance returns the distance between to points

func (Pt) Mag

func (pt Pt) Mag() float64

func (Pt) Mag2

func (pt Pt) Mag2() float64

func (Pt) Multiply

func (pt Pt) Multiply(scale float64) Pt

func (Pt) Pt

func (pt Pt) Pt() Pt

func (Pt) Round

func (pt Pt) Round() Pt

func (Pt) String

func (pt Pt) String() string

String fulfills Stringer, returns the vector as "(X, Y)"

func (Pt) Subtract

func (pt Pt) Subtract(pt2 Pt) V

type Pt1

type Pt1 interface {
	Pt1(t0 float64) Pt
}

type Pt2

type Pt2 interface {
	Pt2(t0, t1 float64) Pt
}

type Pt2c1

type Pt2c1 interface {
	Pt2(t0 float64) Pt1
}

type Q

type Q struct {
	A, B, C, D float64
}

Q is a quaternion used for rotations. B, C and D correspond to the X, Y and Z axis.

func QV

func QV(v V) Q

func QX

func QX(ang angle.Rad) Q

func QY

func QY(ang angle.Rad) Q

func QZ

func QZ(ang angle.Rad) Q

func (Q) Normalize

func (q Q) Normalize() Q

func (Q) Product

func (q Q) Product(q2 Q) Q

func (Q) String

func (q Q) String() string

func (Q) T

func (q Q) T() *T

func (Q) TInv

func (q Q) TInv() *T

type Rotation

type Rotation struct {
	Angle angle.Rad
	Plane RotationPlane
}

func (Rotation) Pair

func (r Rotation) Pair() [2]*T

func (Rotation) T

func (r Rotation) T() *T

func (Rotation) TInv

func (r Rotation) TInv() *T

type RotationPlane

type RotationPlane byte
const (
	XY RotationPlane = iota
	XZ
	YZ
)

type Scale

type Scale V

func ScaleF

func ScaleF(f float64) Scale

func (Scale) Pair

func (s Scale) Pair() [2]*T

Scale returns the scale transform represented by V and it's inverse

func (Scale) T

func (s Scale) T() *T

func (Scale) TInv

func (s Scale) TInv() *T

type T

type T [4][4]float64

func Identity

func Identity() *T

func TProd

func TProd(ts ...*T) *T

func (*T) Inversion

func (t *T) Inversion() (*T, bool)

func (*T) Pt

func (t *T) Pt(pt Pt) Pt

func (*T) PtF

func (t *T) PtF(pt Pt) (Pt, float64)

func (*T) PtScl

func (t *T) PtScl(pt Pt) Pt

func (*T) Pts

func (t *T) Pts(pts []Pt) []Pt

func (*T) PtsScl

func (t *T) PtsScl(pts []Pt) []Pt

func (T) String

func (t T) String() string

func (*T) T

func (t *T) T(t2 *T) *T

func (*T) V

func (t *T) V(v V) V

func (*T) VF

func (t *T) VF(v V) (V, float64)

type TGen

type TGen interface {
	T() *T
	TInv() *T
	Pair() [2]*T
}

type TransformSet

type TransformSet struct {
	Head, Middle, Tail []*T
}

func NewTSet

func NewTSet() *TransformSet

func (*TransformSet) Add

func (ts *TransformSet) Add(t *T) *TransformSet

func (*TransformSet) AddBoth

func (ts *TransformSet) AddBoth(t [2]*T) *TransformSet

func (*TransformSet) Get

func (ts *TransformSet) Get() *T

type Translate

type Translate V

func (Translate) Pair

func (t Translate) Pair() [2]*T

Translate returns the translate transform represented by V and it's inverse

func (Translate) T

func (t Translate) T() *T

func (Translate) TInv

func (t Translate) TInv() *T

type V

type V D3

V is a 3D vector.

func (V) Abs

func (v V) Abs() V

Abs returns a vector where all components are positive.

func (V) Add

func (v V) Add(v2 V) V

Add two vectors.

func (V) Ang

func (v V) Ang(v2 V) angle.Rad

Ang returns the angle between two vectors

func (V) Cross

func (v V) Cross(v2 V) V

Cross returns the cross product of the two vectors

func (V) Dot

func (v V) Dot(v2 V) float64

Dot returns the dot product of two vectors

func (V) Mag

func (v V) Mag() float64

Mag returns the magnitude (distance to origin) of the vector

func (V) Mag2

func (v V) Mag2() float64

Mag2 Returns the sqaure of the magnitude of the vector.

func (V) Multiply

func (v V) Multiply(scale float64) V

Multiply a vector by a scale.

func (V) Normal

func (v V) Normal() V

Normal returns a vector that has the same orientation but has a length of 1.

func (V) Project

func (v V) Project(v2 V) V

Project v2 onto v.

func (V) String

func (v V) String() string

String fulfills Stringer, returns the vector as "(X, Y)"

func (V) Subtract

func (v V) Subtract(v2 V) V

Subtract is the difference between two vectors.

func (V) V

func (v V) V() V

V is here to fulfill Vector interface.

type V1

type V1 interface {
	V1(t0 float64) V
}

type Vector

type Vector interface {
	V() V
}

Directories

Path Synopsis
Package affine allows for combinations of points where the sum of the coefficients is zero.
Package affine allows for combinations of points where the sum of the coefficients is zero.
curve
render
shape
cc

Jump to

Keyboard shortcuts

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