[R] rgl: plane3d or abline() analog

Duncan Murdoch murdoch.duncan at gmail.com
Wed May 5 02:39:19 CEST 2010

On 04/05/2010 4:19 PM, David Winsemius wrote:
> On May 4, 2010, at 4:09 PM, Michael Friendly wrote:
>> For use with rgl, I'm looking for a function to draw a plane in an  
>> rgl scene that would function
>> sort of like abline(a, b) does in base graphics, where abline(0, 1)  
>> draws a line of unit slope through
>> the origin. Analogously, I'd like to have a plane3d function, so  
>> that plane3d(0, 1, 1) draws a
>> plane through the origin with unit slopes in x & y and plane3d(3, 0,  
>> 0) draws a horizontal plane
>> at z=3.
>> I see that scatterplot3d in the scatterplot3d package returns a  
>> plane3d() *function* for a given
>> plot.  I could probably try to adapt this, but before I do, I wonder  
>> if something like this for
>> rgl exists that I haven't found.
> ?quads3d
It's harder than that, because a plane intersecting with the bounding 
box of the data doesn't necessarily produce a quadrilateral:  some are 
other polygons (e.g. an
intersection near a corner can be a triangle).  Plus, you want to still 
see a plane if you add new data and change the bounding box.  So this is 
something that really needs to be done at the C++ level, and though I've 
wanted one every now and then, I've never got around to adding it.  
Maybe soon.

Duncan Murdoch

More information about the R-help mailing list