[R] rgl vertices

Duncan Murdoch murdoch at stats.uwo.ca
Wed Jun 10 19:55:17 CEST 2009


On 6/10/2009 1:44 PM, kapo coulibaly wrote:
> I'm trying to make sense of the following example in the package rgl:
> 
>  vertices <- c(
>      -1.0, -1.0, 0, 1.0,
>       1.0, -1.0, 0, 1.0,
>       1.0,  1.0, 0, 1.0,
>      -1.0,  1.0, 0, 1.0
>   )
>   indices <- c( 1, 2, 3, 4 )
> 
>   open3d()
>   wire3d( qmesh3d(vertices,indices) )
> One would think that each vertex would have 3 coordinates (x,y,z) what
> does the fourth one in the definition of the variable vertices stand
> for.

By default qmesh3d uses 4-coordinate homogeneous coordinates, because 
that's the coordinate system used by OpenGL.  See the ?rgl::matrices 
help topic for a description of how they work.

Duncan Murdoch




More information about the R-help mailing list