package geoml

  1. Overview
  2. Docs

Module PolygonSource

This module provides basic functions for any concave, convex and convex regular polygon (Does not handle complex polygon and polygon with holes)

Sourcetype t = private Point.t list
Sourcetype polygon = t
Sourceval make : Point.t list -> t
Sourceval first_point : t -> Point.t
Sourceval to_list : t -> Point.t list
Sourceval fold : ('a -> Point.t -> Point.t -> 'a) -> 'a -> t -> 'a

Same function as List.fold_left but on segments of a given polygon

Sourceval fold_filter : (Point.t -> Point.t -> bool) -> ('b -> Point.t -> Point.t -> 'b) -> 'b -> t -> 'b

Same function as fold but filters segments with the first argument

Sourceval perimeter : t -> float
Sourceval area : t -> float
Sourceval proj_x : t -> float * float
Sourceval proj_y : t -> float * float
Sourceval translate : float -> float -> t -> t
Sourceval transform : Affine.t -> t -> t
Sourceval minmax_xy : t -> float * float * float * float
Sourceval intersect_line : t -> Line.t -> Point.t list

returns the intersection point of a line and a polygon

Sourceval contains : t -> Point.t -> bool

Returns true if a polygon contains a point. Randolph Franklin code for raycasting

Sourceval segments_intersection_points : Point.t list Segment.Tbl.t -> t -> t -> Point.t list

Get a list of the intersections points of the edges of two polygons

Sourceval intersection_polygons : t -> t -> t list

Implementation of Weiler Atherton Algorithm for concave/convexe polygons clipping. Complexity is O(m*n).

Sourceval triangulation : t -> (Point.t * Point.t * Point.t) list
Sourcemodule Convex : sig ... end
OCaml

Innovation. Community. Security.