Class for creating an opengl scene with rgl.
Class for creating an opengl scene with rgl.
default_material
default material
width, height
dimensions of rgl window
polygon_offset, polygon_offset_delta
current polygon offset, and the delta to adjust the offset by every time an element is drawn
width, height
dimensions of rgl window
polygon_offset, polygon_offset_delta
current polygon offset, and the delta to adjust the offset by every time an element is drawn
new()
initialise
RGLDoc$new( fov = 30, width = 800, height = 600, zscale = 1, view = c("front", "flat"), view_angle = 0, view_flat_angle = -45, zoom = 0.8, view3d_args = NULL, light = list(theta = 0, phi = 0), background = list(color = "white"), default_material = standard_material, polygon_offset_delta = 0.03, ... )
fov
field of view. default: 0 isometric view. Other good values are 30 and 45.
width, height
dimensions of viewing window. default 800x600
zscale
scale factor applied to z axis. default 1.
view
One of 'front', 'flat'. This will be ignored if view3d_args
is set.
view_angle
rotation angle of view in degrees. Only used if view
is
'front' or 'flat'. Default: 0
view_flat_angle
angle to tip view when view is 'flat'.
zoom
zoom level. default 0.800. Larger values make the plot appear further from the screen.
view3d_args
full viewpoint specification as a list of arguments to
rgl::view3d()
. Default: NULL
light
list of arguments to rgl.light()
to define the
light for this scene.
background
list of arguments to rgl.bg()
to define the
background for these scene
default_material
default material for objects
polygon_offset_delta
incremental change in polygon_offset
after
every element is rendered. Adjust this value to try and
minimise issues with z-fighting of overlapping elements.
...
other arguments passed to rgl::open3d()
Add a circle
circle()
RGLDoc$circle( x, y, z, r, colour, color = colour, alpha = 1, circle_segments = 30 )
x, y, z
coords
r
radius
colour, color
colour
alpha
alpha
circle_segments
number of segments to render for a circle Add an arbitrary call to this document
add_call()
RGLDoc$add_call(cc, default_args = standard_material)
cc
standard R call object
default_args
default args Add a sphere
sphere()
RGLDoc$sphere(x, y, z, r, colour, color = colour, alpha = 1)
x, y, z
coords
r
radius
colour, color
colour
alpha
alpha Add a point
point()
RGLDoc$point(x, y, z, r, colour, color = colour, alpha = 1)
x, y, z
coords
r
radius
colour, color
colour
alpha
alpha Add a rect
rect()
RGLDoc$rect( x1, y1, x2, y2, z, colour, fill, lwd = 3, color = colour, alpha = 1 )
x1, y1, x2, y2, z
coords
colour, color, fill
colour
lwd
line width i.e. size
alpha
alpha Add a line
line()
RGLDoc$line(x1, y1, x2, y2, z, colour, lwd = 3, color = colour)
x1, y1, x2, y2, z
coords
colour, color
colour
lwd
line width i.e. size Add a polyline
polyline()
RGLDoc$polyline(xs, ys, z, colour, lwd = 3, color = colour)
xs, ys, z
coords
colour, color
colour
lwd
line width i.e. size Add a polygon
polygon_old()
RGLDoc$polygon_old(xs, ys, z = 0, colour, fill, alpha = 1, lwd = 3)
xs, ys, z
coords
colour, fill
colour
alpha
alpha
lwd
line width i.e. size Add a polygon
polygon()
RGLDoc$polygon(xs, ys, z = 0, colour, fill, alpha = 1, lwd = 3)
xs, ys, z
coords
colour, fill
colour
alpha
alpha
lwd
line width i.e. size Add a path
path()
RGLDoc$path(df, colour, fill, alpha = 1, lwd = 3)
df
polygon specification
colour, fill
colour
alpha
alpha
lwd
line width i.e. size Add text
text()
RGLDoc$text(text, x, y, z = 0, colour, cex = 1)
text
text to write
x, y, z
coords
colour, color
colour
cex
character expansion values Render an image onto a quad
image_as_quad()
RGLDoc$image_as_quad( png_filename, x, y, z, width, height, alpha = 1, angle = 0, option = 0 )
png_filename
filename of PNG to add to image
x, y
display position
z
height
width, height
display width and height
alpha
overall alpha
angle
rotation angle of quad around the z axis
option
generic option to control rendering Save as PNG or WebGL based upon suffix
save()
RGLDoc$save(filename)
filename
filename
clone()
The objects of this class are cloneable with this method.
RGLDoc$clone(deep = FALSE)
deep
Whether to make a deep clone.