R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: x86_64-pc-linux-gnu (64-bit) R est un logiciel libre livré sans AUCUNE GARANTIE. Vous pouvez le redistribuer sous certaines conditions. Tapez 'license()' ou 'licence()' pour plus de détails. R est un projet collaboratif avec de nombreux contributeurs. Tapez 'contributors()' pour plus d'information et 'citation()' pour la façon de le citer dans les publications. Tapez 'demo()' pour des démonstrations, 'help()' pour l'aide en ligne ou 'help.start()' pour obtenir l'aide au format HTML. Tapez 'q()' pour quitter R. > date() [1] "Thu Sep 22 16:13:55 2011" > ################################################### > ### chunk number 2: tableauMaison > ################################################### > #line 89 "/bge/penel/verif_pedadoc/pedadoc/fichestd/tdr17//tdr17.rnw" > maison <- matrix(c( + 0.0,0,0.000, + 1.0,0,0.000, + 1.0,1,0.000, + 1.0,3,0.000, + 0.0,3,0.000, + 0.0,1,0.000, + 0.0,0,2.000, + 1.0,0,2.000, + 1.0,1,2.000, + 0.0,1,2.000, + 1.0,1,1.000, + 1.0,3,1.000, + 0.0,3,1.000, + 0.0,1,1.000, + 0.5,3,sqrt(3), + 0.5,1,sqrt(3)), + ncol = 3, nrow = 16, byrow = TRUE) > maison <- as.data.frame(maison) > names(maison) <- c("x","y","z") > rownames(maison) <- LETTERS[1:nrow(maison)] > library(xtable) > tmp <- apply(t(maison),c(1,2),as.character) > tmp[1, "O"] <- "a" > tmp[1, "P"] <- "a" > tmp[3, "O"] <- "b" > tmp[3, "P"] <- "b" > tmaison <- xtable(tmp, caption = "La matrice des coordonnées à trois dimensions des 16 + points de la maison", label = "maison") > digits(tmaison)[1:14] <- 0 > print(tmaison, file = "maison.tex") > > > ################################################### > ### chunk number 3: > ################################################### > #line 132 "/bge/penel/verif_pedadoc/pedadoc/fichestd/tdr17//tdr17.rnw" > maison x y z A 0.0 0 0.000000 B 1.0 0 0.000000 C 1.0 1 0.000000 D 1.0 3 0.000000 E 0.0 3 0.000000 F 0.0 1 0.000000 G 0.0 0 2.000000 H 1.0 0 2.000000 I 1.0 1 2.000000 J 0.0 1 2.000000 K 1.0 1 1.000000 L 1.0 3 1.000000 M 0.0 3 1.000000 N 0.0 1 1.000000 O 0.5 3 1.732051 P 0.5 1 1.732051 > > > ################################################### > ### chunk number 4: > ################################################### > #line 138 "/bge/penel/verif_pedadoc/pedadoc/fichestd/tdr17//tdr17.rnw" > essai.3d <- function (X, alpha, beta, lab = F, ...) + { + matrixh <- function(a = pi/6, b = pi/3) { + h <- matrix(0, 2, 3) + h[1, 1] <- -sin(a) ; h[1, 2] <- cos(a) ; h[1, 3] <- 0 + h[2, 1] <- -cos(a) * sin(b) ; h[2, 2] <- -sin(a) * sin(b) + h[2, 3] <- cos(b) + return(t(h)) + } + alpha <- alpha * pi/180 ; beta <- beta * pi/180 + w <- matrixh(a=alpha, b=beta) + X <- as.matrix(X) + X <- X %*% w + plot(X, ...) + if (lab) + text(X[, 1], X[, 2], rownames(X), pos = 1) + return(invisible(X)) + } > > > ################################################### > ### chunk number 5: fairemaison > ################################################### > #line 168 "/bge/penel/verif_pedadoc/pedadoc/fichestd/tdr17//tdr17.rnw" > maison2d <- essai.3d(X = maison, alpha = 30, beta = 60, lab = TRUE, asp = TRUE) > > > ################################################### > ### chunk number 6: fctpeindre > ################################################### > #line 176 "/bge/penel/verif_pedadoc/pedadoc/fichestd/tdr17//tdr17.rnw" > peindre <- function(data, points, col = "red", border = "black") + { + x <- sapply(points, function(pt) data[which(rownames(data)==pt), 1]) + y <- sapply(points, function(pt) data[which(rownames(data)==pt), 2]) + polygon(x,y, col = col, border = border) + } > #line 168 "/bge/penel/verif_pedadoc/pedadoc/fichestd/tdr17//tdr17.rnw" > maison2d <- essai.3d(X = maison, alpha = 30, beta = 60, lab = TRUE, asp = TRUE) > #line 183 "/bge/penel/verif_pedadoc/pedadoc/fichestd/tdr17//tdr17.rnw" > peindre(maison2d, c("G","H","I","J")) > > > ################################################### > ### chunk number 7: > ################################################### > #line 189 "/bge/penel/verif_pedadoc/pedadoc/fichestd/tdr17//tdr17.rnw" > opar <- par(no.readonly=TRUE) > par(mar = rep(0.1,4)) > maison2d <- essai.3d(X = maison, alpha = 30, beta = 60, lab = FALSE, asp = TRUE, + xaxt = "n", yaxt = "n", bty = "n", type = "n", + xlab = "", ylab = "") > > peindre(maison2d, c("G","H","I","J")) > peindre(maison2d, c("K","L","O","P")) > peindre(maison2d, c("M","N","P","O"), col = "orange") > peindre(maison2d, c("B","H","I","C"), col = NA) > peindre(maison2d, c("K","I","J","N","P"), col = NA) > peindre(maison2d, c("D","L","O","M","E"), col = NA) > peindre(maison2d, c("D","C","K","L"), col = NA) > > par(opar) > > > ################################################### > ### chunk number 8: objet > ################################################### > #line 209 "/bge/penel/verif_pedadoc/pedadoc/fichestd/tdr17//tdr17.rnw" > pdf("figs/objet.pdf", version = "1.4") > data <- matrix(0, ncol= 3, nrow = 27) > i <- 1 > for(x in 0:2) for(y in 0:2) for(z in 0:2) { data[i, ] <- c(x,y,z) ; i <- i+1 } > rownames(data) <- apply(data,1,paste,sep="",collapse="") > data2d <- essai.3d(X = data, alpha = -30, beta = 30, lab = TRUE, asp = TRUE, type = "n") > #rose > peindre(data2d, c("010", "012", "212", "210"), col = rgb(1,0,1,0.25), border = rgb(1,0,1,0.9)) > #bleu > peindre(data2d, c("100", "102", "122", "120"), col = rgb(0,1,1,0.25), border = rgb(0,1,1,0.9)) > #jaune > peindre(data2d, c("001", "021", "221", "201"), col = rgb(1,1,0,0.25), border = rgb(1,1,0,0.9)) > #rose > peindre(data2d, c("110", "111", "211", "210"), col = NA) > peindre(data2d, c("110", "010", "011", "111"), col = NA) > peindre(data2d, c("011", "012", "112", "111"), col = NA) > peindre(data2d, c("112", "212", "211", "111"), col = NA) > #bleu > peindre(data2d, c("100", "101", "111", "110"), col = NA) > peindre(data2d, c("101", "102", "112", "111"), col = NA) > peindre(data2d, c("112", "122", "121", "111"), col = NA) > peindre(data2d, c("121", "120", "110", "111"), col = NA) > #jaune > peindre(data2d, c("111", "101", "201", "211"), col = NA) > peindre(data2d, c("111", "101", "001", "011"), col = NA) > peindre(data2d, c("111", "011", "021", "121"), col = NA) > peindre(data2d, c("111", "121", "221", "211"), col = NA) > dev.off() pdf 2 > > > ################################################### > ### chunk number 9: > ################################################### > #line 243 "/bge/penel/verif_pedadoc/pedadoc/fichestd/tdr17//tdr17.rnw" > opar <- par(no.readonly=TRUE) > par(mar=rep(0.1,4)) > data2d <- essai.3d(X = data, alpha = -30, beta = 30, lab = FALSE, asp = TRUE, type = "n") > peindre(data2d, c("111", "011", "012", "112"), col = rgb(1,0,1)) > peindre(data2d, c("111", "011", "001", "101"), col = rgb(1,1,0)) > peindre(data2d, c("111", "110", "120", "121"), col = rgb(0,1,1)) > peindre(data2d, c("111", "121", "221", "211"), col = rgb(1,1,0)) > peindre(data2d, c("111", "211", "210", "110"), col = rgb(1,0,1)) > peindre(data2d, c("111", "110", "100", "101"), col = rgb(0,1,1)) > peindre(data2d, c("111", "121", "122", "112"), col = rgb(0,1,1)) > peindre(data2d, c("111", "101", "201", "211"), col = rgb(1,1,0)) > peindre(data2d, c("111", "112", "102", "101"), col = rgb(0,1,1)) > peindre(data2d, c("111", "112", "212", "211"), col = rgb(1,0,1)) > par(opar) > > > ################################################### > ### chunk number 10: futil > ################################################### > #line 275 "/bge/penel/verif_pedadoc/pedadoc/fichestd/tdr17//tdr17.rnw" > essai.3d <- function (X, alpha, beta, lab = F, ...) { + matrixh <- function(a = pi/6, b = pi/3) { + h <- matrix(0, 2, 3) + h[1, 1] <- -sin(a) ; h[1, 2] <- cos(a) ; h[1, 3] <- 0 + h[2, 1] <- -cos(a) * sin(b) ; h[2, 2] <- -sin(a) * sin(b) + h[2, 3] <- cos(b) + return(t(h)) + } + alpha <- alpha * pi/180 ; beta <- beta * pi/180 + w <- matrixh(a=alpha, b=beta) + X <- as.matrix(X) + X <- X %*% w + plot(X, asp=1, ...) + if (lab) + text(X[, 1], X[, 2], row.names(X), pos = 1) + return(invisible(X)) + } > > changebase <- function (X, alpha, beta) { + uvw <- function(a = pi/6, b = pi/3) { + h <- matrix(0, 3, 3) + h[1, 1] <- cos(a)*cos(b) ; h[1,2] <- sin(a)*cos(b) + h[1, 3] <- sin(b) + h[2, 1] <- -sin(a) ; h[2, 2] <- cos(a) ; h[2, 3] <- 0 + h[3, 1] <- -cos(a) * sin(b) ; h[3, 2] <- -sin(a) * sin(b) + h[3, 3] <- cos(b) + h + return(t(h)) + } + alpha <- alpha * pi/180 ; beta <- beta * pi/180 + w <- uvw(a=alpha, b=beta) + x <- as.matrix(X) + y <- x %*% w + y[,1] <- 0 + y <- y %*% t(w) + y <- as.data.frame(y) + names(y) <- names(X) + row.names(y) <- letters[1:nrow(y)] + X <- rbind.data.frame(X,y) + return(invisible(X)) + } > > > ################################################### > ### chunk number 11: figure > ################################################### > #line 320 "/bge/penel/verif_pedadoc/pedadoc/fichestd/tdr17//tdr17.rnw" > opar <- par(no.readonly = TRUE) > par(mar = c(3,3,2,2)) > > projmaison <- changebase(maison,30,60) > projmaison2d <- essai.3d(projmaison, 120,45,lab=TRUE, xlab = "", ylab = "", las = 1) > > peindre(projmaison2d, c("G","H","I","J"), col = NA, border = "red") > peindre(projmaison2d, c("A","G","J","F"), col = NA, border = "red") > peindre(projmaison2d, c("K","I","J","N","P"), col = NA, border = "red") > peindre(projmaison2d, c("D","L","O","M","E"), col = NA, border = "red") > peindre(projmaison2d, c("F","N","M","E"), col = NA, border = "red") > peindre(projmaison2d, c("M","N","P","O"), col = NA, border = "red") > peindre(projmaison2d, c("K","P","O","L"), col = NA, border = "red") > > > peindre(projmaison2d, c("g","h","i","j"), col = NA, border = "blue") > peindre(projmaison2d, c("b","h","i","c"), col = NA, border = "blue") > peindre(projmaison2d, c("i","j","n","p","k"), col = NA, border = "blue") > peindre(projmaison2d, c("m","n","p","o"), col = NA, border = "blue") > peindre(projmaison2d, c("d","l","o","m","e"), col = NA, border = "blue") > peindre(projmaison2d, c("k","p","o","l"), col = NA, border = "blue") > peindre(projmaison2d, c("c","k","l","d"), col = NA, border = "blue") > > library(IDPmisc) Erreur dans library(IDPmisc) : aucun package nommé 'IDPmisc' n'est trouvé Exécution arrêtée