Module Gamelle.Segment

Segments connecting two Points.

type t

The type of segments.

val v : Point.t -> Point.t -> t

v start stop is a segment connecting point start to point stop.

Draw

val draw : io:io -> ?color:Color.t -> t -> unit

draw ~io s draws the segment on the screen.

val pp : Stdlib.Format.formatter -> t -> unit

Format.printf "%a" pp t pretty prints the segment t end-points.

Accessors

val to_tuple : t -> Point.t * Point.t

to_tuple s returns the two end-points of the segment s.

val vector : t -> Vec.t

vector s is the direction vector of the segment s.

val intersect : t -> t -> bool

intersect a b returns true if segment a intersects segment b, false otherwise.