records

package
v0.0.0-...-cb98339 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const BezierCurveAngleTolerance = 0.4
View Source
const BezierCurveAngleToleranceEpsilon = 0.01
View Source
const BezierCurveCollinearityEpsilon = 1e-30
View Source
const BezierRecursionLimit = 32

Variables

This section is empty.

Functions

func CubicRecursiveBezier

func CubicRecursiveBezier(points []math.Vector2[float64], cuspLimit, angleTolerance, distanceToleranceSquare float64, v1, v2, v3, v4 math.Vector2[float64], level uint) []math.Vector2[float64]

CubicRecursiveBezier Converts a Cubic bezier curve into line segments

func QuadraticRecursiveBezier

func QuadraticRecursiveBezier(points []math.Vector2[float64], angleTolerance, distanceToleranceSquare float64, v1, v2, v3 math.Vector2[float64], level uint) []math.Vector2[float64]

QuadraticRecursiveBezier Converts a Quadratic bezier curve into line segments

Types

type CubicCurveRecord

type CubicCurveRecord struct {
	Control1, Control2 math2.Vector2[float64]
	Anchor             math2.Vector2[float64]
	Start              math2.Vector2[float64]
}

func CubicCurveFromQuadraticRecord

func CubicCurveFromQuadraticRecord(q QuadraticCurveRecord) CubicCurveRecord

func (CubicCurveRecord) ApplyMatrixTransform

func (r CubicCurveRecord) ApplyMatrixTransform(transform math2.MatrixTransform, applyTranslation bool) Record

func (CubicCurveRecord) BoundingBox

func (r CubicCurveRecord) BoundingBox() (topLeft, bottomRight math2.Vector2[float64])

func (CubicCurveRecord) Equals

func (r CubicCurveRecord) Equals(other Record) bool

func (CubicCurveRecord) GetEnd

func (r CubicCurveRecord) GetEnd() math2.Vector2[float64]

func (CubicCurveRecord) GetStart

func (r CubicCurveRecord) GetStart() math2.Vector2[float64]

func (CubicCurveRecord) IsFlat

func (r CubicCurveRecord) IsFlat() bool

func (CubicCurveRecord) Reverse

func (r CubicCurveRecord) Reverse() Record

func (CubicCurveRecord) SameType

func (r CubicCurveRecord) SameType(other Record) bool

func (CubicCurveRecord) String

func (r CubicCurveRecord) String() string

func (CubicCurveRecord) ToLineRecords

func (r CubicCurveRecord) ToLineRecords(scale int64) []Record

func (CubicCurveRecord) ToSingleQuadraticRecord

func (r CubicCurveRecord) ToSingleQuadraticRecord() (QuadraticCurveRecord, bool)

ToSingleQuadraticRecord Finds if Cubic curve is a perfect fit of a Quadratic curve (aka, it was upconverted)

type CubicSplineCurveRecord

type CubicSplineCurveRecord struct {
	Control []math.Vector2[float64]
	Anchor  math.Vector2[float64]
	Start   math.Vector2[float64]
}

func (CubicSplineCurveRecord) ApplyMatrixTransform

func (r CubicSplineCurveRecord) ApplyMatrixTransform(transform math.MatrixTransform, applyTranslation bool) Record

func (CubicSplineCurveRecord) BoundingBox

func (r CubicSplineCurveRecord) BoundingBox() (topLeft, bottomRight math.Vector2[float64])

func (CubicSplineCurveRecord) Equals

func (r CubicSplineCurveRecord) Equals(other Record) bool

func (CubicSplineCurveRecord) GetEnd

func (CubicSplineCurveRecord) GetStart

func (CubicSplineCurveRecord) IsFlat

func (r CubicSplineCurveRecord) IsFlat() bool

func (CubicSplineCurveRecord) Reverse

func (r CubicSplineCurveRecord) Reverse() Record

func (CubicSplineCurveRecord) SameType

func (r CubicSplineCurveRecord) SameType(other Record) bool

func (CubicSplineCurveRecord) String

func (r CubicSplineCurveRecord) String() string

type CurvedRecord

type CurvedRecord interface {
	Record
	ToLineRecords(scale int64) []Record
}

type LineRecord

