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.
linear | linearsymmetric | logarithmic
The color table to use when coloring is set to colortable. See Color Tables for a list of color tables.
none | reverse | nonlinear | nonlinearsymmetric
Transformation of the color table, 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 reverse to color table or gradient when coloring is set to colortable or gradient and colortabletrans is set to nonlinear or nonlinearsymmetric.
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 | label | manual | none
auto, if the title should be computed automatically. label, if the title should be the plot group’s label. manual, if the manual title should be used (the title property). none, if no title should be displayed.
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
String pgTag = model.result().uniquetag("pg");
ResultFeature pg = model.result().create(pgTag, 2);
ResultFeature plot = pg.create("surf1", "SurfaceData");
int N = 5;
double[][] p = new double[2][N+1];
int[][] t = new int[3][N];
double[] 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
String pgTag = model.result().uniquetag("pg");
ResultFeature pg = model.result().create(pgTag, 2);
ResultFeature plot = pg.create("surf1", "SurfaceData");
int Nx = 51;
int Ny = 51;
double[][] p = new double[3][Nx * Ny];
int[][] t = new int[3][2 * (Nx-1) * (Ny-1)];
double[] 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