()
| 7 | |
| 8 | #[test] |
| 9 | fn 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] |
| 50 | fn test_surface_cylinder() -> Result<(), StrError> { |
nothing calls this directly
no test coverage detected