0.6.3 • Published 6 years ago

primitive-quadify-off-curves v0.6.3

Weekly downloads
1
License
APLv2
Repository
-
Last release
6 years ago

primitive-quadify-off-curves

Converts arbitrary smooth curve to quadratic TT quadratic points.

Usage

import { 
    autoQuadifyCurve,
    Reparametrized,
    Circle,
    Slice
} from "primitive-quadify-off-curves"

autoQuadifyCurve(new Reparametrized(new Circle(0, 0, 100), new Slice(0, Math.PI * 2)), 1)
autoQuadifyCurve(new CubicBezier(a, b, c, d), 1)

quadifyCurve(c: Curve, nPoints: number)

Quadify a curve with nPoints off-points produced. Would return null or throw an error if quadify failed.

autoQuadifyCurve(c: Curve, error: number = 1, maxSegments: number = 32, maxDistanceTestPoints: number = 128)

Quadify a curve with an error. The points used would be automatically decided using the error, and not going above maxSegments points.

An alias being autoQuadify.

Interfaces

interface Derivable<T> {
	eval(t: number): T;
	derivative(t: number): T;
}
type Curve = Derivable<Point2d>;
type DerivableFunction = Derivable<number>;

Predefined curves and derivable functions

  • CubicBezier
  • Circle
  • Reparametrized: Reparametrize a curve with a derivable function.
  • Slice: Derivable Function for slicing curves. Usually combined with Reparametrized
0.6.3

6 years ago

0.6.2

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.2

6 years ago

0.5.0

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago