[R] joining two points in rgl

Nair, Murlidharan T mnair at iusb.edu
Wed Aug 19 21:51:25 CEST 2009


I tried the following

library(rgl)
pts<-structure(list(x = c(-0.975688, -0.975688), y = c(9.258795, -9.258795), z = c(-1.8, 1.8)), .Names = c("x", "y", "z"), class = "data.frame", row.names = c(NA, -2L))

plot3d(pts$x,pts$y,pts$z, col="grey", size=2, box=FALSE, axes=TRUE, type="s")
lines3d(pts$x,pts$y,pts$z, col="black", lwd=5)
x1<--0.975688 
y1<-9.258795  
z1<--1.8+0.2
x2<--0.975688 
y2<--9.258795 
z2<-1.8+0.2
text3d(x1,y1,z1,text=c("a"))
text3d(x2,y2,z2,text=c("t"))

cylinder3d(c(x1,y1,z1),c(x2,y2,z2))


1> I tried the above and could not get it to work. I did not understand how to give the Frenet coordinates. Can you give me some tip here please?

2> Is there a better way of writing the text than what I have done above? Can I make the spheres transparent so that if I write the text at the exact same coordinate of the sphere the text is above the sphere and can be seen?


Thanks ../Murli

 



-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Nair, Murlidharan T
Sent: Friday, August 14, 2009 4:14 PM
To: Duncan Murdoch
Cc: r-help at r-project.org
Subject: Re: [R] joining two points in rgl

>Thanks, for lwd. I could not find rgl 0.85. The latest one I saw was 0.84. Can you tell me where I can download it from? 
>

It's on r-forge.r-project.org

>Also, is there  a curve3d? I need to join two points in 3d smoothly. 
>
No, though par3dinterp could probably be faked into doing that.

Duncan Murdoch




Thanks ../Murli


-----Original Message-----
From: Duncan Murdoch [mailto:murdoch at stats.uwo.ca] 
Sent: Thursday, August 13, 2009 8:24 PM
To: Nair, Murlidharan T
Cc: r-help at r-project.org
Subject: Re: [R] joining two points in rgl

Nair, Murlidharan T wrote:
> Hi!!
>
> I need to draw a cylinder/tube joining two points. I am trying to make something presentable, I have been able to do it using lines3d. But is it possible to 
> increase the thickness of the lines? The size parameter does not work. Does any one have any suggestions?
>   
There's a new function cylinder3d  (in rgl 0.85) that probably does 
exactly what you want, but lwd is the parameter that controls line width.

Duncan Murdoch
> Thanks ../Murli
>
> library(rgl)
> pts<-structure(list(x = c(-0.975688, -0.975688), y = c(9.258795, -9.258795
> ), z = c(-1.8, 1.8)), .Names = c("x", "y", "z"), class = "data.frame", row.names = c(NA,
> -2L))
>
> plot3d(pts$x,pts$y,pts$z, col="grey", size=2, box=FALSE, axes=FALSE, type="s")
> lines3d(pts$x,pts$y,pts$z, col="grey", size=2)
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>   

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list