Bitmap/Bézier curves/Cubic: Difference between revisions
Content added Content deleted
(Added R code) |
(Mispelled some variable names in R code) |
||
Line 318: | Line 318: | ||
for (t in seq(0, 1, length.out=n)) |
for (t in seq(0, 1, length.out=n)) |
||
{ |
{ |
||
b <- bez( |
b <- bez(x, y, t) |
||
outx[i] <- b$x |
outx[i] <- b$x |
||
outy[i] <- b$y |
outy[i] <- b$y |
||
Line 332: | Line 332: | ||
outx <- 0 |
outx <- 0 |
||
outy <- 0 |
outy <- 0 |
||
n <- length( |
n <- length(x)-1 |
||
for (i in 0:n) |
for (i in 0:n) |
||
{ |
{ |
||
outx <- outx + choose(n, i)*((1-t)^(n-i))*t^i* |
outx <- outx + choose(n, i)*((1-t)^(n-i))*t^i*x[i+1] |
||
outy <- outy + choose(n, i)*((1-t)^(n-i))*t^i* |
outy <- outy + choose(n, i)*((1-t)^(n-i))*t^i*y[i+1] |
||
} |
} |
||