lines3d(vrmlgen)
lines3d()所属R语言包:vrmlgen
Draw lines in a 3D-scene
在3D场景中画线
译者:生物统计家园网 机器人LoveR
描述----------Description----------
lines3d draws lines in a 3D-scene in the VRML- or Livegraphics3D-format. Must be called after vrml.open() or lg3d.open() and before vrml.close() or lg3d.close().
lines3d绘制线条在3D场景中的VRML或Livegraphics3D的格式。必须调用后vrml.open()或lg3d.open()和的vrml.close()或lg3d.close(前)。
用法----------Usage----------
lines3d(x, y = NULL, z = NULL, col = "black", lwd = 1)
参数----------Arguments----------
参数:x
a 3-column numeric matrix of coordinates or a numeric vector of x-coordinates
具有3列的数值矩阵的坐标或一个数值向量的x坐标
参数:y
a numeric vector of y-coordinates (only needed if x is a vector)
一个数值向量的y坐标(只需要如果x是一个向量)
参数:z
a numeric vector of z-coordinates (only needed if x is a vector)
一个数值向量的z坐标(如果只需要x是一个向量)
参数:col
the color of the text
文本的颜色
参数:lwd
a numerical scaling factor specifying the line width
数值指定的线宽度的比例因子
Details
详细信息----------Details----------
lines3d adds lines at specified start- and end-points to a 3D-scene in the VRML- or Livegraphics3D-format. In the x,y and z coordinate parameters, the odd-numbered entries represent the line start-points and the subsequent even-numbered entries contain the corresponding end-points. lines3d can only be applied within a VRML- or Livegraphics3D-environment created by calling the vrml.open() or lg3d.open() function and closed using the vrml.close() or lg3d.close() function.
在指定的开始和结束点lines3d行添加到三维场景中的VRML或Livegraphics3D的格式。在x,y和z坐标的参数中,奇数号的条目表示的行开始点和随后的偶数的条目中包含的相应端点。 lines3d只能适用于内的VRML或Livegraphics3D的环境调用vrml.open()或lg3d.open()函数和封闭使用的vrml.close()或lg3d.close()函数创建的。
值----------Value----------
The function is used for its side-effect (writing lines to a VRML- or Livegraphics3D-file) and has no return value.
该功能用于其副作用(写一个VRML文件或Livegraphics3D)并没有返回值。
(作者)----------Author(s)----------
Enrico Glaab
参考文献----------References----------
3D Data Visualization on the Web. Journal of Statistical Software, 36(8), p. 1-18. URL: http://www.jstatsoft.org/v36/i08/
参见----------See Also----------
text3d, points3d
text3d,points3d
实例----------Examples----------
curdir <- getwd()
outdir <- tempdir()
setwd(outdir)
# This example loads the atom coordinates of a molecule[例如加载一个分子的原子坐标]
# (C60, fullerene) and visualizes the molecule in 3D[富勒烯(C60,富勒烯)和在3D可视化的分子]
# using points for the atoms and lines for the atom bonds[使用点的原子和原子的线]
# (atom pairs within a given distance threshold).[(原子对给定距离内的阈值)。]
vrml.open(file = "c60.wrl", navigation = "EXAMINE",
html.embed = "c60example.html")
# load dataset[负载数据集]
data(c60coords)
# plot the atoms as black spheres[绘制原子的黑球]
points3d(c60coords, col = "black")
# plot the atom bonds as gray lines[灰线绘制原子]
# (for all atom pairs with a Euclidean distance < 0.66)[(所有原子对一个欧氏距离<0.66)]
for(j in 1nrow(c60coords)-1))
{
for(k in (j+1):nrow(c60coords))
{
if(sqrt(sum((c60coords[j,]-c60coords[k,])^2)) < 0.66)
lines3d(c60coords[c(j,k),], col = "gray", lwd = 1)
}
}
vrml.close()
# show the output in a web-browser [在Web浏览器中显示的输出]
# (VRML-plugin must be installed!)[(VRML插件必须安装!)]
if(file.exists(paste("file://",file.path(outdir,
"c60example.html"), sep = "")))
{
browseURL(paste("file://",file.path(outdir,
"c60example.html"), sep = ""))
}
setwd(curdir)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|