vector33
v0.0.3
Published
It is made for homework
Downloads
2
Readme
it is made for homework
Introducton
npm intall vector33
Use vector33
file : vector33.js
class Vector {
constructor(x,y) {
this.x = x;
this.y = y;
}
add(v2) {
return new Vector(this.x+v2.x,this.y+v2.y)
}
sub(v2) {
return new Vector(this.x-v2.x,this.y-v2.y)
}
dot(v2) {
return new Vector(this.x*v2.x,this.y*v2.y)
}
neg() {
return new Vector(-this.x,-this.y)
}
toString() {
return "("+this.x+","+this.y+")"
}
}
module.exports = Vector;