Comparing version 2.4.24 to 2.4.25
@@ -9,6 +9,6 @@ import { DPoint } from './DPoint'; | ||
export declare class TraceMatrix { | ||
private readonly size; | ||
private readonly m; | ||
approximation: boolean; | ||
constructor(size: DPoint, f: (p: DPoint) => TraceMatrixValues); | ||
private readonly size; | ||
constructor(s: DPoint, f: (p: DPoint) => TraceMatrixValues); | ||
fullMatrixTrace(): DPolygon[]; | ||
@@ -15,0 +15,0 @@ private reverseMatrix; |
@@ -64,5 +64,4 @@ "use strict"; | ||
var TraceMatrix = (function () { | ||
function TraceMatrix(size, f) { | ||
function TraceMatrix(s, f) { | ||
var _this = this; | ||
this.size = size; | ||
this.approximation = true; | ||
@@ -203,3 +202,26 @@ this.findGroupByIndex = function (m, s) { | ||
}; | ||
this.m = TraceMatrix.createMatrix(this.size, f); | ||
this.size = s.clone().scale(4); | ||
var t = TraceMatrix.createMatrix(this.size, function (p) { | ||
var _a = p.clone().mod(4), x = _a.x, y = _a.y; | ||
if ([1, 2].includes(x) && [1, 2].includes(y)) { | ||
return f(p.clone().div(4)); | ||
} | ||
return TraceMatrixValues.f; | ||
}); | ||
this.m = TraceMatrix.createMatrix(this.size); | ||
for (var i = 1; i < this.size.x - 1; i++) { | ||
for (var j = 1; j < this.size.y - 1; j++) { | ||
if (t[i][j] === TraceMatrixValues.t) { | ||
this.m[i - 1][j - 1] = TraceMatrixValues.t; | ||
this.m[i - 1][j] = TraceMatrixValues.t; | ||
this.m[i - 1][j + 1] = TraceMatrixValues.t; | ||
this.m[i][j - 1] = TraceMatrixValues.t; | ||
this.m[i][j] = TraceMatrixValues.t; | ||
this.m[i][j + 1] = TraceMatrixValues.t; | ||
this.m[i + 1][j - 1] = TraceMatrixValues.t; | ||
this.m[i + 1][j] = TraceMatrixValues.t; | ||
this.m[i + 1][j + 1] = TraceMatrixValues.t; | ||
} | ||
} | ||
} | ||
} | ||
@@ -219,3 +241,6 @@ TraceMatrix.prototype.fullMatrixTrace = function () { | ||
} | ||
return res; | ||
return res.loop() | ||
.divide(4) | ||
.round() | ||
.run(); | ||
}); | ||
@@ -222,0 +247,0 @@ }; |
@@ -24,4 +24,3 @@ import { DPoint } from './DPoint'; | ||
export class TraceMatrix { | ||
constructor(size, f) { | ||
this.size = size; | ||
constructor(s, f) { | ||
this.approximation = true; | ||
@@ -151,3 +150,26 @@ this.findGroupByIndex = (m, s) => { | ||
}; | ||
this.m = TraceMatrix.createMatrix(this.size, f); | ||
this.size = s.clone().scale(4); | ||
const t = TraceMatrix.createMatrix(this.size, (p) => { | ||
const { x, y } = p.clone().mod(4); | ||
if ([1, 2].includes(x) && [1, 2].includes(y)) { | ||
return f(p.clone().div(4)); | ||
} | ||
return TraceMatrixValues.f; | ||
}); | ||
this.m = TraceMatrix.createMatrix(this.size); | ||
for (let i = 1; i < this.size.x - 1; i++) { | ||
for (let j = 1; j < this.size.y - 1; j++) { | ||
if (t[i][j] === TraceMatrixValues.t) { | ||
this.m[i - 1][j - 1] = TraceMatrixValues.t; | ||
this.m[i - 1][j] = TraceMatrixValues.t; | ||
this.m[i - 1][j + 1] = TraceMatrixValues.t; | ||
this.m[i][j - 1] = TraceMatrixValues.t; | ||
this.m[i][j] = TraceMatrixValues.t; | ||
this.m[i][j + 1] = TraceMatrixValues.t; | ||
this.m[i + 1][j - 1] = TraceMatrixValues.t; | ||
this.m[i + 1][j] = TraceMatrixValues.t; | ||
this.m[i + 1][j + 1] = TraceMatrixValues.t; | ||
} | ||
} | ||
} | ||
} | ||
@@ -166,3 +188,6 @@ fullMatrixTrace() { | ||
} | ||
return res; | ||
return res.loop() | ||
.divide(4) | ||
.round() | ||
.run(); | ||
}); | ||
@@ -169,0 +194,0 @@ } |
@@ -61,5 +61,4 @@ var __read = (this && this.__read) || function (o, n) { | ||
var TraceMatrix = (function () { | ||
function TraceMatrix(size, f) { | ||
function TraceMatrix(s, f) { | ||
var _this = this; | ||
this.size = size; | ||
this.approximation = true; | ||
@@ -200,3 +199,26 @@ this.findGroupByIndex = function (m, s) { | ||
}; | ||
this.m = TraceMatrix.createMatrix(this.size, f); | ||
this.size = s.clone().scale(4); | ||
var t = TraceMatrix.createMatrix(this.size, function (p) { | ||
var _a = p.clone().mod(4), x = _a.x, y = _a.y; | ||
if ([1, 2].includes(x) && [1, 2].includes(y)) { | ||
return f(p.clone().div(4)); | ||
} | ||
return TraceMatrixValues.f; | ||
}); | ||
this.m = TraceMatrix.createMatrix(this.size); | ||
for (var i = 1; i < this.size.x - 1; i++) { | ||
for (var j = 1; j < this.size.y - 1; j++) { | ||
if (t[i][j] === TraceMatrixValues.t) { | ||
this.m[i - 1][j - 1] = TraceMatrixValues.t; | ||
this.m[i - 1][j] = TraceMatrixValues.t; | ||
this.m[i - 1][j + 1] = TraceMatrixValues.t; | ||
this.m[i][j - 1] = TraceMatrixValues.t; | ||
this.m[i][j] = TraceMatrixValues.t; | ||
this.m[i][j + 1] = TraceMatrixValues.t; | ||
this.m[i + 1][j - 1] = TraceMatrixValues.t; | ||
this.m[i + 1][j] = TraceMatrixValues.t; | ||
this.m[i + 1][j + 1] = TraceMatrixValues.t; | ||
} | ||
} | ||
} | ||
} | ||
@@ -216,3 +238,6 @@ TraceMatrix.prototype.fullMatrixTrace = function () { | ||
} | ||
return res; | ||
return res.loop() | ||
.divide(4) | ||
.round() | ||
.run(); | ||
}); | ||
@@ -219,0 +244,0 @@ }; |
{ | ||
"name": "dgeoutils", | ||
"version": "2.4.24", | ||
"version": "2.4.25", | ||
"description": "Geometries utils for my projects", | ||
@@ -40,3 +40,3 @@ "scripts": { | ||
"@typescript-eslint/parser": "^4.33.0", | ||
"canvas": "^2.8.0", | ||
"canvas": "^2.10.1", | ||
"eslint": "^7.32.0", | ||
@@ -43,0 +43,0 @@ "eslint-plugin-flowtype": "^5.10.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1262817
17816