package elm_playground_gamekits

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file Path.ml

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
(* Claude Code
 *
 * Copyright (C) 2026 Yoann Padioleau
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public License
 * (LGPL) as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 *)
open Playground
open Basics (* float arithmetics *)

(* See Path.mli *)

type point = number * number
type t = Curve.t

let make (points : point list) : t = Curve.measure (Curve.through ~steps:16 points)
let length (p : t) : number = Curve.length p

let at (p : t) (s : number) : point * number =
  let pt, radians = Curve.at p s in
  (pt, radians * 180. / pi)

let mirror (points : point list) : point list = List.map (fun (x, y) -> (-.x, y)) points