File:Silentnight.png

From 太極
Revision as of 10:13, 1 March 2016 by Brb (talk | contribs) (depth <- 9 angle<-30 #Between branches division L <- 0.90 #Decreasing rate of branches by depth nstars <- 300 #Number of stars to draw mstars <- matrix(runif(2*nstars), ncol=2) branches <- rbind(c(1,0,0,abs(jitter(0)),1,jitter(5, amount = 5)), data.fra...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Original file(1,200 × 600 pixels, file size: 57 KB, MIME type: image/png)

depth <- 9 angle<-30 #Between branches division L <- 0.90 #Decreasing rate of branches by depth nstars <- 300 #Number of stars to draw mstars <- matrix(runif(2*nstars), ncol=2) branches <- rbind(c(1,0,0,abs(jitter(0)),1,jitter(5, amount = 5)), data.frame()) colnames(branches) <- c("depth", "x1", "y1", "x2", "y2", "inertia") for(i in 1:depth) {

 df <- branches[branches$depth==i,]
 for(j in 1:nrow(df))
 {
   branches <- rbind(branches, c(df[j,1]+1, df[j,4], df[j,5], df[j,4]+L^(2*i+1)*sin(pi*(df[j,6]+angle)/180), df[j,5]+L^(2*i+1)*cos(pi*(df[j,6]+angle)/180), df[j,6]+angle+jitter(10, amount = 8)))
   branches <- rbind(branches, c(df[j,1]+1, df[j,4], df[j,5], df[j,4]+L^(2*i+1)*sin(pi*(df[j,6]-angle)/180), df[j,5]+L^(2*i+1)*cos(pi*(df[j,6]-angle)/180), df[j,6]-angle+jitter(10, amount = 8)))
 }

} nodes <- rbind(as.matrix(branches[,2:3]), as.matrix(branches[,4:5])) png("image.png", width = 1200, height = 600) plot.new() par(mai = rep(0, 4), bg = "gray12") plot(nodes, type="n", xlim=c(-7, 3), ylim=c(0, 5)) for (i in 1:nrow(mstars)) {

 points(x=10*mstars[i,1]-7, y=5*mstars[i,2], col = "blue4", cex=.7, pch=16)
 points(x=10*mstars[i,1]-7, y=5*mstars[i,2], col = "blue",  cex=.3, pch=16)
 points(x=10*mstars[i,1]-7, y=5*mstars[i,2], col = "white", cex=.1, pch=16)

}

  1. The moon

points(x=-5, y=3.5, cex=40, pch=16, col="lightyellow")

  1. The tree

for (i in 1:nrow(branches)) {lines(x=branches[i,c(2,4)], y=branches[i,c(3,5)], col = paste("gray", as.character(sample(seq(from=50, to=round(50+5*branches[i,1]), by=1), 1)), sep = ""), lwd=(65/(1+3*branches[i,1])))} rm(branches) dev.off()

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current10:13, 1 March 2016Thumbnail for version as of 10:13, 1 March 20161,200 × 600 (57 KB)Brb (talk | contribs)depth <- 9 angle<-30 #Between branches division L <- 0.90 #Decreasing rate of branches by depth nstars <- 300 #Number of stars to draw mstars <- matrix(runif(2*nstars), ncol=2) branches <- rbind(c(1,0,0,abs(jitter(0)),1,jitter(5, amount = 5)), data.fra...

The following page uses this file:

Metadata