type LineRecord struct {
	To, Start math.Vector2[float64]
}

func (LineRecord) ApplyMatrixTransform

func (r LineRecord) ApplyMatrixTransform(transform math.MatrixTransform, applyTranslation bool) Record

func (LineRecord) BoundingBox

func (r LineRecord) BoundingBox() (topLeft, bottomRight math.Vector2[float64])

func (LineRecord) Delta

func (r LineRecord) Delta() math.Vector2[float64]

func (LineRecord) Equals

func (r LineRecord) Equals(other Record) bool

func (LineRecord) GetEnd

func (r LineRecord) GetEnd() math.Vector2[float64]

func (LineRecord) GetStart

func (r LineRecord) GetStart() math.Vector2[float64]

func (LineRecord) IsFlat

func (r LineRecord) IsFlat() bool

func (LineRecord) Reverse

func (r LineRecord) Reverse() Record

func (LineRecord) SameType

func (r LineRecord) SameType(other Record) bool

func (LineRecord) String

func (r LineRecord) String() string

type MoveRecord

type MoveRecord struct {
	To, Start math.Vector2[float64]
}

func (MoveRecord) ApplyMatrixTransform

func (r MoveRecord) ApplyMatrixTransform(transform math.MatrixTransform, applyTranslation bool) Record

func (MoveRecord) BoundingBox

func (r MoveRecord) BoundingBox() (topLeft, bottomRight math.Vector2[float64])

func (MoveRecord) Equals

func (r MoveRecord) Equals(other Record) bool

func (MoveRecord) GetEnd

func (r MoveRecord) GetEnd() math.Vector2[float64]

func (MoveRecord) GetStart

func (r MoveRecord) GetStart() math.Vector2[float64]

func (MoveRecord) IsFlat

func (r MoveRecord) IsFlat() bool

func (MoveRecord) Reverse

func (r MoveRecord) Reverse() Record

func (MoveRecord) SameType

func (r MoveRecord) SameType(other Record) bool

func (MoveRecord) String

func (r MoveRecord) String() string

type QuadraticCurveRecord

type QuadraticCurveRecord struct {
	Control math2.Vector2[float64]
	Anchor  math2.Vector2[float64]
	Start   math2.Vector2[float64]
}

func QuadraticCurveFromLineRecord

func QuadraticCurveFromLineRecord(l LineRecord) QuadraticCurveRecord

func (QuadraticCurveRecord) ApplyMatrixTransform

func (r QuadraticCurveRecord) ApplyMatrixTransform(transform math2.MatrixTransform, applyTranslation bool) Record

func (QuadraticCurveRecord) BoundingBox

func (r QuadraticCurveRecord) BoundingBox() (topLeft, bottomRight math2.Vector2[float64])

func (QuadraticCurveRecord) Equals

func (r QuadraticCurveRecord) Equals(other Record) bool

func (QuadraticCurveRecord) GetEnd

func (QuadraticCurveRecord) GetStart

func (r QuadraticCurveRecord) GetStart() math2.Vector2[float64]

func (QuadraticCurveRecord) IsFlat

func (r QuadraticCurveRecord) IsFlat() bool

func (QuadraticCurveRecord) Reverse

func (r QuadraticCurveRecord) Reverse() Record

func (QuadraticCurveRecord) SameType

func (r QuadraticCurveRecord) SameType(other Record) bool

func (QuadraticCurveRecord) String

func (r QuadraticCurveRecord) String() string

func (QuadraticCurveRecord) ToLineRecords

func (r QuadraticCurveRecord) ToLineRecords(scale int64) []Record

type Record

type Record interface {
	GetStart() math.Vector2[float64]
	GetEnd() math.Vector2[float64]

	Reverse() Record

	Equals(other Record) bool

	SameType(other Record) bool

	ApplyMatrixTransform(transform math.MatrixTransform, applyTranslation bool) Record

	BoundingBox() (topLeft, bottomRight math.Vector2[float64])

	IsFlat() bool

	String() string
}

func FlattenRecord

func FlattenRecord(r Record, scale int64) []Record

func LerpRecord

func LerpRecord(start, end Record, ratio float64) Record

type RecordPair

type RecordPair [2]Record

Jump to

Keyboard shortcuts

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