<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Rectangle (geoml.Geoml__.Rectangle)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.3"/><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; Rectangle</nav><h1>Module <code>Geoml__.Rectangle</code></h1></header><aside><p>This module provides the basic operations over rectangles</p></aside><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> <a href="../../Geoml/Point/index.html#type-t">Geoml.Point.t</a> * float * float</code></dt><dd><p>rectangle type</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 : <a href="../../Geoml/Point/index.html#type-t">Geoml.Point.t</a> <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>make p w h, returns a rectangle where p is the bottom-left corner of the rectangle, w its width and h its height</p></dd></dl><dl><dt class="spec value" id="val-of_diagonal"><a href="#val-of_diagonal" class="anchor"></a><code><span class="keyword">val</span> of_diagonal : <a href="../../Geoml/Point/index.html#type-t">Geoml.Point.t</a> <span>&#45;&gt;</span> <a href="../../Geoml/Point/index.html#type-t">Geoml.Point.t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p>of_diagonal p1 p2, builds the rectangle where p1p2 is its diagonal (the bounding rectangle of the two points)</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-scale"><a href="#val-scale" class="anchor"></a><code><span class="keyword">val</span> scale : <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><dd><p>scale on both axis</p></dd></dl><dl><dt class="spec value" id="val-bottom_left"><a href="#val-bottom_left" class="anchor"></a><code><span class="keyword">val</span> bottom_left : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../../Geoml/Point/index.html#type-t">Geoml.Point.t</a></code></dt><dt class="spec value" id="val-bottom_right"><a href="#val-bottom_right" class="anchor"></a><code><span class="keyword">val</span> bottom_right : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../../Geoml/Point/index.html#type-t">Geoml.Point.t</a></code></dt><dt class="spec value" id="val-top_right"><a href="#val-top_right" class="anchor"></a><code><span class="keyword">val</span> top_right : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../../Geoml/Point/index.html#type-t">Geoml.Point.t</a></code></dt><dt class="spec value" id="val-top_left"><a href="#val-top_left" class="anchor"></a><code><span class="keyword">val</span> top_left : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../../Geoml/Point/index.html#type-t">Geoml.Point.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-reflection"><a href="#val-reflection" class="anchor"></a><code><span class="keyword">val</span> reflection : <a href="../../Geoml/Point/index.html#type-t">Geoml.Point.t</a> <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-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="../../Geoml/Point/index.html#type-t">Geoml.Point.t</a> <span>&#45;&gt;</span> bool</code></dt><dt class="spec value" id="val-area"><a href="#val-area" class="anchor"></a><code><span class="keyword">val</span> area : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> float</code></dt><dt class="spec value" id="val-perimeter"><a href="#val-perimeter" class="anchor"></a><code><span class="keyword">val</span> perimeter : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> float</code></dt><dt class="spec value" id="val-proj_x"><a href="#val-proj_x" class="anchor"></a><code><span class="keyword">val</span> proj_x : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> float * float</code></dt><dt class="spec value" id="val-proj_y"><a href="#val-proj_y" class="anchor"></a><code><span class="keyword">val</span> proj_y : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> float * float</code></dt><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>determines whether or not two rectangles intersect</p></dd></dl><dl><dt class="spec value" id="val-intersect_line"><a href="#val-intersect_line" class="anchor"></a><code><span class="keyword">val</span> intersect_line : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../../Geoml/Line/index.html#type-t">Geoml.Line.t</a> <span>&#45;&gt;</span> <span><a href="../../Geoml/Point/index.html#type-t">Geoml.Point.t</a> list</span></code></dt><dd><p>returns the intersection points of a rectangle and a line. returns <code></code> if they don't intersect.</p></dd></dl><dl><dt class="spec value" id="val-segments"><a href="#val-segments" class="anchor"></a><code><span class="keyword">val</span> segments : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <span><a href="../../Geoml/Segment/index.html#type-t">Geoml.Segment.t</a> list</span></code></dt><dd><p>returns a list of length 4 containing the segments of the rectangle</p></dd></dl><dl><dt class="spec value" id="val-is_square"><a href="#val-is_square" class="anchor"></a><code><span class="keyword">val</span> is_square : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> bool</code></dt><dd><p>tests if the sides of the rectangle have same length</p></dd></dl><dl><dt class="spec value" id="val-encompass"><a href="#val-encompass" class="anchor"></a><code><span class="keyword">val</span> encompass : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../../Geoml/Point/index.html#type-t">Geoml.Point.t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p>given a rectangle and point, returns the smallest rectangle that contains the point and the rectangle given as parameters</p></dd></dl><dl><dt class="spec value" id="val-bounding"><a href="#val-bounding" class="anchor"></a><code><span class="keyword">val</span> bounding : <span><a href="../../Geoml/Point/index.html#type-t">Geoml.Point.t</a> list</span> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p>given a list of point, returns the smallest rectangle that contains all the points of the list</p></dd></dl><dl><dt class="spec value" id="val-centroid"><a href="#val-centroid" class="anchor"></a><code><span class="keyword">val</span> centroid : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../../Geoml/Point/index.html#type-t">Geoml.Point.t</a></code></dt><dd><p>returns the gravity center of a rectangle</p></dd></dl><dl><dt class="spec value" id="val-random_point"><a href="#val-random_point" class="anchor"></a><code><span class="keyword">val</span> random_point : Stdlib.Random.State.t <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../../Geoml/Point/index.html#type-t">Geoml.Point.t</a></code></dt><dd><p>returns a randomly and uniformly chosen point of the rectangle</p></dd></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></div></body></html>