triangule - v0.1.6

Triangule

Triangule is a typescript library for computing angles and lengths of triangles.

It solves analytically common triangle problems in Euclidian geometry. It's based only on lengths and angles. On purpose, it doesn't use Cartesian coordinates.

It uses essentially the law of cosines and the law of sines.

Triangule relies on the standard library Math and doesn't have any extra dependency.

  • pkg : triangule as npm-package
  • sources : git-repository
  • API : public instance of the UI
  • in use : public instance of the UI
npm install triangule
import { triAArA } from 'triangule';

const [a3, logstr] = triAArA(1.0, 2.0); // expect 0.14159
git clone https://github.com/charlyoleg2/parame78
cd parame78
npm -w triangule install
npm -w triangule run ci

trianguletriAArA.svg

Compute the third angle fron the two first angles. The sign of the two first angles must be identical. The sign of the third angle is the same as the sign of the two first angles. The sum of the 3 angles of a triangle is Pi.

trianguletriALArLL.svg

From two angles and one length, compute the two remaining lengths. The two input angles must be adjacent to the input length. After getting the third angle, it uses the law of sines for computing the two remaining triangle-side-lengths.

trianguletriLALrL.svg

From two lengths and one angle, compute the remaining length. The input angle must be the angle between the two lengths. It's the direct application of the law of cosines.

trianguletriALLrL.svg

From one angle and two lengths, compute the two possible length of the third triangle-side. The input angle must be opposite to the second input length. It is the intersection between a line and a circle, which can have two solutions. The law of cosines provides an equation of the second degree, which can have two solutions.

trianguletriALLrLAA.svg

Same inputs as triALLrL. The output is completed with two angles for each possible length.

trianguletriLLLrA.svg

From the three lengths of a triangle, compute one of the angle. It's a direct application of the law of cosines.

trianguletriLLLrAAA.svg

Same inputs as triLLLrA. The output is extended to the three angles of the triangle.

trianguleanglesign.svg

Either all angles of a triangle are positive or they are all negative.

  • If we measure the angle between two half-lines, the angle is modulo 2*Pi.
  • If we measure the angle between two lines, the angle is modulo Pi.

triangulestrokeAngle.svg

Let's note A, the angle between two lines. Those angles are equivalent:

  • A
  • A+Pi
  • A-Pi

The following angles are not equivalent to A:

  • -A
  • Pi-A
  • -Pi-A

trianguleanglePotentialError.svg