<!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 1.5.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> â€“ <a href="../../index.html">geoml</a> &#x00BB; <a href="../index.html">Geoml</a> &#x00BB; Line</nav><h1>Module <code>Geoml.Line</code></h1><p>This module provides basic operation over the linear equation type</p></header><dl><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type</span> t</code><code> = <span class="keyword">private</span> </code><table class="variant"><tr id="type-t.X" class="anchored"><td class="def constructor"><a href="#type-t.X" class="anchor"></a><code>| </code><code><span class="constructor">X</span> <span class="keyword">of</span> float</code></td></tr><tr id="type-t.Y" class="anchored"><td class="def constructor"><a href="#type-t.Y" class="anchor"></a><code>| </code><code><span class="constructor">Y</span> <span class="keyword">of</span> float * float</code></td><td class="doc"><p>the linear equation type</p></td></tr></table></dt></dl><dl><dt class="spec value" id="val-print"><a href="#val-print" class="anchor"></a><code><span class="keyword">val</span> print : Stdlib.Format.formatter <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> unit</code></dt><dd><p>printer</p></dd></dl><dl><dt class="spec value" id="val-to_string"><a href="#val-to_string" class="anchor"></a><code><span class="keyword">val</span> to_string : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> string</code></dt><dd><p>to string</p></dd></dl><dl><dt class="spec type" id="type-error"><a href="#type-error" class="anchor"></a><code><span class="keyword">type</span> error</code><code> = </code><table class="variant"><tr id="type-error.Parallel" class="anchored"><td class="def constructor"><a href="#type-error.Parallel" class="anchor"></a><code>| </code><code><span class="constructor">Parallel</span> <span class="keyword">of</span> <a href="index.html#type-t">t</a> * <a href="index.html#type-t">t</a></code></td></tr><tr id="type-error.Same_coordinates" class="anchored"><td class="def constructor"><a href="#type-error.Same_coordinates" class="anchor"></a><code>| </code><code><span class="constructor">Same_coordinates</span> <span class="keyword">of</span> <a href="../Point/index.html#type-t">Point.t</a></code></td><td class="doc"><p>the type of errors</p></td></tr></table></dt></dl><dl><dt class="spec exception" id="exception-Error"><a href="#exception-Error" class="anchor"></a><code><span class="keyword">exception</span> </code><code><span class="exception">Error</span> <span class="keyword">of</span> <a href="index.html#type-error">error</a></code></dt><dd><p>the type of exceptions concerning this module</p></dd></dl><dl><dt class="spec value" id="val-print_error"><a href="#val-print_error" class="anchor"></a><code><span class="keyword">val</span> print_error : Stdlib.Format.formatter <span>&#45;&gt;</span> <a href="index.html#type-error">error</a> <span>&#45;&gt;</span> unit</code></dt><dd><p>error printer</p></dd></dl><dl><dt class="spec value" id="val-make"><a href="#val-make" class="anchor"></a><code><span class="keyword">val</span> make : float <span>&#45;&gt;</span> float <span>&#45;&gt;</span> float <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p><code>make a b c</code> builds a line of equation: ax + by + c = 0</p></dd></dl><dl><dt class="spec value" id="val-make_x"><a href="#val-make_x" class="anchor"></a><code><span class="keyword">val</span> make_x : float <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p><code>make_x a</code> builds a line of equation: x = a</p></dd></dl><dl><dt class="spec value" id="val-make_y"><a href="#val-make_y" class="anchor"></a><code><span class="keyword">val</span> make_y : float <span>&#45;&gt;</span> float <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p><code>make_y a b</code> builds a line of equation: y = ax + b</p></dd></dl><dl><dt class="spec value" id="val-x_axis"><a href="#val-x_axis" class="anchor"></a><code><span class="keyword">val</span> x_axis : <a href="index.html#type-t">t</a></code></dt><dd><p>the horizontal line of equation: y = 0</p></dd></dl><dl><dt class="spec value" id="val-y_axis"><a href="#val-y_axis" class="anchor"></a><code><span class="keyword">val</span> y_axis : <a href="index.html#type-t">t</a></code></dt><dd><p>the vertical line of equation: x = 0</p></dd></dl><dl><dt class="spec value" id="val-of_points"><a href="#val-of_points" class="anchor"></a><code><span class="keyword">val</span> of_points : <a href="../Point/index.html#type-t">Point.t</a> <span>&#45;&gt;</span> <a href="../Point/index.html#type-t">Point.t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><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></dd></dl><dl><dt class="spec value" id="val-is_vertical"><a href="#val-is_vertical" class="anchor"></a><code><span class="keyword">val</span> is_vertical : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> bool</code></dt><dd><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></dd></dl><dl><dt class="spec value" id="val-is_horizontal"><a href="#val-is_horizontal" class="anchor"></a><code><span class="keyword">val</span> is_horizontal : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> bool</code></dt><dd><p>is_horizontal l, returns true if l has an equation of the form: y=cst, where cst is a constant float</p></dd></dl><dl><dt class="spec value" id="val-get_coeff"><a href="#val-get_coeff" class="anchor"></a><code><span class="keyword">val</span> get_coeff : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> float * float * float</code></dt><dd><p>returns a tuple (a,b,c) with respect to the equation of line, as: ax + by + c = 0</p></dd></dl><dl><dt class="spec value" id="val-x_from_y"><a href="#val-x_from_y" class="anchor"></a><code><span class="keyword">val</span> x_from_y : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> float <span>&#45;&gt;</span> float</code></dt><dd><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></dd></dl><dl><dt class="spec value" id="val-y_from_x"><a href="#val-y_from_x" class="anchor"></a><code><span class="keyword">val</span> y_from_x : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> float <span>&#45;&gt;</span> float</code></dt><dd><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></dd></dl><dl><dt class="spec value" id="val-contains"><a href="#val-contains" class="anchor"></a><code><span class="keyword">val</span> contains : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../Point/index.html#type-t">Point.t</a> <span>&#45;&gt;</span> bool</code></dt><dd><p>contains l1 p returns true if l1goes through p. false otherwise.</p></dd></dl><dl><dt class="spec value" id="val-scale_x"><a href="#val-scale_x" class="anchor"></a><code><span class="keyword">val</span> scale_x : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> float <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dt class="spec value" id="val-scale_y"><a href="#val-scale_y" class="anchor"></a><code><span class="keyword">val</span> scale_y : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> float <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dt class="spec value" id="val-translate"><a href="#val-translate" class="anchor"></a><code><span class="keyword">val</span> translate : float <span>&#45;&gt;</span> float <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dt class="spec value" id="val-parallel"><a href="#val-parallel" class="anchor"></a><code><span class="keyword">val</span> parallel : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> bool</code></dt><dd><p>parallel l1 l2 returns true if l1 and l2 are parallel. false otherwise.</p></dd></dl><dl><dt class="spec value" id="val-intersects"><a href="#val-intersects" class="anchor"></a><code><span class="keyword">val</span> intersects : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> bool</code></dt><dd><p>intersects l1 l2 returns true if l1 and l2 intersects. false otherwise.</p></dd></dl><dl><dt class="spec value" id="val-intersection"><a href="#val-intersection" class="anchor"></a><code><span class="keyword">val</span> intersection : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../Point/index.html#type-t">Point.t</a></code></dt><dd><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></dd></dl><dl><dt class="spec value" id="val-perpendicular"><a href="#val-perpendicular" class="anchor"></a><code><span class="keyword">val</span> perpendicular : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> bool</code></dt><dd><p>perpendicular l1 l2 returns true if l1 and l2 are perpendicular. false otherwise.</p></dd></dl><dl><dt class="spec value" id="val-perpendicular_of_line"><a href="#val-perpendicular_of_line" class="anchor"></a><code><span class="keyword">val</span> perpendicular_of_line : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../Point/index.html#type-t">Point.t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p>perpendicular_of_line l p returns the line perpendicular to l that goes through p.</p></dd></dl><dl><dt class="spec value" id="val-parallel_of_line"><a href="#val-parallel_of_line" class="anchor"></a><code><span class="keyword">val</span> parallel_of_line : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../Point/index.html#type-t">Point.t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p>parallel_of_line l p returns the line parallel to l that goes through p.</p></dd></dl><dl><dt class="spec value" id="val-orth_proj"><a href="#val-orth_proj" class="anchor"></a><code><span class="keyword">val</span> orth_proj : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../Point/index.html#type-t">Point.t</a> <span>&#45;&gt;</span> <a href="../Point/index.html#type-t">Point.t</a></code></dt><dd><p>orth_proj l p, returns the orthogonal projection of p on l</p></dd></dl><dl><dt class="spec value" id="val-point_bissection"><a href="#val-point_bissection" class="anchor"></a><code><span class="keyword">val</span> point_bissection : <a href="../Point/index.html#type-t">Point.t</a> <span>&#45;&gt;</span> <a href="../Point/index.html#type-t">Point.t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><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></dd></dl><dl><dt class="spec value" id="val-arbitrary_point"><a href="#val-arbitrary_point" class="anchor"></a><code><span class="keyword">val</span> arbitrary_point : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../Point/index.html#type-t">Point.t</a></code></dt><dd><p><code>arbitrary_point l</code> chooses an aribitrary point <code>p</code> such that <code>contains l p</code> is true</p></dd></dl></div></body></html>