楼主: xlk75
3218 0

[问答] 如何在RGL中的lines3d添加颜色 [推广有奖]

  • 0关注
  • 0粉丝

已卖:12份资源

硕士生

52%

还不是VIP/贵宾

-

威望
0
论坛币
567 个
通用积分
3.8504
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
4951 点
帖子
262
精华
0
在线时间
59 小时
注册时间
2008-6-14
最后登录
2023-12-7

楼主
xlk75 发表于 2012-6-3 22:42:55 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

The codes are:

###MODELING THE cylinder UNDER UNIFORM CURRENT
##########define the detail parameters
H=10;C=50;M<-8
mx<-matrix(NA,nrow=9,ncol=40)
mt<-matrix(NA,nrow=40,ncol=8)
lx<-list();ly<-list();lz<-list();lt<-list();lf<-list()
for(i in 1:T){
lx[]<-mx;ly[]<-mx;lz[]<-mx;lt[]<-mx;lf[]<-mt}
for(i in seq(1,9,1)){
for(j in seq(1,40,1)){
lx[[1]][i,j]<-(C/2/pi)*cos(9*(j-1)*pi/180)
ly[[1]][i,j]<-(C/2/pi)*sin(9*(j-1)*pi/180)
lz[[1]][i,j]<-H/M*(i-1)
}
}
lt[[1]]<-matrix(1:360,nrow=9,ncol=40)
lf[[1]]<-matrix(1:320,nrow=40,ncol=8)
lt means the circle element force
lf means the axis element force
a means thecircumference element length
b means axis element length
display 3D shape

library(rgl)
open3d()
plot3d(lx[[1]],ly[[1]],lz[[1]],type="p",xlab = "x", ylab = "y", zlab = "z",size="2.0",lwd=2)
for(i in seq(1,9,1)){######draw circle element lines, lt[[1]] means the circle element force
for(j in seq(1,39,1)){
lines3d(c(lx[[1]][i,j],lx[[1]][i,j+1]),c(ly[[1]][i,j],ly[[1]][i,j+1]),c(lz[[1]][i,j],lz[[1]][i,j+1]),lwd=2)
lines3d(c(lx[[1]][i,1],lx[[1]][i,40]),c(ly[[1]][i,1],ly[[1]][i,40]),c(lz[[1]][i,1],lz[[1]][i,40]),lwd=2)
} }
for(i in seq(1,8,1)){######draw the axis element lines lf[[1]]means the axis element force
for(j in seq(1,40,1)){
lines3d(c(lx[[1]][i,j],lx[[1]][i+1,j]),c(ly[[1]][i,j],ly[[1]][i+1,j]),c(lz[[1]][i,j],lz[[1]][i+1,j]),lwd=2)

}}
The figure 2 is the cylinear with lines. 无标题.jpg

The problem is how to add color in lines3d to show different element by the fourth variable and the fifth varible. The fourth varible adn fifth varible are lt[[1]] and lf[[1]], separately.


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:lines3d Lines line Lin parameters lines3d rgl color

风神时代

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-22 22:19