Description Usage Arguments Value Author(s) References See Also Examples
Apply the solutions of the Schwartz-Christoffel equations to a new complex vector.
1 | conformalPredict(fit, x, polygon2disk = TRUE)
|
fit |
an object returned by |
x |
a complex vector or a real vector representing a complex vector (see |
polygon2disk |
if |
a real vector representing a complex vector that is the result of transforming x
.
Nick Ellis, nick.ellis@csiro.au
Trefethen, LN (1980) Numerical computation of the Schwarz-Christoffel transformation, Siam J. Sci. Stat. Comp. 1, 82-102.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | CircleGrid <- function(nradial) { # create a random pattern to fill a disk
r <- seq(0,1,len=nradial)
nth <- pmax(1,ceiling(2*pi*r*(nradial-1)))
th0 <- runif(nth,-pi/nth,pi/nth)
list(
x=unlist(lapply(1:nradial, function(i,r,nth,th0)
r[i]*cos(th0[i]+seq(0,2*pi,len=nth[i]+1)[-nth[i]-1]),r=r,nth=nth,th0=th0)),
y=unlist(lapply(1:nradial, function(i,r,nth,th0)
r[i]*sin(th0[i]+seq(0,2*pi,len=nth[i]+1)[-nth[i]-1]),r=r,nth=nth,th0=th0))
)
}
disk <- listxy2R(CircleGrid(30))
poly <- list(
x=c(0.81,0.00,-0.73,-0.72,0.07,0.59,0.90),
y=c(0.26,0.52,0.18,-0.44,-0.75,-0.39,0.01)
)
#poly <- locator(type='l')
fit <- conformalFit(poly)
pred <- conformalPredict(fit, disk, polygon2disk=FALSE)
cDisk <- R2C(disk)
cPred <- R2C(pred)
cols <- hsv(h=Arg(cDisk)/2/pi+0.5,s=pmin(1,Mod(cDisk)))
par(mfrow=c(1,2))
plot(cDisk, col=cols, asp=1, pch=16, main="Colour wheel")
lines(poly)
plot(cDisk, type='n', asp=1, main="Colour wheel\nmapped to polygon")
points(cPred, col=cols,pch=16)
circ <- abs(Mod(cDisk)-1) < 1e-6
segments(Re(cDisk[circ]),Im(cDisk[circ]),Re(cPred[circ]),Im(cPred[circ]), col=cols[circ])
lines(poly)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.