<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Triangle (geoml.Geoml.Triangle)</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; Triangle</nav><header class="odoc-preamble"><h1>Module <code><span>Geoml.Triangle</span></code></h1><p>Triangles manipulation</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> <a href="../Point/index.html#type-t">Point.t</a> * <a href="../Point/index.html#type-t">Point.t</a> * <a href="../Point/index.html#type-t">Point.t</a></span></code></div><div class="spec-doc"><p>the type of triangles</p></div></div><div class="odoc-spec"><div class="spec value" id="val-tri_map" class="anchored"><a href="#val-tri_map" class="anchor"></a><code><span><span class="keyword">val</span> tri_map : <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> <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 class="spec-doc"><p>tri_map f t applies function f in turn to all the points of t and stores the results in a new triangle that is returned.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-tri_exists" class="anchored"><a href="#val-tri_exists" class="anchor"></a><code><span><span class="keyword">val</span> tri_exists : <span><span>( <span><a href="../Point/index.html#type-t">Point.t</a> <span class="arrow">&#45;&gt;</span></span> bool )</span> <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>Higher order utilities over the triangles</p></div></div><div class="odoc-spec"><div class="spec value" id="val-tri_find" class="anchored"><a href="#val-tri_find" class="anchor"></a><code><span><span class="keyword">val</span> tri_find : <span><span>( <span><a href="../Point/index.html#type-t">Point.t</a> <span class="arrow">&#45;&gt;</span></span> bool )</span> <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><div class="odoc-spec"><div class="spec value" id="val-tri_forall" class="anchored"><a href="#val-tri_forall" class="anchor"></a><code><span><span class="keyword">val</span> tri_forall : <span><span>( <span><a href="../Point/index.html#type-t">Point.t</a> <span class="arrow">&#45;&gt;</span></span> bool )</span> <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><div class="odoc-spec"><div class="spec value" id="val-tri_iter" class="anchored"><a href="#val-tri_iter" class="anchor"></a><code><span><span class="keyword">val</span> tri_iter : <span><span>( <span><a href="../Point/index.html#type-t">Point.t</a> <span class="arrow">&#45;&gt;</span></span> unit )</span> <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><div class="odoc-spec"><div class="spec value" id="val-transform" class="anchored"><a href="#val-transform" class="anchor"></a><code><span><span class="keyword">val</span> transform : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span class="xref-unresolved">Geoml__Affine.t</span> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>affine transformation of a triangle</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><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> <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>builds a triangle from three different points. raises Invalid_arg if at least two points are equal</p></div></div><div class="odoc-spec"><div class="spec value" id="val-extr1" class="anchored"><a href="#val-extr1" class="anchor"></a><code><span><span class="keyword">val</span> extr1 : <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>returns a vertice of the triangle. The vertice returned is different than the one returned by extr2 and extr3.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-extr2" class="anchored"><a href="#val-extr2" class="anchor"></a><code><span><span class="keyword">val</span> extr2 : <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>returns a vertice of the triangle. The vertice returned is different than the one returned by extr1 and extr3.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-extr3" class="anchored"><a href="#val-extr3" class="anchor"></a><code><span><span class="keyword">val</span> extr3 : <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>returns a vertice of the triangle. The vertice returned is different than the one returned by extr1 and extr2.</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-reflection" class="anchored"><a href="#val-reflection" class="anchor"></a><code><span><span class="keyword">val</span> reflection : <span><a href="../Point/index.html#type-t">Point.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="#type-t">t</a></span></code></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>tests if a point is in a triangle</p></div></div><div class="odoc-spec"><div class="spec value" id="val-rotate" class="anchored"><a href="#val-rotate" class="anchor"></a><code><span><span class="keyword">val</span> rotate : <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> <span>float <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>rotation, angle in radian</p></div></div><div class="odoc-spec"><div class="spec value" id="val-rotate_angle" class="anchored"><a href="#val-rotate_angle" class="anchor"></a><code><span><span class="keyword">val</span> rotate_angle : <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> <span>float <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>rotation, angle in degree</p></div></div><div class="odoc-spec"><div class="spec value" id="val-area" class="anchored"><a href="#val-area" class="anchor"></a><code><span><span class="keyword">val</span> area : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> float</span></code></div></div><div class="odoc-spec"><div class="spec value" id="val-perimeter" class="anchored"><a href="#val-perimeter" class="anchor"></a><code><span><span class="keyword">val</span> perimeter : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> float</span></code></div></div><div class="odoc-spec"><div class="spec value" id="val-proj_x" class="anchored"><a href="#val-proj_x" class="anchor"></a><code><span><span class="keyword">val</span> proj_x : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> float * float</span></code></div></div><div class="odoc-spec"><div class="spec value" id="val-proj_y" class="anchored"><a href="#val-proj_y" class="anchor"></a><code><span><span class="keyword">val</span> proj_y : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> float * float</span></code></div></div><div class="odoc-spec"><div class="spec value" id="val-segments" class="anchored"><a href="#val-segments" class="anchor"></a><code><span><span class="keyword">val</span> segments : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Segment/index.html#type-t">Segment.t</a> * <a href="../Segment/index.html#type-t">Segment.t</a> * <a href="../Segment/index.html#type-t">Segment.t</a></span></code></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><div class="odoc-spec"><div class="spec value" id="val-intersect_line" class="anchored"><a href="#val-intersect_line" class="anchor"></a><code><span><span class="keyword">val</span> intersect_line : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Line/index.html#type-t">Line.t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Point/index.html#type-t">Point.t</a> list</span></span></code></div></div><div class="odoc-spec"><div class="spec value" id="val-is_isoscele" class="anchored"><a href="#val-is_isoscele" class="anchor"></a><code><span><span class="keyword">val</span> is_isoscele : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div></div><div class="odoc-spec"><div class="spec value" id="val-is_equilateral" class="anchored"><a href="#val-is_equilateral" class="anchor"></a><code><span><span class="keyword">val</span> is_equilateral : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div></div><div class="odoc-spec"><div class="spec value" id="val-is_right" class="anchored"><a href="#val-is_right" class="anchor"></a><code><span><span class="keyword">val</span> is_right : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div></div><div class="odoc-spec"><div class="spec value" id="val-points" class="anchored"><a href="#val-points" class="anchor"></a><code><span><span class="keyword">val</span> points : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Point/index.html#type-t">Point.t</a> * <a href="../Point/index.html#type-t">Point.t</a> * <a href="../Point/index.html#type-t">Point.t</a></span></code></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><span>(<a href="../Point/index.html#type-t">Point.t</a> * <a href="../Point/index.html#type-t">Point.t</a> * <a href="../Point/index.html#type-t">Point.t</a>)</span> <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-angles" class="anchored"><a href="#val-angles" class="anchor"></a><code><span><span class="keyword">val</span> angles : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> float * float * float</span></code></div></div><div class="odoc-spec"><div class="spec value" id="val-centroid" class="anchored"><a href="#val-centroid" class="anchor"></a><code><span><span class="keyword">val</span> centroid : <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>returns the gravity center of a triangle</p></div></div><div class="odoc-spec"><div class="spec value" id="val-random_point" class="anchored"><a href="#val-random_point" class="anchor"></a><code><span><span class="keyword">val</span> random_point : <span><span class="xref-unresolved">Stdlib</span>.Random.State.t <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>returns a randomly and uniformly chosen point of the triangle</p></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></body></html>