summaryrefslogtreecommitdiff
path: root/bin/main.ml
blob: 0767aa7c2725da80c106e2b18366b4144406527b (plain)
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
27
28
29
30
31
32
33
34
35
36
(* Main function to plot the coordinates *)

let airfoil_plot naca_num =
  (* let filename = Printf.sprintf "static/airfoil-%s.svg" naca_num in *)
  let open Naca in
  (* Initialize plplot *)
  Plplot.plsdev "xwin";
  (* Plplot.plsfnam filename; *)
  Plplot.plinit ();
  Plplot.plenv (-0.2) 1.2 (-0.3) 0.3 1 0;

  (* Set the labels *)
  let x_label = "relative x" in
  let y_label = "y_t" in
  let title =
    Printf.sprintf "NACA %s Airfoil Thickness Distribution" naca_num
  in
  Plplot.pllab x_label y_label title;
  Naca4.plot_airfoil naca_num ~amt:10 ();

  (* End the plot *)
  Plplot.plend ()
  (* filename *)

(* let main_page naca_num = *)
(*   let file = airfoil_plot naca_num in *)
(*   "Hello world!" ^ Printf.sprintf "<img src='%s' alt=''>" file *)

let () =
  airfoil_plot "4412"
  (* Dream.run @@ Dream.logger *)
  (* @@ Dream.router *)
  (*      [ *)
  (*        Dream.get "/" (fun _ -> Dream.html @@ main_page "9412"); *)
  (*        Dream.get "/static/**" (Dream.static "static"); *)
  (*      ] *)
Copyright 2019--2025 Marius PETER