Coder Social home page Coder Social logo

vector's Introduction

vctr

Minimal operations for multidimensional vectors

This module assumes that a vector is an array of numbers, allowing these functions to be used on vectors of all dimensions.

install

npm install vctr

usage

const { add, subtract, ... } = require('vctr')

add(a, b)

Returns the sum of the two provided vectors.

subtract(a, b)

Returns the difference between the two provided vectors.

multiply(a, b)

Returns the product of the two provided vectors. The second argument may be a scalar quantity (a Number) if desired.

divide(a, b)

Returns the quotient of the two provided vectors. The second argument may be a scalar quantity (a Number) if desired.

dot(a, b)

Determines the dot product of the two provided vectors.

compose(vector)

Converts vector from Cartesian coordinates to spherical coordinates { direction, magnitude }.

resolve(vector)

Converts vector from spherical coordinates to Cartesian coordinates.

direction(vector)

Calculates the direction in which vector is pointing, in radians.

magnitude(vector)

Calculates the distance covered by vector.

normalize(vector)

Converts vector to a unit vector.

distance(a, b)

Determines the distance (a scalar quantity) between the two provided vectors.

see also

license

MIT ยฉ Brandon Semilla

vector's People

Contributors

semibran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vector's Issues

refine docs

Would be good to see some diagrams, examples, and long-winded descriptions ๐Ÿค”

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.