MCPcopy Create free account
hub / github.com/cpmech/plotpy / test_surface_geometry

Function test_surface_geometry

tests/test_surface_geometry.rs:9–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7
8#[test]
9fn test_surface_geometry() -> Result<(), StrError> {
10 // plane
11 let mut plane = Surface::new();
12 plane.set_colormap_name("terrain").draw_plane_nzz(
13 &[-1.0, 1.0, 1.0],
14 &[1.0, -1.0, 1.0],
15 -1.0,
16 1.0,
17 -1.0,
18 1.0,
19 3,
20 3,
21 )?;
22
23 // cap and cup
24 let mut cap = Surface::new();
25 let mut cup = Surface::new();
26 let (x, y, z, r) = (-1.0, -1.0, -1.0, 0.5);
27 cap.set_wire_line_color("red")
28 .set_with_surface(false)
29 .set_with_wireframe(true)
30 .draw_hemisphere(&[x, y, z], r, -180.0, 180.0, 10, 10, false)?;
31 cup.draw_hemisphere(&[x, y, z], r, -180.0, 180.0, 10, 10, true)?;
32
33 // add features to plot
34 let mut plot = Plot::new();
35 plot.add(&plane).add(&cap).add(&cup);
36
37 // save figure
38 let path = Path::new(OUT_DIR).join("integ_surface_geometry.svg");
39 plot.set_equal_axes(true).save(&path)?;
40
41 // check number of lines
42 let file = File::open(path).map_err(|_| "cannot open file")?;
43 let buffered = BufReader::new(file);
44 let lines_iter = buffered.lines();
45 assert!(lines_iter.count() > 1690);
46 Ok(())
47}
48
49#[test]
50fn test_surface_cylinder() -> Result<(), StrError> {

Callers

nothing calls this directly

Calls 9

draw_plane_nzzMethod · 0.80
draw_hemisphereMethod · 0.80
set_with_wireframeMethod · 0.80
set_with_surfaceMethod · 0.80
set_wire_line_colorMethod · 0.80
saveMethod · 0.80
set_equal_axesMethod · 0.80
set_colormap_nameMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected