SurfaceData
Create a surface data plot.
Syntax
model.result(<pgtag>).create(<ftag>,"SurfaceData");
model.result(<pgtag>).feature(<ftag>).set(property, <value>);
model.result(<pgtag>).feature(<ftag>).run();
Description
model.result(<pgtag>).create(<ftag>,"SurfaceData") creates a surface data plot feature named <ftag> belonging to the 2D or 3D plot group <pgtag>.
Surface data plots are used to visualize raw point data given as points, elements, normals (3D only), and colors as surfaces (see the examples below). Surface data plots can be added to 2D and 3D plot groups.
The following properties are available:
custom | black | blue | cyan | gray | green | magenta | red | white | yellow
custom | black | blue | cyan | gray | green |magenta | red | white | yellow
colortable | uniform | gradient
on | off
Whether to show color legend when coloring is set to colortable.
The color table to use when coloring is set to colortable. See Color Tables for a list of color tables.
on | off
Whether to reverse to color table or color gradient when coloring is set to colortable or gradient.
on | off
Whether to symmetrize the color range around 0 when coloring is set to colortable or gradient.
{1,0,0} or last used color.
The uniform color to use. Active when bottomcolor is set to custom.
{1,0,0} or last used color.
{1,0,0} or last used color.
The uniform color to use. Active when topcolor is set to custom.
on | off
Whether to use the manual color range specified in rangecolormin and rangecolormax. The color range specifies the minimum and maxim value in the plotted colors. Default is the minimum and maximum data values.
on | off
Whether to use the manual data range specified in rangedatamin and rangedatamax. Values outside the data range are not plotted.
The title to use when titletype is manual.
auto | manual | none
auto if the title contribution should be computed automatically. manual if the manual title contribution should be used (the title property). none if no title contribution should be used.
custom | black | blue | cyan | gray | green | magenta | red | white | yellow
Attributes
None.
Examples
A method for creating a pentagon as a 2D surface data plot:
Code for Use with Java
pg = m.result().create("pg3", 2);
plot = pg.create("surf1", "SurfaceData");
N = 5;
p = new double[2][N+1];
t = new int[3][N];
color = new double[N+1];
p[0][0] = 0;
p[1][0] = 0;
for (int i = 0; i < N; i++) {
double angle = i * 2 * Math.PI / N;
p[0][i + 1] = Math.cos(angle);
p[1][i + 1] = Math.sin(angle);
t[0][i] = 0;
t[1][i] = i + 1;
t[2][i] = 1 + (i + 1) % N;
}
plot.set("pointdata", p)
.set("elementdata", t)
.set("colordata", color);
plot.run();
A method for creating a surface data plot in 3D for data representing the sinc function (sampling function) as function of the radius r:
Code for Use with Java
pg = m.result().create("pg4", 3);
plot = pg.create("surf1", "SurfaceData");
int Nx = 51;
int Ny = 51;
p = new double[3][Nx * Ny];
t = new int[3][2 * (Nx-1) * (Ny-1)];
color = new double[Nx*Ny];
int pos = 0;
for (int i = 0; i < Ny; i++) {
for (int j = 0; j < Nx; j++) {
double x = 20 * (j - Nx / 2) / Nx;
double y = 20 * (i - Ny / 2) / Ny;
double r = Math.sqrt(x * x + y * y);
double z = 4 * ((r == 0) ? 1 : (Math.sin(r) / r));
p[0][pos] = x;
p[1][pos] = y;
p[2][pos] = z;
color[pos] = z;
pos++;
}
}
pos = 0;
for (int i = 0; i < Ny - 1; i++) {
for (int j = 0; j < Nx - 1; j++) {
int p00 = Nx * i + j;
int p01 = Nx * i + j + 1;
int p10 = Nx * (i + 1) + j;
int p11 = Nx * (i + 1) + j + 1;
t[0][pos] = p00;
t[1][pos] = p01;
t[2][pos] = p11;
pos++;
t[0][pos] = p00;
t[1][pos] = p11;
t[2][pos] = p10;
pos++;
}
}
plot.set("pointdata", p)
.set("elementdata", t)
.set("colordata", color);
plot.run();
The coloring of the sphere is based on the z-coordinate of each triangle point.
See Also
AnnotationData, ArrowData, LineData, PointData, TubeData