package oxbow

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Oxbow_core.VectorSource

Sourcetype t = {
  1. x : int;
  2. y : int;
}
Sourceval center : int Rect.t -> t

center r is the geometric center of r. Port of river-classic's Vector.positionOfBox.

Sourceval diff : t -> t -> t

diff a b is b - a.

Sourceval direction : t -> Direction.Spatial.t option

direction v classifies v into one of four quadrants by dominant axis: |dy| > |dx| is up/down, else left/right. Is None for the zero vector.

Sourceval length_squared : t -> int

length_squared v is x*x + y*y.

Sourceval nearest_in_direction : from:t -> dir:Direction.Spatial.t -> ('a -> t option) -> 'a list -> 'a option

nearest_in_direction ~from ~dir project xs is the element of xs closest to from in direction dir, or None if none qualifies. project x returns Some then candidate's center, or None to exclude x from the search.