hi, i want to draw a simple circle by using 3d package RGL. i think i can use the command rgl.lines by studying the code from: http://www.swiftless.com/tutorials/opengl/circle.html but is there a faster and easier way to do it?? graham -- View this message in context: http://r.789695.n4.nabble.com/RGL-Drawing-Circle-tp4278717p4278717.html Sent from the R help mailing list archive at Nabble.com.
On 09/01/2012 10:12 AM, gli wrote:> hi, i want to draw a simple circle by using 3d package RGL. > > i think i can use the command rgl.lines by studying the code from: > > http://www.swiftless.com/tutorials/opengl/circle.html > > but is there a faster and easier way to do it??The code on that page is much more complicated than necessary. rgl will handle most of the calls to OpenGL; you just need to work out the geometry of the circle. The difficulty you might have is whether you want something that appears to be a circle, or something that is a circle in user-coordinates. For the latter, try something like: n <- 300 theta <- seq(0, 2*pi, len=n) x <- cos(theta) y <- sin(theta) z <- rep(0, n) lines3d(x,y,z) The former is harder; I'd probably do it by drawing a sphere and turning off lighting, but the overlaps don't look quite right if they aren't all the same colour: spheres3d(rnorm(10), rnorm(10), rnorm(10), lit=FALSE, col=rainbow(10)) Duncan Murdoch
thanks Duncan. I think want my circle to be in user coordinates. I tried the first code u gave me and it gives me a circle. but how can i: 1) change the radius ? 2) place the circle at a given x,y,z coordinate? 3) turn it 90 degree up like these circle plate bus stop? http://www.geocities.co.jp/yuganatabi/bus-stop-aba.html 4) and finally, set the orientation angle of the circle plate? grateful if u give me some directions or at least let me know if it is possible or not. graham -- View this message in context: http://r.789695.n4.nabble.com/RGL-Drawing-Circle-tp4278717p4285503.html Sent from the R help mailing list archive at Nabble.com.
On 11.01.2012 15:08, gli wrote:> thanks Duncan. I think want my circle to be in user coordinates. I tried > the first code u gave me and it gives me a circle. but how can i: > > 1) change the radius ? > > 2) place the circle at a given x,y,z coordinate? > > 3) turn it 90 degree up like these circle plate bus stop? > http://www.geocities.co.jp/yuganatabi/bus-stop-aba.html > > 4) and finally, set the orientation angle of the circle plate?What about readin the help pages for the functions Duncan cited? Uwe Ligges> grateful if u give me some directions or at least let me know if it is > possible or not. > > graham > > -- > View this message in context: http://r.789695.n4.nabble.com/RGL-Drawing-Circle-tp4278717p4285503.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.
On 12.01.2012 13:21, gli wrote:> thanks for the help, Duncan. but when you said "study some geometry",He meant basic school maths, I suppose. Uwe> do you > mean the rgl package pdf reference mannual or other documents? please > clarify. i am a total beginner on rgl. > > graham > > -- > View this message in context: http://r.789695.n4.nabble.com/RGL-Drawing-Circle-tp4278717p4288776.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.