Newton's Principia Mathematica

    ngraph.physics.primitives

    1.0.0 • Public • Published

    ngraph.physics.primitives

    Module with basic 2d and 3d physics primitives for ngraph. It defines interface for physical bodies, used in n-body simulation.

    build status Examples

    var physics = requrie('ngraph.physics.primitives');
     
    var body = new physics.Body(); // create a new 2d body
    console.dir(body.force); //  prints force value acting on this body
    console.dir(body.pos);   // prints body's position in 2d space
    console.log(body.mass);  // prints 1. Bodies should have a mass
     
    var direction = new physics.Vector2d(); // create a 2d vector
    console.log(direction.x, direction.y); // prints 0, 0
     
    var spaceDirection = new physics.Vector3d(); // create a 3d vector
    console.log(spaceDirection.x, spaceDirection.y, spaceDirection.z); // prints 0, 0, 0

    Install

    npm install ngraph.physics.primitives
    

    Why?

    I created this module to declare clear interface for expected bodies in N-Body force simulation. You don't have to use it, as long as your body object have the same properties as described here.

    Install

    npm i ngraph.physics.primitives

    DownloadsWeekly Downloads

    631

    Version

    1.0.0

    License

    BSD-3-Clause

    Unpacked Size

    8.48 kB

    Total Files

    6

    Last publish

    Collaborators

    • anvaka