Skip to content

Commit

Permalink
- Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbol99 committed Sep 20, 2020
1 parent f4c9866 commit f38e291
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ and have to be installed separately:
## Example:
```javascript
import {segment, point, Polygon} from "@flatten-js/core"
import {offset} from "@flatten-js/polygon-offset"
import offset from "@flatten-js/polygon-offset"

// Create polygon
let shapes = [
Expand Down
13 changes: 9 additions & 4 deletions examples/nodejs/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Just hit "node index.js" in the terminal while you are in the directory of this project
let {point, segment, Polygon} = require('@flatten-js/core');
let {offset} = require('@flatten-js/polygon-offset');
import Flatten from "@flatten-js/core";
import Offset from "@flatten-js/polygon-offset";

let {point, segment, Polygon} = Flatten;
let offset = Offset.default;

let shapes = [
segment(point(200, 100), point(200, 300)),
Expand All @@ -15,8 +18,10 @@ let shapes = [
segment(point(740, 100), point(200, 100))
];
let polygon = new Polygon(shapes);
let value = 35;
let value = 40;

let offset_polygon = offset(polygon, value);

console.log("ok");
console.log(offset_polygon.faces.size);
console.log(offset_polygon.edges.size);

1 change: 1 addition & 0 deletions examples/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.1",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand Down

0 comments on commit f38e291

Please sign in to comment.