MCPcopy Create free account
hub / github.com/elftausend/graplot / run

Function run

src/render/plot3d.rs:5–305  ·  view source on GitHub ↗
(plot: Plot3D)

Source from the content-addressed store, hash-verified

3use crate::{max_display, Plot3D, max_matrix, Marker};
4
5pub async fn run(plot: Plot3D) {
6
7 /*let xs = [-1., 1., 2.,];
8 let ys = [1., 1., 2.,];
9 let zs = [-1., 1., 3.];*/
10 let xs = plot.xs;
11 let ys = plot.ys;
12 let zs = plot.zs;
13
14 let mut max_x = max_matrix(&xs);
15 max_x = max_display(max_x, false);
16 let steps_x = 6.;
17 let step_x = max_x / steps_x;
18
19 let mut max_y = max_matrix(&ys);
20 max_y = max_display(max_y, false);
21 let steps_y = 6.;
22 let step_y = max_y / steps_y;
23
24 let mut max_z = max_matrix(&zs);
25 max_z = max_display(max_z, false);
26 let steps_z = 6.;
27 let step_z = max_z / steps_z;
28
29
30 let yaw: f32 = 1.18; //1.18
31
32 let front = vec3(
33 yaw.cos(),
34 0.,
35 yaw.sin(),
36 )
37 .normalize();
38
39 let world_up = vec3(0.0, 0.0, 1.0);
40 let right = front.cross(world_up).normalize();
41
42 let mut position = vec3(-14., 10., 13.);
43
44 loop {
45 clear_background(WHITE);
46
47 if is_key_pressed(KeyCode::Escape) {
48 break;
49 }
50
51 if is_key_down(KeyCode::A) {
52 //camera_z -= 0.3;
53 position -= front;
54 }
55
56 if is_key_down(KeyCode::D) {
57 //camera_z += 0.3;
58 position += front;
59 }
60
61 if is_key_down(KeyCode::W) {
62 position -= right;

Callers

nothing calls this directly

Calls 5

max_matrixFunction · 0.85
max_displayFunction · 0.85
draw_bottom_gridFunction · 0.85
draw_left_gridFunction · 0.85
draw_back_gridFunction · 0.85

Tested by

no test coverage detected