qbezier2

package
v0.0.0-...-1137f6a Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package qbezier2 contains functions for 2D quadratic Bezier splines. See: http://en.wikipedia.org/wiki/B%C3%A9zier_curve

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Length

func Length(p0, p1, p2 *vec2.T, t float64) float64

Length returns the length of a quadratic bezier spline from p0 to t (0,1).

Note that although this calculation is accurate at t=0, 0.5, and 1 due to the nature of quadratic curves, it is an approximation for other values of t.

func Point

func Point(p0, p1, p2 *vec2.T, t float64) vec2.T

Point returns a point on a quadratic bezier spline at t (0,1).

func Tangent

func Tangent(p0, p1, p2 *vec2.T, t float64) vec2.T

Tangent returns a tangent on a quadratic bezier spline at t (0,1).

Types

type T

type T struct {
	P0, P1, P2 vec2.T
}

T holds the data to define a quadratic bezier spline.

func Parse

func Parse(s string) (r T, err error)

Parse parses T from a string. See also String()

func (*T) Length

func (bez *T) Length(t float64) float64

Length returns the length of a quadratic bezier spline from A.Point to t (0,1).

func (*T) Point

func (bez *T) Point(t float64) vec2.T

Point returns a point on a quadratic bezier spline at t (0,1).

func (*T) String

func (bez *T) String() string

String formats T as string. See also Parse().

func (*T) Tangent

func (bez *T) Tangent(t float64) vec2.T

Tangent returns a tangent on a quadratic bezier spline at t (0,1).

Jump to

Keyboard shortcuts

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