package geoml

  1. Overview
  2. Docs
Geoml: 2D Geometry library for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

0.1.1.tar.gz
md5=37ca15d64a035762d12c4bd7064a1841
sha512=109d7597bd2a8d6628b4c0ee40cd94066fe09ce565bb35fe10683e5f701c1d058daaec79702b4f5f8ed68eeed444c363ca6070f854bbdfb6d0cd997db0f21408

doc/geoml/Line/index.html

Module LineSource

This module provides basic operation over the linear equation type

Sourcetype t = private
  1. | X of float
  2. | Y of float * float
    (*

    the linear equation type

    *)
Sourceval print : Format.formatter -> t -> unit

printer

Sourceval to_string : t -> string

to string

Sourcetype error =
  1. | Parallel of t * t
  2. | Same_coordinates of Point.t
    (*

    the type of errors

    *)
Sourceexception Error of error

the type of exceptions concerning this module

Sourceval print_error : Format.formatter -> error -> unit

error printer

Sourceval make : float -> float -> float -> t

make a b c builds a line of equation: ax + by + c = 0. Raises an error if a = b = 0. in which case the equation do not correspond to a line

Sourceval make_x : float -> t

make_x a builds a line of equation: x = a

Sourceval make_y : float -> float -> t

make_y a b builds a line of equation: y = ax + b

Sourceval x_axis : t

the horizontal line of equation: y = 0

Sourceval y_axis : t

the vertical line of equation: x = 0

Sourceval of_points : Point.t -> Point.t -> t

of_points p1 p2 builds the line that goes through the points p1 and p2. It raises Error(Same_coordinates) if p1 = p2

Sourceval is_vertical : t -> bool

is_vertical l, is true if l has an equation of the form: x=cst, where cst is a constant float

Sourceval is_horizontal : t -> bool

is_horizontal l, returns true if l has an equation of the form: y=cst, where cst is a constant float

Sourceval get_coeff : t -> float * float * float

returns a tuple (a,b,c) with respect to the equation of line, as: ax + by \+ c = 0

Sourceval x_from_y : t -> float -> float

'x_from_y line y', returns 'x', the value on the x-axis corresponding to given 'y' value, with f the affine function associated to 'line', as: f(x) = y raises Parallel if 'line' doesn't intersect the horizontal line going through 'y'

Sourceval y_from_x : t -> float -> float

'y_from_x line x', returns 'y', the value on the y-axis corresponding to given 'x' value, with f the affine function associated to 'line', as: f(x) = y raises Parallel if 'line' doesn't intersect the vertical line going through 'x'

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

contains l1 p returns true if l1goes through p. false otherwise.

Sourceval scale_x : t -> float -> t
Sourceval scale_y : t -> float -> t
Sourceval translate : float -> float -> t -> t
Sourceval parallel : t -> t -> bool

parallel l1 l2 returns true if l1 and l2 are parallel. false otherwise.

Sourceval intersects : t -> t -> bool

intersects l1 l2 returns true if l1 and l2 intersects. false otherwise.

Sourceval intersection : t -> t -> Point.t

intersection l1 l2 returns the point at the intersection of l1 and l2. It raises Error(Parralel) if l1 and l2 dont intersect

Sourceval perpendicular : t -> t -> bool

perpendicular l1 l2 returns true if l1 and l2 are perpendicular. false otherwise.

Sourceval perpendicular_of_line : t -> Point.t -> t

perpendicular_of_line l p returns the line perpendicular to l that goes through p.

Sourceval parallel_of_line : t -> Point.t -> t

parallel_of_line l p returns the line parallel to l that goes through p.

Sourceval orth_proj : t -> Point.t -> Point.t

orth_proj l p, returns the orthogonal projection of p on l

Sourceval point_bissection : Point.t -> Point.t -> t

point_bissection p1 p2 builds the line l that bissects the segment p1p2 in its center. It Raises Error(Same_coordinates) if p1 = p2

Sourceval arbitrary_point : t -> Point.t

arbitrary_point l chooses an aribitrary point p such that contains l p is true

OCaml

Innovation. Community. Security.