[OCaml] aircraft-studio redux.
1
(* Main function to plot the coordinates *)
2
3
let airfoil_plot naca_num =
4
(* let filename = Printf.sprintf "static/airfoil-%s.svg" naca_num in *)
5
let open Naca in
6
(* Initialize plplot *)
7
Plplot.plsdev "xwin";
8
(* Plplot.plsfnam filename; *)
9
Plplot.plinit ();
10
Plplot.plenv (-0.2) 1.2 (-0.3) 0.3 1 0;
11
12
(* Set the labels *)
13
let x_label = "relative x" in
14
let y_label = "y_t" in
15
let title =
16
Printf.sprintf "NACA %s Airfoil Thickness Distribution" naca_num
17
in
18
Plplot.pllab x_label y_label title;
19
Naca4.plot_airfoil naca_num ~amt:10 ();
20
21
(* End the plot *)
22
Plplot.plend ()
23
(* filename *)
24
25
(* let main_page naca_num = *)
26
(* let file = airfoil_plot naca_num in *)
27
(* "Hello world!" ^ Printf.sprintf "<img src='%s' alt=''>" file *)
28
29
let () =
30
airfoil_plot "4412"
31
(* Dream.run @@ Dream.logger *)
32
(* @@ Dream.router *)
33
(* [ *)
34
(* Dream.get "/" (fun _ -> Dream.html @@ main_page "9412"); *)
35
(* Dream.get "/static/**" (Dream.static "static"); *)
36
(* ] *)
37