butiran
v0.0.3
Published
Node package for simulation of grain-based system
Downloads
4
Readme
butiran-js
Node package for simulation of grain-based system using molecular dynamics method and agent-based model
module
- vect3
Vect3()
Initialize with three, one, or zero argumentsstrval()
Get string value of a Vect3add()
Add some Vect3sub()
Substract two Vect3mul()
Multiply Vect3 with scalar or vice versadiv()
Divide Vect3 with scalardot()
Dot two Vect3cross()
Cross two Vect3len()
Get length of a Vect3unit()
Get unit vector of a Vect3neg()
Get negative of a vector
usage
var butiran = require("butiran");
var Vect3 = butiran.Vect3();
var a = new Vect3(3, 4, 0);
console.log(a);
console.log("a = " + a.strval());
var b = new Vect3(4, -3, 0);
console.log("b = " + b.strval());
var c = Vect3.cross(a, b);
console.log("a x b = " + c.strval());
var d = Vect3.dot(a, b);
console.log("a . b = " + d);
Vect3 { x: 3, y: 4, z: 0 }
a = (3, 4, 0)
b = (4, -3, 0)
a x b = (0, 0, -25)
a . b = 0