package geoml

  1. Overview
  2. Docs

Module for Regular polygons

type t = private {
  1. center : Point.t;
  2. fst : Point.t;
  3. snd : Point.t;
  4. len : float;
  5. apothem : float;
    (*

    Distance between the center and the middle of one of the edges

    *)
  6. edges : int;
}
val make : Point.t -> Point.t -> int -> t

Create a regular polygon from the center, an arbitrary point and the number of edges

val next_point : ?nth:int -> t -> Point.t
val fold_stop : (Point.t -> Point.t -> bool) -> (int -> 'a -> Point.t -> Point.t -> 'a) -> 'a -> t -> 'a
val perimeter : t -> float
val area : t -> float
val to_polygon : t -> polygon
val to_randomized_polygon : ?minp:int -> ?prob:float -> t -> polygon
val translate : float -> float -> t -> t
val transform : Affine.t -> t -> t
val is_square : t -> bool
val contains : t -> Point.t -> bool
val map : (Point.t -> Point.t) -> t -> t
OCaml

Innovation. Community. Security.