knotR (version 1.0-4)

bezier: Various functionality for Bezier curves

Description

Various functionality for Bezier curves including derivatives and radius of curvature.

Usage

bezier(P, tee, n=100)
bezier_deriv(P, tee, n=100)
bezier_deriv2(P, tee, n=100)
bezier_radius(P, tee, n=100)
bezier_curvature(P,tee,n=100)
myseg(P, ...)

Arguments

P

Control points in the form of a 4 by 2 matrix with rows corresponding to \(P_0\) to \(P_3\)

tee

Parametric variable \(t\)

n

Integer specifying number of points between 0 and 1 to use. Default value of 100 looks OK

...

Further arguments passed by myseg() to points()

Author

Robin K. S. Hankin

Details

  • Function bezier() returns a two column matrix with rows corresponding to the positions of the specified Bezier curve.

  • Functions bezier_deriv() and bezier_deriv2() give the first and second derivatives respectively.

  • Function bezier_radius() gives the radius of curvature.

  • Functions bezier_length() and bezier_bending_energy() use numerical quadrature to give the arc length and bending energy (\(\int R^{-1}ds\)).

See Also

bezier_angle

Examples

Run this code


P <- matrix(c(0, 1, 2, 2, 2, 0, 3, 2),4,2)
xy <- bezier(P,n=100)
dx <- bezier_deriv(P,n=100)

plot(xy,asp=1)
myseg(P)

plot(xy,asp=1,cex=sqrt(rowSums(dx^2))/3.2)

plot(xy,asp=1)
segments(xy[,1],xy[,2],(xy+dx/200)[,1],(xy+dx/200)[,2])


plot(xy, asp=1,cex=bezier_radius(P,n=100)/2)

lapply(as.controlpoints(k8_9),bezier_radius)
lapply(as.controlpoints(k8_9),bezier_arclength)

Run the code above in your browser using DataLab