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

mertan

v0.0.3

Published

geometrical operations

Downloads

3

Readme

rational geometry

Basic geometrical functions

Support

browser support

Examples

var gm = require('mertan')
  , V = require('momentum')
  , R = require('rationals')

var line2D_1 = gm.line(V([2,0]),V([4,2]))
  , point2D_1 = V([0,-1])
  , point2D_2 = [R(-2),R(2)] // this is the same as the above
  , line2D_2 = gm.line([R(0),R(3,2)],[R(6),R(-3)])
  , line2D_3 = gm.line([R(2),R(1)],[R(3),R(0)])
  , line2D_4 = gm.line([R(-3),R(-3)],[R(-20),R(0)])
  , line2D_5 = gm.line([R(3),R(-3)],[R(0),R(20)])
  , line3D_1 = gm.line(V([3,6,1]),V([3,-4,-1]))
  , line3D_2 = gm.line(V([3,6,1]),V([9,-12,-3]))
  , line3D_3 = gm.line(V([-1,2,-3]),V([5,-1,2]))
  , line3D_4 = gm.line(V([6,-5,4]),V([3,-11,-13]))

    line2D_1.has(point2D_1) // true
    line2D_1.has(point2D_2) // false

    line2D_1.parallelTo(line2D_2) // false
    line2D_3.parallelTo(line2D_4) // true
    line3D_1.parallelTo(line3D_2) // true

    line2D_1.perpendicularTo(line2D_2) // false
    line3D_3.perpendicularTo(line3D_4) // true
    line3D_2.perpendicularTo(line3D_4) // false

    // Quadrance between points
    gm.Q([R(3),R(-12)],[R(15),R(4)]) == R(12).times(R(12)).add(R(16).times(R(16))) // R(400)

    // Spread between vectors
    //spread is 1 when perpendicular
    gm.S(line2D_4.vector, line2D_5.vector) // R(1)
    //spread is 0 when parallel
    gm.S(line3D_1.vector, line3D_2.vector) // R(0)

API

Points

Points are just regular arrays of rational number objectss.

Lines

Lines are represented by one point on them and a direction vector This gm.line([R(0),R(3,2)],[R(6),R(-3)]) returns an object with properties base as the point and vector as the direction vector. This is the same line as x+2y=3.

Quadrance between points

Returns the rational trigonometry definition of the quadrance as a rational number object (basicaly square of the distance in Euclidean geometry) gm.Q([R(3),R(-12)],[R(15),R(4)]) // R(400)

Spread between vectors

Returns the rational trigonometry definition of the spread as a rational number object (it is a rational alternative to the concept of angle) gm.S(line2D_4.vector, line2D_5.vector) // R(1)

Install

npm install mertan

You can use it in the browser with browserify