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

mathfyjs

v1.0.3

Published

Mathfy, uma biblioteca para calculos matematicos, te ajudará a programar sem dor de cabeça, e dará uma turbinada em sua produção.

Downloads

2

Readme

MathfyJS

Mathfy, uma biblioteca para calculos matematicos, te ajudará a programar sem dor de cabeça, e dará uma turbinada em sua produção.

Sinta-se à vontade para contribuir para o projeto, pois sua contribuição será muito bem-vinda.

Obs: A documentação abaixo está incompleta, em breve novas melhorias.

Installation

npm install mathfyjs

Usage

Aqui estará algumas dicas de como utilizar a biblioteca MathfyJS.

Matrix

Crie uma matriz com:

new Matrix(width: number, height: number, defaultValues: number);

Exemplo:

import { Matrix } from "mathfyjs";

let m1 = new Matrix(4, 4);
m1.set(0, 0, 4);
m1.set(1, 1, 3);
m1.set(2, 2, 2);
m1.set(3, 3, 1);

let m2 = new Matrix(1, 4);
m2.set(0, 0, 4);
m2.set(0, 1, 3);
m2.set(0, 2, 2);
m2.set(0, 3, 1);
  • Defina
m1.set(x: number, y: number, value: number);
m1.set(0, 0, 4);
  • Multiplique
m1.mul(matrix: Matrix): Matrix;
m1 = m1.mul(m2);
  • Adicione
m1.add(matrix: Matrix): Matrix;
m1 = m1.add(m2);
  • Subtraia
m1.sub(matrix: Matrix): Matrix;
m1 = m1.sub(m2);

Angle

Crie um ângulo com:

new Angle(radians: number);
Angle.fromVector(vector: Vector);
Angle.fromDegrees(degrees: number);

Exemplo:

import { Angle } from "mathfyjs";

let angle = Angle.fromDegrees(60);
  • Converta graus para radianos e vice versa.
let degreesToRadians = 80*Angle.DEGREES2RADIANS;
let radiansToDegrees = 1.39626*Angle.RADIANS2DEGREES;
  • Adicione
angle.add(angle: number, isDegrees: boolean);
angle.add(5, true);

Vector

Crie um vetor com:

new Vector(x: number, y: number);
Vector.fromAngle(angle: Angle);

Exemplo:

import { Vector } from "mathfyjs";

let vector = new Vector(2, 4);
  • Multiplique por uma escalar
vector.mul(scalar: number): Vector;
vector = vector.mul(2);
  • Adicione
vector.add(vector: Vector): Vector;
vector.add(x: number, y: number): Vector;
vector = vector.add(new Vector(2, 2));
  • Subtraia
vector.sub(vector: Vector): Vector;
vector.sub(x: number, y: number): Vector;
vector = vector.sub(new Vector(2, 2));
  • Normalize
vector = vector.normalize(): Vector;
  • Magnitude
let length = vector.mag(): number;
  • Defina um valor
vector.set(vector: Vector): void;
vector.set(x: number, y: number): void;
vector.set(4, 2);
  • Obtenha um vetor direção entre dois vetores
vector.lookAt(vector: Vector): Vector;
let direction = vector.lookAt(new Vector(9, 7));
  • Copie um vetor
vector.copy(): Vector;
let vector2 = vector.copy();
console.log(vector2 === vector); // false