File: Measure

package info (click to toggle)
dxsamples 4.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 26,348 kB
  • ctags: 1,513
  • sloc: ansic: 10,079; sh: 8,445; java: 1,772; makefile: 1,101
file content (26 lines) | stat: -rw-r--r-- 869 bytes parent folder | download | duplicates (5)
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
// This program finds both the surface area and the volume of an isosurface,
// and captions the image with this information.

cloudwater = Import("cloudwater");
camera = AutoCamera(cloudwater,"off-diagonal");

macro make_picture(isovalue)
{
  isosurface = Isosurface(cloudwater, isovalue);
  surface_area = Measure(isosurface);
  surface_area = Compute("$0/1e6", surface_area);
  volume = Measure(isosurface, "volume");
  volume = Compute("$0/1e9", volume);
  caption1 = Format("isovalue = %4.2f", isovalue);
  caption2 = Format("surface area = %5.0f square km", surface_area);
  caption3 = Format("volume = %5.0f cubic km", volume);
  caption = List(caption1, caption2, caption3);
  caption = Caption(caption);
  collected = Collect(caption, isosurface);
  Display(collected,camera);
}

make_picture(0.15);
make_picture(0.75);
make_picture(1.00);
make_picture(1.50);