




已阅读5页,还剩19页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
16.1library(rgl)tetra - function() t1 - tetrahedron3d()t2vb - t1$vbt2vb1, - -3t2 - tmesh3d(t2vb, t1$it)plane - qmesh3d(rbind(rep(-3.01, 4), c(-2, -2, 2, 2), c(-3, 3, 3, -3), rep(1, 4), matrix(1:4, ncol=1)open3d(windowRect=c(0, 0, 600, 600)# clear3d()shade3d(plane, color=white, specular=black)wire3d(plane)wire3d(t1, lwd=3)wire3d(t2, lwd=3)segments3d(rbind(t2$vb1, t2$it, t1$vb1, t1$it), rbind(t2$vb2, t2$it, t1$vb2, t1$it), rbind(t2$vb3, t2$it, t1$vb3, t1$it), col=gray, lwd=3)view3d(40, -30)t1 - cube3d()t1tube - t1t1tube$ib - t1tube$ib, -(3:4)t2vb - t1$vbt2vb1, - -5t2 - qmesh3d(t2vb, t1$ib)plane - qmesh3d(rbind(rep(-5.01, 4), c(-2, -2, 2, 2), c(-3, 3, 3, -3), rep(1, 4), matrix(1:4, ncol=1)open3d(windowRect=c(0, 0, 600, 600)# clear3d()shade3d(plane, color=white, ambient=white, specular=white, emission=white)wire3d(plane)shade3d(t1tube, color=white, specular=black)wire3d(t1, lwd=3)wire3d(t2, lwd=3)segments3d(rbind(t2$vb1, t2$ib, 4, t1$vb1, t1$ib, 4), rbind(t2$vb2, t2$ib, 4, t1$vb2, t1$ib, 4), rbind(t2$vb3, t2$ib, 4, t1$vb3, t1$ib, 4), col=gray, lwd=3)view3d(55, -20, fov=0)rgl.postscript(Figures/threed-3dproj.eps)system(epstopdf Figures/threed-3dproj.eps)system(convert Figures/threed-3dproj.pdf Web/threed-3dproj.png)16.2library(rgl)tetra - function() t2vb - t1$vbt2vb1, - -3t2vb2, c(1, 4) - t2vb2, c(1, 4)*.8t2vb3, c(1, 4) - t2vb3, c(1, 4)*.8t2vb2, 2:3 - t2vb2, 2:3*.6t2vb3, 2:3 - t2vb3, 2:3*.6t2 - tmesh3d(t2vb, t1$it)t3vb - t1$vbt3vb1, - -10t3vb2, - 0t3vb3, - 0t3 - tmesh3d(t3vb, t1$it)open3d(windowRect=c(0, 0, 600, 600)# clear3d()shade3d(plane, color=white, specular=black)wire3d(plane)wire3d(t1, lwd=3)wire3d(t2, lwd=3)segments3d(rbind(t3$vb1, t3$it, t1$vb1, t1$it), rbind(t3$vb2, t3$it, t1$vb2, t1$it), rbind(t3$vb3, t3$it, t1$vb3, t1$it), col=gray, lwd=3)shade3d(translate3d(scale3d(cube3d(), .1, .1, .1), -10, 0, 0)view3d(50, -20, zoom=.8)t1 - cube3d()t1tube - t1t1tube$ib - t1tube$ib, -(3:4)t2vb - t1$vbt2vb2, t1$ib, 4 - t2vb2, t1$ib, 4*.4t2vb3, t1$ib, 4 - t2vb3, t1$ib, 4*.4t2vb2, t1$ib, 3 - t2vb2, t1$ib, 3*.6t2vb3, t1$ib, 3 - t2vb3, t1$ib, 3*.6t2vb1, - -4.5t2 - qmesh3d(t2vb, t1$ib)t2tube - t2t2tube$ib - t2tube$ib, -(3:4)t3 - translate3d(scale3d(cube3d(), .1, .1, .1), -10, 0, 0)plane - qmesh3d(rbind(rep(-4.51, 4), c(-2, -2, 2, 2), c(-3, 3, 3, -3), rep(1, 4), matrix(1:4, ncol=1)open3d(windowRect=c(0, 0, 600, 300)# clear3d()shade3d(plane, color=white, ambient=white, specular=white, emission=white)wire3d(plane)shade3d(t1tube, color=white, specular=black)wire3d(t1, lwd=3)shade3d(t2tube, color=white, specular=black)wire3d(t2, lwd=3)segments3d(rbind(-10, t1$vb1, t1$ib, 4), rbind(0, t1$vb2, t1$ib, 4), rbind(0, t1$vb3, t1$ib, 4), col=gray, lwd=3)shade3d(t3)view3d(50, -15, fov=0, zoom=.7)rgl.postscript(Figures/threed-3dvp.eps)system(epstopdf Figures/threed-3dvp.eps)system(convert Figures/threed-3dvp.pdf Web/threed-3dvp.png)16.3quakes - read.csv(Quake/earthquakes.csv)NZquakes - quakesc(LAT, LONG, MAG, DEPTH)cantyQuakes - quakesquakes$LAT -44 & quakes$LONG 171 & quakes$LONG 173.5, library(MASS)quakeDens - kde2d(cantyQuakes$LONG, cantyQuakes$LAT, n=30)par(mar=rep(0, 4)persp(quakeDens)16.4quakes - read.csv(Quake/earthquakes.csv)NZquakes - quakesc(LAT, LONG, MAG, DEPTH)cantyQuakes - quakesquakes$LAT -44 & quakes$LONG 171 & quakes$LONG 173.5, library(MASS)quakeDens - kde2d(cantyQuakes$LONG, cantyQuakes$LAT, n=30)par(mar=rep(0, 4)persp(quakeDens, scale=FALSE, expand=0.02, theta=60, d=.1, r=.1, xlab=longitude, ylab=latitude, zlab=)16.5quakes - read.csv(Quake/earthquakes.csv)NZquakes - quakesc(LAT, LONG, MAG, DEPTH)cantyQuakes - quakesquakes$LAT -44 & quakes$LONG 171 & quakes$LONG 173.5, library(MASS)quakeDens - kde2d(cantyQuakes$LONG, cantyQuakes$LAT, n=30)par(mar=rep(0, 4)zinterp - with(quakeDens, z-1, -1 + z-1, -ncol(z) + z-nrow(z), -1 + z-nrow(z), -ncol(z)persp(quakeDens, scale=FALSE, expand=0.02, theta=60, d=.1, r=.1, axes=FALSE, box=FALSE, col=gray(.4 + 1:6/10)cut(zinterp, 6)16.6quakes - read.csv(Quake/earthquakes.csv)NZquakes - quakesc(LAT, LONG, MAG, DEPTH)cantyQuakes - quakesquakes$LAT -44 & quakes$LONG 171 & quakes$LONG 173.5, library(MASS)quakeDens - kde2d(cantyQuakes$LONG, cantyQuakes$LAT, n=30)shallowCantyQuakes - subset(cantyQuakes, DEPTH 20)trellis.device(pdf, color=FALSE, file=Figures/threed-cloud%d.pdf, onefile=FALSE)for (i in seq(40, 80, 20) print(cloud(-DEPTH LONG + LAT, shallowCantyQuakes, xlim=c(171, 173), ylim=c(-44.5, -42.5), pch=16, col=rgb(0, 0, 0, .5), screen=list(z=i, x=-70)dev.off()16.7quakes - read.csv(Quake/earthquakes.csv)NZquakes - quakesc(LAT, LONG, MAG, DEPTH)cantyQuakes - quakesquakes$LAT -44 & quakes$LONG 171 & quakes$LONG 173.5, library(MASS)quakeDens - kde2d(cantyQuakes$LONG, cantyQuakes$LAT, n=30)shallowCantyQuakes - subset(cantyQuakes, DEPTH 20)library(scatterplot3d)par(lab=c(3, 3, 0)s3d - with(shallowCantyQuakes, scatterplot3d(-DEPTH LONG + LAT, angle=30, scale.y=0.45, type=n, pch=16, color=rgb(0, 0, 0, .5), x.ticklabs=pretty(LONG, 3), grid=FALSE, zlim=c(-20, 0)quakeDensXY - kde2d(shallowCantyQuakes$LONG, shallowCantyQuakes$LAT, n=30)lapply(contourLines(quakeDensXY, nlevels=8), function(cl) polygon(s3d$xyz.convert(cl$x, cl$y, rep(-20, length(cl$x), lwd=.5, col=gray(.8 - cl$level/20), border=NA) )quakeDensXZ - kde2d(shallowCantyQuakes$LONG, -shallowCantyQuakes$DEPTH, n=30)lapply(contourLines(quakeDensXZ, nlevels=8), function(cl) polygon(s3d$xyz.convert(cl$x, rep(-43.2, length(cl$x), cl$y), lwd=.5, col=gray(.8 - 2*cl$level), border=NA) )quakeDensYZ - kde2d(shallowCantyQuakes$LAT, -shallowCantyQuakes$DEPTH, n=30)lapply(contourLines(quakeDensYZ, nlevels=8), function(cl) polygon(s3d$xyz.convert(rep(171.5, length(cl$x), cl$x, cl$y), lwd=.5, col=gray(.8 - cl$level), border=NA) )lapply(contourLines(quakeDensYZ, nlevels=8), function(cl) polygon(s3d$xyz.convert(rep(173.5, length(cl$x), cl$x, cl$y), lwd=.5, col=gray(.8 - cl$level), border=NA) )with(shallowCantyQuakes, s3d$points3d(-DEPTH LONG + LAT, pch=16, col=rgb(0, 0, 0, .3)s3d$box()16.8library(rgl)quakes - read.csv(Quake/earthquakes.csv)NZquakes - quakesc(LAT, LONG, MAG, DEPTH)cantyQuakes - quakesquakes$LAT -44 & quakes$LONG 171 & quakes$LONG 173.5, library(MASS)quakeDens - kde2d(cantyQuakes$LONG, cantyQuakes$LAT, n=30)open3d(windowRect=c(0, 0, 900, 450)# clear3d(all)persp3d(quakeDens$x, quakeDens$y, quakeDens$z, aspect=c(1, 0.55, .2), col=white, box=FALSE, axes=FALSE, xlab=, ylab=, zlab=)par3d(userMatrix=rotationMatrix(-80/180*pi, 1, 0, 0)%*% rotationMatrix(-65/180*pi, 0, 0, 1), zoom=.5)snapshot3d(Figures/threed-rglpersp.png)system(cp Figures/threed-rglpersp.png Web/)16.9library(rgl)library(misc3d)quakes - read.csv(Quake/earthquakes.csv)NZquakes - quakesc(LAT, LONG, MAG, DEPTH)cantyQuakes - quakesquakes$LAT -44 & quakes$LONG 171 & quakes$LONG 173.5, library(MASS)quakeDens - kde2d(cantyQuakes$LONG, cantyQuakes$LAT, n=30)shallowCantyQuakes - subset(cantyQuakes, DEPTH 20)d - with(shallowCantyQuakes, kde3d(LONG, LAT, -DEPTH, h=c(.1, .1, 2), n = 30) )open3d(windowRect=c(0, 0, 900, 900)with(shallowCantyQuakes, plot3d(LONG, LAT, -DEPTH, aspect=c(1, 0.55, 1), axes=TRUE, box=FALSE, xlab=, ylab=, zlab=) contour3d(d$d, c(.4, .1), d$x, d$y, d$z, color=rep(gray80, 2), color2=gray, specular=black, engine=rgl, add=TRUE, alpha=.5) )par3d(userMatrix=rotationMatrix(-60/180*pi, 1, 0, 0)%*% rotationMatrix(-40/180*pi, 0, 0, 1), zoom=.9)snapshot3d(Figures/contour3d.png)system(cp Figures/contour3d.png Web/threed-contour3d.png)16.10library(rgl)open3d(windowRect=c(0, 0, 600, 600)clear3d(all)light3d()material3d(shininess=100, specular=black)# Headradius - function(d) pchisq(d2, 3)shade3d(ellipse3d(diag(3), level=radius(1), centre=c(0, 0, 1), color=yellow)# Neck# logo is 100x76png(rlogoExtended.png, width=500, height=250)library(grid)grid.rect(gp=gpar(col=NA, fill=yellow)library(png)rlogo - as.raster(readPNG(system.file(extra, Rlogo.png, package=RGraphics)rlogorlogo = #FFFFFF - yellowgrid.raster(rlogo, x=.6, y=.01, width=.08, just=c(bottom)dev.off()shade3d(cylinder3d(cbind(0, 0, c(-1.4, 1), e1=cbind(0, 0, 1), e2=cbind(1, 0, 0), sides=100), color=yellow, texture=rlogoExtended.png, texcoords=list(x=rep(seq(1, 0, length.out=101), each=4)-c(1:2, 403:404), y=rep(c(0, 1, 1, 0), 50)old - function() shade3d(cylinder3d(cbind(0, 0, c(-1.3, 1), e1=cbind(0, 0, 1), e2=cbind(1, 0, 0), sides=100), color=yellow)# Eyeseyeball - ellipse3d(diag(3), level=radius(.4)shade3d(translate3d(eyeball, .8, .35, .7), color=white)shade3d(translate3d(eyeball, .8, -.35, .7), color=white)# Translate radius of eye, rotate, translate position of eyepupil - rotate3d(translate3d(ellipse3d(diag(3), level=radius(.05), .4, 0, 0), 30/180*pi, 0, 0, 1)shade3d(translate3d(pupil, .8, .35, .7), color=black)shade3d(translate3d(pupil, .8, -.35, .7), color=black)# points3d(1.21, c(-.35, .35), .7, cex=3)# Noseshade3d(cylinder3d(cbind(c(1, 1.3), 0, .3), radius=.2, e1=cbind(1, 0, 0), e2=cbind(0, 1, 0), sides=100), color=yellow)shade3d(ellipse3d(diag(3), level=radius(.2), centre=c(1.3, 0, .3), color=yellow)# Mouthshade3d(elli
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 【教案版】小学二班级上册 球类活动2
- 2025年电气工程师中级面试实战指南及模拟题答案详解
- 2025年熔化焊接工艺考试宝典与模拟题集
- 2025年营养师中级考试指南与备考策略
- 2025年电子商务运营专家初级面试预测题与解析
- 2025年电子商务网络安全工程师面试秘籍与预测题
- 电力基础安全知识培训课件
- 2025年护士执业资格高级考试试题集及答题技巧
- 2025年烈士纪念设施保护单位招聘面试常见问题及答案
- 2025年山东省青岛李沧区中考化学二模试卷
- 印花税课件教学课件
- 2025年房地产开发商独家代理销售合作协议范本
- 2025年LNG加气站市场行业研究报告及未来发展趋势预测
- 2026创新设计高考总复习生物(人教版)-第十单元 第58课时 植物细胞工程
- 排污许可审核方案投标文件(技术方案)
- 临床医学特招考试题及答案2025版
- 2025阿拉尔经济技术开发区第二轮(4人)考前自测高频考点模拟试题附答案详解
- 双拥经费管理办法
- 人工智能助力实验学校教育质量提升实施方案
- 《无人机飞行安全及法律法规》第3版全套教学课件
- 2025房屋租赁合同范本(官方版)
评论
0/150
提交评论