bezier

package
v0.0.0-...-9c88ebf Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bezier

type Bezier []d2.Pt

Bezier curve defined by a slice of control points

func (Bezier) BezierIntersections

func (b Bezier) BezierIntersections(l line.Line) []float64

BezierIntersections returns the intersection points relative to the Bezier curve.

func (Bezier) Blossom

func (b Bezier) Blossom(fs ...float64) d2.Pt

Blossom point for the control points of a bezier curve

func (Bezier) BlossomBuf

func (b Bezier) BlossomBuf(ptBuf []d2.Pt, fs ...float64) d2.Pt

BlossomBuf computes the Blossom point for the control points of a bezier curve using the provided buffer. Reusing a buffer can increase performance.

func (Bezier) Cache

func (b Bezier) Cache() BezierCache

Cache pre-computes the Tangent and returns a BezierCache

func (Bezier) L

func (Bezier) L(t, c int) d2.Limit

L fulfills d2.Limiter.

func (Bezier) LineIntersections

func (b Bezier) LineIntersections(l line.Line, buf []float64) []float64

LineIntersections fulfills line.LineIntersector returning the intersection points relative to the line.

func (Bezier) Pt1

func (b Bezier) Pt1(t float64) d2.Pt

Pt1 fulfills d2.Pt1 and returns the parametric curve point on the bezier curve.

func (Bezier) Segment

func (b Bezier) Segment(start, end float64) Bezier

Segment returns a bezier curve that whose start and end is relative to the base curve. So calling b.(0.2, 0.7) will return a curve that exactly matches b from 0.2 to 0.7.

func (Bezier) SegmentBuf

func (b Bezier) SegmentBuf(start, end float64, ptBuf []d2.Pt, floatBuf []float64) Bezier

SegmentBuf returns a bezier curve that whose start and end is relative to the base curve. Providing a buf reduces the overhead.

func (Bezier) Tangent

func (b Bezier) Tangent() Tangent

Tangent returns a curve that is the derivative of the Bezier curve

func (Bezier) V1

func (b Bezier) V1(t float64) d2.V

V1 fulfills d2.V1 and returns the derivate at t.

func (Bezier) V1c0

func (b Bezier) V1c0() d2.V1

V1c0 aliases Tangent and fulfills d2.V1c0. This is more efficient if many tangents points are needed from one curve.

func (Bezier) VL

func (Bezier) VL(t, c int) d2.Limit

VL fulfills d2.VLimiter.

type BezierCache

type BezierCache struct {
	Bezier
	Tangent
}

BezierCache holds both a Bezier curve and it's Tangent and is more efficient if both Pts and Vs will be needed from a curve.

func (BezierCache) V1

func (bc BezierCache) V1(t float64) d2.V

V1 fulfills d2.V1

func (BezierCache) V1c0

func (bc BezierCache) V1c0() d2.V1

V1c0 fulfills d2.V1c0

type Tangent

type Tangent struct {
	Bezier Bezier
}

Tangent holds a first derivative of a Bezier curve which mathematically is also a bezier curve, but the returned type is V instead of Pt.

func (Tangent) V1

func (bt Tangent) V1(t float64) d2.V

V1 fulfills d2.V1

Jump to

Keyboard shortcuts

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