npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

triangule

v0.1.5

Published

a library for triangulation and other triangle calculations

Downloads

362

Readme

Triangule

Presentation

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.

Links

  • pkg : triangule as npm-package
  • sources : git-repository
  • API : public instance of the UI
  • in use : public instance of the UI

Installation

npm install triangule

Usage

import { triAArA } from 'triangule';

const [a3, logstr] = triAArA(1.0, 2.0); // expect 0.14159

Development

git clone https://github.com/charlyoleg2/parame78
cd parame78
npm -w triangule install
npm -w triangule run ci

Main functions of Triangule

triAArA

triangule_triAArA.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.

triALArLL

triangule_triALArLL.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.

triLALrL

triangule_triLALrL.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.

triALLrL

triangule_triALLrL.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.

triALLrLAA

triangule_triALLrLAA.svg

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

triLLLrA

triangule_triLLLrA.svg

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

triLLLrAAA

triangule_triLLLrAAA.svg

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

Common pitfalls around triangles

Oriented angles in a triangle

triangule_angle_sign.svg

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

Possible ways to measure an angle

  • 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.

triangule_strokeAngle.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

triangule_anglePotentialError.svg