package geoml

All checked builds pass
  1. Overview
  2. Docs
Geoml: 2D Geometry library for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

0.1.1.tar.gz
md5=37ca15d64a035762d12c4bd7064a1841
sha512=109d7597bd2a8d6628b4c0ee40cd94066fe09ce565bb35fe10683e5f701c1d058daaec79702b4f5f8ed68eeed444c363ca6070f854bbdfb6d0cd997db0f21408

Description

Geoml is a 2D geometry for OCaml that provides basic euclidean geometry types (point, line, circle ...) and useful operations over those types. Computations are made using floatting point precision

Added to opam-repository:

README

Geoml

Geoml is 2D geometry library for OCaml. It focuses on euclidean geometry and provides basic types and operations over geometric shapes.

Here an example showing a way to construct geometrically a golden rectangle from four points defining a square:

  open Geoml
  
  let gold_rect (a,b,c,d) =
    let e = Point.center a b and ab = Line.of_points a b in
    let circ = Point.distance e c |> Circle.make e in
    let f =
      match Circle.line_intersection circ ab with
      | [x;y] -> if Point.sq_distance a x > Point.sq_distance a y then x else y
      | _ -> assert false
    in
    let fg = Line.perpendicular_of_line ab f and dc = Line.of_points d c in
    let g = Line.intersection fg dc in
    Rectangle.make d (Point.distance d g) (Point.distance d a)
gr

It also implements several cool algorithms :

  • Emo Welzl's smallest enclosing disk algorithm
ws
  • Graham's scan method for finding a convex hull.
  • Weiler-Atherton for polygon clipping
  • Ear-clipping Algorithm for Polygon triangulation (Mei, Tipper & Xu)

You can see some examples of application in the tests directory (You'll need Graphics)

Build
  • The library : make
  • The tests : make tests
Documentation

You can build locally the documentation by doing make doc, or consult the online documentation.

Current

Geoml is currently still in developpement, and have not been tested -nor proved, nor model-checked nor analyzed ... but you know what they say about well typed program ;) -. Thereby, you might find some weird behaviors or failures. Feel free to let us know or report an issue about it. The modules Point, Line, Rectangle, Vector, Triangle, Segment, Circle are pretty much usable while the Polygon, Polyhedron, Curve, Ellipse, Shape ... modules are not quite ready to be used and you should not rely on the code in it.

You are also welcome to contact any member of the developpement team if you want to report a bug or suggest a feature you think it may be cool to have in Geoml.

Dependencies (2)

  1. dune >= "2.4"
  2. ocaml >= "4.08.0"

Dev Dependencies (2)

  1. alcotest with-test
  2. odoc with-doc

Optional Dependencies

None

Used by

None

Conflicts

None

Build status

Results of building geoml with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
0.1.1 (this version) good good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure