MCPcopy Create free account
hub / github.com/microsoft/SandDance / constructor

Method constructor

docs/app/js/sanddance-app.js:101565–101578  ·  view source on GitHub ↗
(points, options = {})

Source from the content-addressed store, hash-verified

101563var _polygonUtils = require("./polygon-utils");
101564class Polygon {
101565 constructor(points, options = {}){
101566 (0, _definePropertyDefault.default)(this, "points", void 0);
101567 (0, _definePropertyDefault.default)(this, "isFlatArray", void 0);
101568 (0, _definePropertyDefault.default)(this, "options", void 0);
101569 this.points = points;
101570 this.isFlatArray = !(0, _core.isArray)(points[0]);
101571 this.options = {
101572 start: options.start || 0,
101573 end: options.end || points.length,
101574 size: options.size || 2,
101575 isClosed: options.isClosed
101576 };
101577 Object.freeze(this);
101578 }
101579 getSignedArea() {
101580 if (this.isFlatArray) return (0, _polygonUtils.getPolygonSignedArea)(this.points, this.options);
101581 return (0, _polygonUtils.getPolygonSignedAreaPoints)(this.points, this.options);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected