Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

surfaceTriangles

Create a Triangle Mesh Representing a Surface


Description

Creates a triangle mesh object representing a surface over a rectangular grid.

Usage

surfaceTriangles(x, y, f, color = "red", color2 = NA, alpha = 1,
                 fill = TRUE, col.mesh = if (fill) NA else color,
                 smooth = 0, material = "default")

Arguments

x, y

numeric vectors.

f

numeric matrix of dimension length(x) by length(y) or vectorized function of two arguments.

color

color to use for the surface. Can also be a function of three arguments. This is called with three arguments, the coordinates of the midpoints of the triangles making up the surface. The function should return a vector of colors to use for the triangles.

color2

opposite face color.

alpha

alpha channel level, a number between 0 and 1..

fill

logical; if TRUE, drawing should use filled surfaces; otherwise a wire frame should be drawn.

col.mesh

color to use for the wire frame.

smooth

integer or logical specifying Phong shading level for "standard" and "grid" engines or whether or not to use shading for the "rgl" engine.

material

material specification; currently only used by "standard" and "grid" engines. Currently possible values are the character strings "dull", "shiny", "metal", and "default".

Value

Returns a triangle mesh object representing the surface.

See Also

Examples

drawScene(surfaceTriangles(seq(-1,1,len=30), seq(-1,1,len=30),
                             function(x, y) (x^2 + y^2), color2 = "green"))
  drawScene.rgl(surfaceTriangles(seq(-1,1,len=30), seq(-1,1,len=30),
                             function(x, y) (x^2 + y^2), color2 = "green"))

misc3d

Miscellaneous 3D Plots

v0.9-0
GPL
Authors
Dai Feng and Luke Tierney
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.