Description Usage Arguments Details Value Note References See Also Examples
Plot a two-parameter surface in three dimensions.
1 2 3 4 5 |
fx,fy,fz |
vectorized functions of u and v to compute the
|
u |
numeric vector of u values. |
v |
numeric vector of v values. |
umin |
numeric; the minimum value of u. Ignored if |
umax |
numeric; the maximum value of u. Ignored if |
vmin |
numeric; the minimum value of v. Ignored if |
vmax |
numeric; the maximum value of v. Ignored if |
n |
the number of equally spaced |
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 |
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". |
add |
logical; if |
draw |
logical; if |
engine |
character; currently "rgl", "standard", "grid" or "none"; for "none" the computed triangles are returned. |
... |
additional rendering arguments, e.g. material and texture
properties for the "rgl" engine. See documentation for
|
Analogous to Mathematica's Param3D
. Evaluates the
functions fx
, fy
, and fz
specifying the
coordinates of the surface at a grid of values for the
parameters u
and v
.
For the "rgl" engine the returned value is NULL
. For the
"standard" and "grid" engines the returned value is the viewing
transformation as returned by persp
. For the engine "none", or
when draw
is not true, the returned value is a structure
representing the triangles making up the surface.
The "rgl" engine now uses the standard rgl coordinates instead of
negating y
and swapping y
and z
. If you need to
reproduce the previous behavior you can use
options(old.misc3d.orientation=TRUE)
.
Transparency only works properly in the "rgl" engine. For standard or grid graphics on pdf or quartz devices using alpha levels less than 1 does work but the triangle borders show as a less transparent mesh.
Daniel Adler, Oleg Nenadic and Walter Zucchini (2003) RGL: A R-library for 3D visualization with OpenGL
surface3d
,
material3d
,scatterplot3d
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #Example 1: Ratio-of-Uniform sampling region of bivariate normal
parametric3d(fx = function(u, v) u * exp(-0.5 * (u^2 + v^2 -
2 * 0.75 * u * v)/sqrt(1-.75^2))^(1/3),
fy = function(u, v) v * exp(-0.5 * (u^2 + v^2 -
2 * 0.75 * u * v)/sqrt(1-.75^2))^(1/3),
fz = function(u, v) exp(-0.5 * (u^2 + v^2 - 2 * 0.75 * u *
v)/sqrt(1-.75^2))^(1/3),
umin = -20, umax = 20, vmin = -20, vmax = 20,
n = 100)
parametric3d(fx = function(u, v) u * exp(-0.5 * (u^2 + v^2 -
2 * 0.75 * u * v)/sqrt(1-.75^2))^(1/3),
fy = function(u, v) v * exp(-0.5 * (u^2 + v^2 -
2 * 0.75 * u * v)/sqrt(1-.75^2))^(1/3),
fz = function(u, v) exp(-0.5 * (u^2 + v^2 - 2 * 0.75 * u *
v)/sqrt(1-.75^2))^(1/3),
u = qcauchy((1:100)/101), v = qcauchy((1:100)/101))
parametric3d(fx = function(u, v) u * exp(-0.5 * (u^2 + v^2 -
2 * 0.75 * u * v)/sqrt(1-.75^2))^(1/3),
fy = function(u, v) v * exp(-0.5 * (u^2 + v^2 -
2 * 0.75 * u * v)/sqrt(1-.75^2))^(1/3),
fz = function(u, v) exp(-0.5 * (u^2 + v^2 - 2 * 0.75 * u *
v)/sqrt(1-.75^2))^(1/3),
u = qcauchy((1:100)/101), v = qcauchy((1:100)/101),
engine = "standard", scale = FALSE, screen = list(x=-90, y=20))
#Example 2: Ratio-of-Uniform sampling region of Bivariate t
parametric3d(fx = function(u,v) u*(dt(u,2) * dt(v,2))^(1/3),
fy = function(u,v) v*(dt(u,2) * dt(v,2))^(1/3),
fz = function(u,v) (dt(u,2) * dt(v,2))^(1/3),
umin = -20, umax = 20, vmin = -20, vmax = 20,
n = 100, color = "green")
parametric3d(fx = function(u,v) u*(dt(u,2) * dt(v,2))^(1/3),
fy = function(u,v) v*(dt(u,2) * dt(v,2))^(1/3),
fz = function(u,v) (dt(u,2) * dt(v,2))^(1/3),
u = qcauchy((1:100)/101), v = qcauchy((1:100)/101),
color = "green")
parametric3d(fx = function(u,v) u*(dt(u,2) * dt(v,2))^(1/3),
fy = function(u,v) v*(dt(u,2) * dt(v,2))^(1/3),
fz = function(u,v) (dt(u,2) * dt(v,2))^(1/3),
u = qcauchy((1:100)/101), v = qcauchy((1:100)/101),
color = "green", engine = "standard", scale = FALSE)
#Example 3: Surface of revolution
parametric3d(fx = function(u,v) u,
fy = function(u,v) sin(v)*(u^3+2*u^2-2*u+2)/5,
fz = function(u,v) cos(v)*(u^3+2*u^2-2*u+2)/5,
umin = -2.3, umax = 1.3, vmin = 0, vmax = 2*pi)
parametric3d(fx = function(u,v) u,
fy = function(u,v) sin(v)*(u^3+2*u^2-2*u+2)/5,
fz = function(u,v) cos(v)*(u^3+2*u^2-2*u+2)/5,
umin = -2.3, umax = 1.3, vmin = 0, vmax = 2*pi,
engine = "standard", scale = FALSE,
color = "red", color2 = "blue", material = "shiny")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.