# # Plot_coombs_mesh.r # # Reads in output from COOMBS7.FOR # and produces Simple Graphs of Cutting Lines # # # --1st column: counter # --2nd column: Angle in Radians # --3rd column: cutpoint on normal vector # --4th column: 1st dim. Normal Vector # --5th column: 2nd dim. Normal Vector # # par(mfrow=c(1,2)) # # T <- matrix(scan("C:/R_Files/mesh_fig_2_8A.txt",0),ncol=5,byrow=TRUE) # # TT <- T nrow <- length(T[,1]) ncol <- length(T[1,]) # y <- rep(0,(nrow*2)) dim(y) <- c(nrow,2) # # # Change Sign on the Dimensions -- Have all Normal # Vectors Pointing to Positive Side of x-axis # nws <- 3 norm1 <- 4 norm2 <- 5 # i <- 1 while(i <= nrow){ if(T[i,norm1] < 0.0){ T[,nws] <- -T[,nws] T[,norm1] <- -T[,norm1] T[,norm2] <- -T[,norm2] } i <- i + 1 } # # Take Care of Sign Changes on Both Axes By # Reflecting projected Cutpoint # #T[,nws] <- -T[,nws] # # xzero <- 0.000 yzero <- 0.000 distfrm0 <- sqrt(xzero*xzero + yzero*yzero) # # # xt is used in the Line equation -- xt*(Focus Point at last iteration) # # Set Up Iteration Matrix -- y -- column 1 is xt for the Line Equation # -- column 2 is 1/2 the axis range # y[1,1] <- 0.0 y[1,2] <- 1.0 # # ntrial <- 1 # xt <- y[ntrial,1] xinc <- y[ntrial,2] # xaxis1 <- xzero*xt - xinc xaxis2 <- xzero*xt + xinc yaxis1 <- yzero*xt - xinc yaxis2 <- yzero*xt + xinc # xx <- T[,norm1] yy <- T[,norm2] plot(xx,yy,asp=1,type="n", xlab="Dimension One",ylab="Dimension Two", xlim=c(xaxis1,xaxis2), ylim=c(yaxis1,yaxis2)) mtext(side=3,line=1.5,"Figure 2.8A: 1st Complete Coombs Mesh",font=2) text(-0.90,0.410,"1",pos=2) text(-0.80,0.400,"N",pos=2) text(-0.80,0.500,"Y",pos=2) # text(-0.70, 0.750,"2",pos=2) text(-0.90, 0.800,"Y",pos=2) text(-0.80, 0.900,"N",pos=2) # text( 0.20,1.000,"3",pos=2) text( 0.20, 0.900,"N",pos=2) text( 0.30, 0.900,"Y",pos=2) # text( 0.45,1.000,"4",pos=2) text( 0.40, 0.900,"N",pos=2) text( 0.55, 0.900,"Y",pos=2) # text( 1.00,0.165,"5",pos=3) text( 0.95, 0.160,"N",pos=2) text( 0.95, 0.060,"Y",pos=2) # text(-0.75, 0.000,"nynnn") text(-0.80,-0.650,"nynny") text(-0.25,-0.650,"nynyy") text( 0.65,-0.500,"nnyyy") text( 0.65, 0.500,"ynyyn") text(-0.25, 0.500,"ynnnn") # i <- 1 while(i <= nrow) { # # xws <- T[i,nws]*T[i,norm1] yws <- T[i,nws]*T[i,norm2] xexpand <- y[1,2] xexpand <- 40 arrows(xws,yws,xws+xexpand*T[i,norm2],yws-xexpand*T[i,norm1],length=0.0,lwd=2,col="black") arrows(xws,yws,xws-xexpand*T[i,norm2],yws+xexpand*T[i,norm1],length=0.0,lwd=2,col="black") # i <- i + 1 } # # # T <- matrix(scan("C:/R_Files/mesh_fig_2_8B.txt",0),ncol=5,byrow=TRUE) # TT <- T nrow <- length(T[,1]) ncol <- length(T[1,]) # y <- rep(0,(nrow*2)) dim(y) <- c(nrow,2) # # # Change Sign on the Dimensions -- Have all Normal # Vectors Pointing to Positive Side of x-axis # nws <- 3 norm1 <- 4 norm2 <- 5 # i <- 1 while(i <= nrow){ if(T[i,norm1] < 0.0){ T[,nws] <- -T[,nws] T[,norm1] <- -T[,norm1] T[,norm2] <- -T[,norm2] } i <- i + 1 } # # Take Care of Sign Changes on Both Axes By # Reflecting projected Cutpoint # #T[,nws] <- -T[,nws] # # xzero <- 0.000 yzero <- 0.000 distfrm0 <- sqrt(xzero*xzero + yzero*yzero) # # # xt is used in the Line equation -- xt*(Focus Point at last iteration) # # Set Up Iteration Matrix -- y -- column 1 is xt for the Line Equation # -- column 2 is 1/2 the axis range # y[1,1] <- 0.0 y[1,2] <- 1.0 # # ntrial <- 1 # xt <- y[ntrial,1] xinc <- y[ntrial,2] # xaxis1 <- xzero*xt - xinc xaxis2 <- xzero*xt + xinc yaxis1 <- yzero*xt - xinc yaxis2 <- yzero*xt + xinc # xx <- T[,norm1] yy <- T[,norm2] plot(xx,yy,asp=1,type="n", xlab="Dimension One",ylab="Dimension Two", xlim=c(xaxis1,xaxis2), ylim=c(yaxis1,yaxis2)) mtext(side=3,line=1.5,"Figure 2.8B: 2nd Complete Coombs Mesh",font=2) # text(-0.90,0.450,"1",pos=2) text(-0.80,0.400,"N",pos=2) text(-0.80,0.575,"Y",pos=2) # text(-0.300, 1.000,"2",pos=2) text(-0.400, 0.900,"Y",pos=2) text(-0.225, 0.900,"N",pos=2) # text( 0.25,1.080,"3",pos=2) text( 0.20, 0.950,"N",pos=2) text( 0.37, 0.950,"Y",pos=2) # text( 0.835, 0.750,"4",pos=2) text( 0.750, 0.650,"N",pos=2) text( 0.900, 0.650,"Y",pos=2) # text( 1.00,0.100,"5",pos=3) text(-0.75,-0.500,"N",pos=2) text(-0.75,-0.700,"Y",pos=2) # text(-0.75, 0.000,"nynnn") text(-0.50,-0.800,"nynny") text(-0.00,-0.800,"nynyy") text( 0.80,-0.250,"nnyyy") text( 0.80, 0.350,"ynyyn") text( 0.00, 0.750,"ynnnn") # i <- 1 while(i <= nrow) { # # xws <- T[i,nws]*T[i,norm1] yws <- T[i,nws]*T[i,norm2] xexpand <- y[1,2] xexpand <- 40 arrows(xws,yws,xws+xexpand*T[i,norm2],yws-xexpand*T[i,norm1],length=0.0,lwd=2,col="black") arrows(xws,yws,xws-xexpand*T[i,norm2],yws+xexpand*T[i,norm1],length=0.0,lwd=2,col="black") # i <- i + 1 } #