Skip to content

Commit

Permalink
v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Davide Effe committed Mar 11, 2018
1 parent 5aa8dab commit 632ae73
Show file tree
Hide file tree
Showing 13 changed files with 309 additions and 929 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: node_js
node_js:
- "4"
- "5"
- "6"
- "node"
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Circumcenter Calculator

## 1.2.0

* removed dependancy from MathJS
* allow node `>=4.*`

## 1.1.0

* fix error when trying to calculate with undefined slopes
* fix 'singular matrix' error
* fix 'singular matrix' error
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ This package allows you to calculate the circumcenter of a triangle given 3 poin
const Point = require('circumcenter-calculator').Point;
const calculate = require('circumcenter-calculator').calculate;

const pointA = new Point(3,2);
const pointB = new Point(1,4);
const pointC = new Point(5,4);
const pointA = new Point(3,2);
const pointB = new Point(1,4);
const pointC = new Point(5,4);

const cirucmcenter = calculate(pointA, pointB, pointC);
const cirucmcenter = calculate(pointA, pointB, pointC);

console.log(cirucmcenter);

Expand All @@ -26,6 +26,9 @@ console.log(cirucmcenter);
*/
```

## Note
I'm not a JS dev, so the code is probably shitty... if you like to review it please feel free to do so! This is more an excercise for me :) thanks!

## Contributing
Feel free to open PR, requesting feature via [twitter](https://twitter.com/utnaf), sending and email, or opening an issue.

Expand Down
12 changes: 5 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
const circumcenterCalculator = (function() {
const Calculator = require("./src/CircumcenterCalculator").Calculator;
const Point = require("./src/Point").Point;
var calculate = (function() {
var calculate = require("./src/calculate").calculate;
var Point = require("./src/Point").Point;

exports.calculate = function(a, b, c) {
return (new Calculator()).calculate(a, b, c);
};
exports.calculate = calculate;
exports.Point = Point;

return exports;
})();

if (typeof module.exports === "object") module.exports = circumcenterCalculator;
if (typeof module.exports === "object") module.exports = calculate;
57 changes: 1 addition & 56 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "circumcenter-calculator",
"version": "1.1.0",
"version": "1.2.0",
"description": "Calculate the circumcenter given 3 coordinates.",
"author": "Davide Effe <utnaf.dev@gmail.com>",
"keywords": [
Expand All @@ -18,9 +18,7 @@
"private": false,
"main": "./index.js",
"dependencies": {
"babel-preset-env": "^1.6.1",
"linear-solve": "^1.2.1",
"mathjs": "^4.0.0"
"linear-solve": "^1.2.1"
},
"devDependencies": {
"chai": "^4.1.2",
Expand All @@ -30,7 +28,7 @@
"test": "mocha"
},
"engines": {
"node": ">=6.*"
"node": ">=4.*"
},
"engineStrict": true
}
120 changes: 0 additions & 120 deletions src/CircumcenterCalculator.js

This file was deleted.

22 changes: 10 additions & 12 deletions src/Equation.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
const round = require("mathjs").round;
var helpers = require("./helpers.js");

class Equation {
constructor(coeffX, coeffY, constant) {
this.x = round(coeffX, 5);
this.y = round(coeffY, 5);
this.constant = round(constant, 5);
}

toString() {
return `${this.x}x ${this.y}y = ${this.constant}`;
}
function Equation(coeffX, coeffY, constant) {
this.x = helpers.round(coeffX, 5);
this.y = helpers.round(coeffY, 5);
this.constant = helpers.round(constant, 5);
}

exports.Equation = Equation;
Equation.prototype.toString = function() {
return `${this.x}x ${this.y}y = ${this.constant}`;
};

module.exports.Equation = Equation;
20 changes: 9 additions & 11 deletions src/Point.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
const round = require("mathjs").round;
var round = require("./helpers").round;

class Point {
constructor(x, y) {
this.x = round(x, 3);
this.y = round(y, 3);
}
function Point(x, y) {
this.x = round(x, 3);
this.y = round(y, 3);
};

toString() {
return `${this.x}:${this.y}`;
}
}
Point.prototype.toString = function() {
return `${this.x}:${this.y}`;
};

exports.Point = Point;
module.exports.Point = Point;
Loading

0 comments on commit 632ae73

Please sign in to comment.