Description Usage Arguments Details Value Author(s) See Also Examples
This function calls bezierArcLength
and returns the absolute difference between the Bezier curve or spline arc length and an input length. The primary use of this function is to supply optim
with a single value for identifying a parametric value at a particular arc length in pointsOnBezier
.
1 2 | compareBezierArcLength(p, l, t1 = 0, t2 = NULL, deg = NULL,
relative.min.slope = 1e-6, absolute.min.slope = 0)
|
p |
control points, input either as vector, matrix or list (see |
l |
the length against which the arc length is compared. |
t1 |
an initial parametric value for a Bezier curve or spline. |
t2 |
a final parametric value for a Bezier curve or spline. |
deg |
a numeric indicating the degree (or order) of a Bezier spline. For Bezier curves, the degree is computed automatically based on the number of control points. |
relative.min.slope |
a numeric indicating at which change in arc length relative to the instaneous length estimated length is considered sufficiently close to the actual length. |
absolute.min.slope |
a numeric indicating at which absolute change in arc length estimated length is considered sufficiently close to the actual length. |
The performance of this function is identical to bezierArcLength
except that fewer input parameters are available. See "Details" in bezierArcLength
.
the absolute difference between the input length l
and the Bezier arc length.
Aaron Olsen
bezier
, pointsOnBezier
, bezierArcLength
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## BEZIER CURVE ARC LENGTH COMPARISON ##
## BEZIER CURVE CONTROL POINTS
p <- matrix(c(0,0, 1,4, 2,2), nrow=3, ncol=2, byrow=TRUE)
## COMPARE THE BEZIER ARC LENGTH TO ZERO
## SIMPLY RETURNS ARC LENGTH
compareBezierArcLength(p=p, l=0)
## COMPARE THE BEZIER ARC LENGTH TO ONE
compareBezierArcLength(p=p, l=1)
## SPECIFYING DIFFERENT T PARAMETERS
compareBezierArcLength(p=p, l=1, t1=0.3, t2=0.8)
## BEZIER SPLINE ARC LENGTH COMPARISON ##
## BEZIER SPLINE CONTROL POINTS
p <- matrix(c(0,0, 1,4, 2,2, 3,0, 4,4), nrow=5, ncol=2, byrow=TRUE)
## COMPARE THE BEZIER ARC LENGTH TO ZERO
## SIMPLY RETURNS ARC LENGTH
compareBezierArcLength(p=p, l=0, deg=2)
|
[1] 4.083686
[1] 3.083686
[1] 0.4338598
[1] 8.167371
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.