Gamelle.Segment
Segments connecting two Points.
Point
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.
v start stop
start
stop
val draw : io:io -> ?color:Color.t -> t -> unit
draw ~io s draws the segment on the screen.
draw ~io s
val pp : Stdlib.Format.formatter -> t -> unit
Format.printf "%a" pp t pretty prints the segment t end-points.
Format.printf "%a" pp t
t
val to_tuple : t -> Point.t * Point.t
to_tuple s returns the two end-points of the segment s.
to_tuple s
s
val vector : t -> Vec.t
vector s is the direction vector of the segment s.
vector s
val intersect : t -> t -> bool
intersect a b returns true if segment a intersects segment b, false otherwise.
intersect a b
true
a
b
false