Module Clpr.PathD

Rectangular clipping, simplification, and other transformations on sequences of vertices (float) defining a single contour (open or closed path).

type t

the Clipper2 path type (std::vector of point)

Construction

val make : unit -> t
val reserve : t -> int -> unit

reserve t n

Reserves memory for up to n points in the path vector t.

val of_tups : (float * float) list -> t
val ellipse : ?fn:int -> ?centre:PointD.t -> float -> float -> t
val add_point : t -> PointD.t -> unit

Access

val length : t -> int
val unsafe_get : t -> int -> PointD.t
val get : t -> int -> PointD.t

Transformation

val translate : t -> float -> float -> t

Rectangular Clipping

val rect_clip : ?precision:int -> ?closed:bool -> t -> {rectd}1 -> {pathsd}3

Simplification

val trim_collinear : ?precision:int -> ?closed:bool -> t -> t
val strip_near_equal : ?closed:bool -> ?eps:float -> t -> t
val strip_duplicates : ?closed:bool -> t -> unit
val simplify : ?closed:bool -> ?eps:float -> t -> t
val ramer_douglas_peucker : ?eps:float -> t -> t

Minkowski

val minkowski_sum : ?precision:int -> ?closed:bool -> pattern:t -> t -> {pathsd}3
val minkowski_diff : ?precision:int -> ?closed:bool -> pattern:t -> t -> {pathsd}3

Geometry

val area : t -> float
val bounds : t -> {rectd}1
val point_inside : t -> PointD.t -> [> `Inside | `OnBorder | `Outside ]
val is_positive : t -> bool