<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Line (geoml.Geoml.Line)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.1.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> â€“ <a href="../../index.html">geoml</a> &#x00BB; <a href="../index.html">Geoml</a> &#x00BB; Line</nav><header class="odoc-preamble"><h1>Module <code><span>Geoml.Line</span></code></h1><p>This module provides basic operation over the linear equation type</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec type" id="type-t" class="anchored"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> t</span><span> = <span class="keyword">private</span> </span></code><table><tr id="type-t.X" class="anchored"><td class="def variant constructor"><a href="#type-t.X" class="anchor"></a><code><span>| </span><span><span class="constructor">X</span> <span class="keyword">of</span> float</span></code></td></tr><tr id="type-t.Y" class="anchored"><td class="def variant constructor"><a href="#type-t.Y" class="anchor"></a><code><span>| </span><span><span class="constructor">Y</span> <span class="keyword">of</span> float * float</span></code></td><td class="def-doc"><span class="comment-delim">(*</span><p>the linear equation type</p><span class="comment-delim">*)</span></td></tr></table></div></div><div class="odoc-spec"><div class="spec value" id="val-print" class="anchored"><a href="#val-print" class="anchor"></a><code><span><span class="keyword">val</span> print : <span><span class="xref-unresolved">Stdlib</span>.Format.formatter <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>printer</p></div></div><div class="odoc-spec"><div class="spec value" id="val-to_string" class="anchored"><a href="#val-to_string" class="anchor"></a><code><span><span class="keyword">val</span> to_string : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>to string</p></div></div><div class="odoc-spec"><div class="spec type" id="type-error" class="anchored"><a href="#type-error" class="anchor"></a><code><span><span class="keyword">type</span> error</span><span> = </span></code><table><tr id="type-error.Parallel" class="anchored"><td class="def variant constructor"><a href="#type-error.Parallel" class="anchor"></a><code><span>| </span><span><span class="constructor">Parallel</span> <span class="keyword">of</span> <a href="#type-t">t</a> * <a href="#type-t">t</a></span></code></td></tr><tr id="type-error.Same_coordinates" class="anchored"><td class="def variant constructor"><a href="#type-error.Same_coordinates" class="anchor"></a><code><span>| </span><span><span class="constructor">Same_coordinates</span> <span class="keyword">of</span> <a href="../Point/index.html#type-t">Point.t</a></span></code></td><td class="def-doc"><span class="comment-delim">(*</span><p>the type of errors</p><span class="comment-delim">*)</span></td></tr></table></div></div><div class="odoc-spec"><div class="spec exception" id="exception-Error" class="anchored"><a href="#exception-Error" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Error</span> <span class="keyword">of</span> <a href="#type-error">error</a></span></code></div><div class="spec-doc"><p>the type of exceptions concerning this module</p></div></div><div class="odoc-spec"><div class="spec value" id="val-print_error" class="anchored"><a href="#val-print_error" class="anchor"></a><code><span><span class="keyword">val</span> print_error : <span><span class="xref-unresolved">Stdlib</span>.Format.formatter <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-error">error</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>error printer</p></div></div><div class="odoc-spec"><div class="spec value" id="val-make" class="anchored"><a href="#val-make" class="anchor"></a><code><span><span class="keyword">val</span> make : <span>float <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p><code>make a b c</code> builds a line of equation: ax + by + c = 0. Raises an error if <code>a = b = 0.</code> in which case the equation do not correspond to a line</p></div></div><div class="odoc-spec"><div class="spec value" id="val-make_x" class="anchored"><a href="#val-make_x" class="anchor"></a><code><span><span class="keyword">val</span> make_x : <span>float <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p><code>make_x a</code> builds a line of equation: x = a</p></div></div><div class="odoc-spec"><div class="spec value" id="val-make_y" class="anchored"><a href="#val-make_y" class="anchor"></a><code><span><span class="keyword">val</span> make_y : <span>float <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p><code>make_y a b</code> builds a line of equation: y = ax + b</p></div></div><div class="odoc-spec"><div class="spec value" id="val-x_axis" class="anchored"><a href="#val-x_axis" class="anchor"></a><code><span><span class="keyword">val</span> x_axis : <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>the horizontal line of equation: y = 0</p></div></div><div class="odoc-spec"><div class="spec value" id="val-y_axis" class="anchored"><a href="#val-y_axis" class="anchor"></a><code><span><span class="keyword">val</span> y_axis : <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>the vertical line of equation: x = 0</p></div></div><div class="odoc-spec"><div class="spec value" id="val-of_points" class="anchored"><a href="#val-of_points" class="anchor"></a><code><span><span class="keyword">val</span> of_points : <span><a href="../Point/index.html#type-t">Point.t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Point/index.html#type-t">Point.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p><code>of_points p1 p2</code> builds the line that goes through the points p1 and p2. It raises <code>Error(Same_coordinates)</code> if <code>p1 = p2</code></p></div></div><div class="odoc-spec"><div class="spec value" id="val-is_vertical" class="anchored"><a href="#val-is_vertical" class="anchor"></a><code><span><span class="keyword">val</span> is_vertical : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p><code>is_vertical l</code>, is <code>true</code> if l has an equation of the form: x=cst, where cst is a constant float</p></div></div><div class="odoc-spec"><div class="spec value" id="val-is_horizontal" class="anchored"><a href="#val-is_horizontal" class="anchor"></a><code><span><span class="keyword">val</span> is_horizontal : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p>is_horizontal l, returns true if l has an equation of the form: y=cst, where cst is a constant float</p></div></div><div class="odoc-spec"><div class="spec value" id="val-get_coeff" class="anchored"><a href="#val-get_coeff" class="anchor"></a><code><span><span class="keyword">val</span> get_coeff : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> float * float * float</span></code></div><div class="spec-doc"><p>returns a tuple (a,b,c) with respect to the equation of line, as: ax + by \+ c = 0</p></div></div><div class="odoc-spec"><div class="spec value" id="val-x_from_y" class="anchored"><a href="#val-x_from_y" class="anchor"></a><code><span><span class="keyword">val</span> x_from_y : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>'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'</p></div></div><div class="odoc-spec"><div class="spec value" id="val-y_from_x" class="anchored"><a href="#val-y_from_x" class="anchor"></a><code><span><span class="keyword">val</span> y_from_x : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>'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'</p></div></div><div class="odoc-spec"><div class="spec value" id="val-contains" class="anchored"><a href="#val-contains" class="anchor"></a><code><span><span class="keyword">val</span> contains : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Point/index.html#type-t">Point.t</a> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p>contains l1 p returns true if l1goes through p. false otherwise.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-scale_x" class="anchored"><a href="#val-scale_x" class="anchor"></a><code><span><span class="keyword">val</span> scale_x : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div></div><div class="odoc-spec"><div class="spec value" id="val-scale_y" class="anchored"><a href="#val-scale_y" class="anchor"></a><code><span><span class="keyword">val</span> scale_y : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div></div><div class="odoc-spec"><div class="spec value" id="val-translate" class="anchored"><a href="#val-translate" class="anchor"></a><code><span><span class="keyword">val</span> translate : <span>float <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div></div><div class="odoc-spec"><div class="spec value" id="val-parallel" class="anchored"><a href="#val-parallel" class="anchor"></a><code><span><span class="keyword">val</span> parallel : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p>parallel l1 l2 returns true if l1 and l2 are parallel. false otherwise.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-intersects" class="anchored"><a href="#val-intersects" class="anchor"></a><code><span><span class="keyword">val</span> intersects : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p>intersects l1 l2 returns true if l1 and l2 intersects. false otherwise.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-intersection" class="anchored"><a href="#val-intersection" class="anchor"></a><code><span><span class="keyword">val</span> intersection : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Point/index.html#type-t">Point.t</a></span></code></div><div class="spec-doc"><p>intersection l1 l2 returns the point at the intersection of l1 and l2. It raises Error(Parralel) if l1 and l2 dont intersect</p></div></div><div class="odoc-spec"><div class="spec value" id="val-perpendicular" class="anchored"><a href="#val-perpendicular" class="anchor"></a><code><span><span class="keyword">val</span> perpendicular : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p>perpendicular l1 l2 returns true if l1 and l2 are perpendicular. false otherwise.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-perpendicular_of_line" class="anchored"><a href="#val-perpendicular_of_line" class="anchor"></a><code><span><span class="keyword">val</span> perpendicular_of_line : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Point/index.html#type-t">Point.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>perpendicular_of_line l p returns the line perpendicular to l that goes through p.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-parallel_of_line" class="anchored"><a href="#val-parallel_of_line" class="anchor"></a><code><span><span class="keyword">val</span> parallel_of_line : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Point/index.html#type-t">Point.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>parallel_of_line l p returns the line parallel to l that goes through p.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-orth_proj" class="anchored"><a href="#val-orth_proj" class="anchor"></a><code><span><span class="keyword">val</span> orth_proj : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Point/index.html#type-t">Point.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Point/index.html#type-t">Point.t</a></span></code></div><div class="spec-doc"><p>orth_proj l p, returns the orthogonal projection of p on l</p></div></div><div class="odoc-spec"><div class="spec value" id="val-point_bissection" class="anchored"><a href="#val-point_bissection" class="anchor"></a><code><span><span class="keyword">val</span> point_bissection : <span><a href="../Point/index.html#type-t">Point.t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Point/index.html#type-t">Point.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p><code>point_bissection p1 p2</code> builds the line <code>l</code> that bissects the segment p1p2 in its center. It Raises <code>Error(Same_coordinates)</code> if <code>p1 = p2</code></p></div></div><div class="odoc-spec"><div class="spec value" id="val-arbitrary_point" class="anchored"><a href="#val-arbitrary_point" class="anchor"></a><code><span><span class="keyword">val</span> arbitrary_point : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Point/index.html#type-t">Point.t</a></span></code></div><div class="spec-doc"><p><code>arbitrary_point l</code> chooses an aribitrary point <code>p</code> such that <code>contains l p</code> is true</p></div></div></div></body></html>