Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Sierpinski curve
# Construção da curva que preenche Sierpinski. it <- function(z,sinal){ # Iteração base p=matrix(0,2,4);u=z[,2]-z[,1];t=sinal*(pi/3) p[,1]=z[,1];p[,2]=p[,1]+matrix(c(cos(t),sin(t),-sin(t),cos(t)),2,2)%*%(u/2) p[,3]=p[,2]+u/2 p[,4]=z[,2];p} Sierpinski<-function(x,y,m){ # Replicação da iteração base. z=matrix(c(x,y),2,2) for ( i in 1:m){ q=matrix(0,2,3*length(z[1,])-2) for (j in 1:(length(z[1,])-1)){ q[,(3*j-2):(3*j+1)]=it(z[,j:(j+1)],sinal);sinal=-sinal} z=q};z } # --- Teste ----------------------------------- sinal=1 x=c(0,1) y=c(1,2) z=matrix(c(x,y),2,2) plot(x,y,'l') # Teste z=it(z,sinal);z plot(z[1,],z[2,],'l',col="yellow") z=Sierpinski(x,y,3) plot(z[1,],z[2,],'l',col="blue") z=Sierpinski(x,y,5) plot(z[1,],z[2,],'l',col="green") z=Sierpinski(x,y,10) plot(z[1,],z[2,],'l',col="red")
run
|
edit
|
history
|
help
0
Chi Square Tests - Goodness of Fit Test [Coffee drinkers]
5 # SUMMARY PART B
Ludy Thenor Research Methods I- Final Part 2
Fractal Fourier
24-08-2020-GradConj
Practice series1(37)
BasicPlot
Camelcase
12-08-2020Ex3.19
direct_assignment