3D Plot

Plot a 3D helix by generating x, y, z coordinates and rendering with Hugin's 3D plotting support.

(*---------------------------------------------------------------------------
  Copyright (c) 2026 The Raven authors. All rights reserved.
  SPDX-License-Identifier: ISC
  ---------------------------------------------------------------------------*)

open Nx

let create_helix_data () =
  let t = linspace float32 0. (4. *. Float.pi) 100 in
  let x = cos t in
  let y = sin t in
  let z = map_item (fun t -> t /. (4. *. Float.pi)) t in
  (x, y, z)

let () =
  let x, y, z = create_helix_data () in
  let fig =
    Hugin.plot3d ~title:"3D Helix" ~xlabel:"x" ~ylabel:"y" ~zlabel:"z" x y z
  in
  Hugin.show fig