Comparing version 1.0.0 to 1.0.1
@@ -55,4 +55,4 @@ "use strict"; | ||
t.x = this.p1.x; | ||
const r1 = t.clone().move(0, -move); | ||
const r2 = t.clone().move(0, move); | ||
const r1 = t.clone().moveCurrent(0, -move); | ||
const r2 = t.clone().moveCurrent(0, move); | ||
return [r1, r2]; | ||
@@ -63,4 +63,4 @@ } | ||
t.y = this.p1.y; | ||
const r1 = t.clone().move(move, 0); | ||
const r2 = t.clone().move(-move, 0); | ||
const r1 = t.clone().moveCurrent(move, 0); | ||
const r2 = t.clone().moveCurrent(-move, 0); | ||
return [r1, r2]; | ||
@@ -80,4 +80,4 @@ } | ||
const mult = Math.sqrt(d / s); | ||
const r1 = t.clone().move(b * mult, -a * mult); | ||
const r2 = t.clone().move(-b * mult, a * mult); | ||
const r1 = t.clone().moveCurrent(b * mult, -a * mult); | ||
const r2 = t.clone().moveCurrent(-b * mult, a * mult); | ||
return [r1, r2]; | ||
@@ -84,0 +84,0 @@ } |
@@ -58,13 +58,57 @@ import { DLine } from './DLine'; | ||
ltOrEqual(p: DPoint): boolean; | ||
/** | ||
* @deprecated | ||
* @param a | ||
*/ | ||
rotate(a: number): DPoint; | ||
/** | ||
* @deprecated | ||
* @param x | ||
* @param y | ||
*/ | ||
move(x?: number | DPoint, y?: number): DPoint; | ||
asRadians(): DPoint; | ||
asDegrees(): DPoint; | ||
/** | ||
* @deprecated | ||
*/ | ||
round(): DPoint; | ||
/** | ||
* @deprecated | ||
*/ | ||
ceil(): DPoint; | ||
/** | ||
* @deprecated | ||
*/ | ||
floor(): DPoint; | ||
/** | ||
* @deprecated | ||
* @param n | ||
*/ | ||
toFixed(n?: number): DPoint; | ||
/** | ||
* @deprecated | ||
*/ | ||
abs(): DPoint; | ||
/** | ||
* @deprecated | ||
* @param x | ||
* @param y | ||
*/ | ||
scale(x?: number | DPoint, y?: number): DPoint; | ||
/** | ||
* @deprecated | ||
* @param x | ||
* @param y | ||
*/ | ||
divide(x?: number | DPoint, y?: number): DPoint; | ||
rotateCurrent(a: number): DPoint; | ||
moveCurrent(x?: number | DPoint, y?: number): DPoint; | ||
asRadians(): DPoint; | ||
asDegrees(): DPoint; | ||
roundCurrent(): DPoint; | ||
ceilCurrent(): DPoint; | ||
floorCurrent(): DPoint; | ||
toFixedCurrent(n?: number): DPoint; | ||
absCurrent(): DPoint; | ||
scaleCurrent(x?: number | DPoint, y?: number): DPoint; | ||
divideCurrent(x?: number | DPoint, y?: number): DPoint; | ||
equal(p: DPoint): boolean; | ||
@@ -71,0 +115,0 @@ like(p: DPoint, d?: number): boolean; |
@@ -84,3 +84,3 @@ "use strict"; | ||
if (this.equal(p)) { | ||
return this.findLine(p.clone().move(0, 1)); | ||
return this.findLine(p.clone().moveCurrent(0, 1)); | ||
} | ||
@@ -162,3 +162,77 @@ const a = this.y - p.y - diff; | ||
} | ||
/** | ||
* @deprecated | ||
* @param a | ||
*/ | ||
rotate(a) { | ||
return new DPoint(this.x * Math.cos(a) - this.y * Math.sin(a), this.x * Math.sin(a) + this.y * Math.cos(a)); | ||
} | ||
/** | ||
* @deprecated | ||
* @param x | ||
* @param y | ||
*/ | ||
move(x = 0, y) { | ||
if (x instanceof DPoint && !y) { | ||
return new DPoint(this.x + x.x, this.y + x.y, this.z); | ||
} | ||
// eslint-disable-next-line no-negated-condition | ||
return new DPoint(this.x + x, this.y + (y !== undefined ? y : x), this.z); | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
round() { | ||
return new DPoint(Math.round(this.x), Math.round(this.y), this.z); | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
ceil() { | ||
return new DPoint(Math.ceil(this.x), Math.ceil(this.y), this.z); | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
floor() { | ||
return new DPoint(Math.floor(this.x), Math.floor(this.y), this.z); | ||
} | ||
/** | ||
* @deprecated | ||
* @param n | ||
*/ | ||
toFixed(n = 2) { | ||
return new DPoint(parseFloat(this.x.toFixed(n)), parseFloat(this.y.toFixed(n)), this.z); | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
abs() { | ||
return new DPoint(Math.abs(this.x), Math.abs(this.y)); | ||
} | ||
/** | ||
* @deprecated | ||
* @param x | ||
* @param y | ||
*/ | ||
scale(x = 0, y) { | ||
if (x instanceof DPoint && !y) { | ||
return new DPoint(this.x * x.x, this.y * x.y); | ||
} | ||
// eslint-disable-next-line no-negated-condition | ||
return new DPoint(this.x * x, this.y * (y !== undefined ? y : x)); | ||
} | ||
/** | ||
* @deprecated | ||
* @param x | ||
* @param y | ||
*/ | ||
divide(x = 0, y) { | ||
if (x instanceof DPoint && !y) { | ||
return new DPoint(this.x / x.x, this.y / x.y); | ||
} | ||
// eslint-disable-next-line no-negated-condition | ||
return new DPoint(this.x / x, this.y / (y !== undefined ? y : x)); | ||
} | ||
rotateCurrent(a) { | ||
const x = this.x * Math.cos(a) - this.y * Math.sin(a); | ||
@@ -170,3 +244,3 @@ const y = this.x * Math.sin(a) + this.y * Math.cos(a); | ||
} | ||
move(x = 0, y = x) { | ||
moveCurrent(x = 0, y = x) { | ||
let xV = 0; | ||
@@ -187,8 +261,8 @@ let yV = 0; | ||
asRadians() { | ||
return this.scale(exports.PI_TO_DEGREE); | ||
return this.scaleCurrent(exports.PI_TO_DEGREE); | ||
} | ||
asDegrees() { | ||
return this.scale(exports.DEGREE_TO_PI); | ||
return this.scaleCurrent(exports.DEGREE_TO_PI); | ||
} | ||
round() { | ||
roundCurrent() { | ||
this.x = Math.round(this.x); | ||
@@ -198,3 +272,3 @@ this.y = Math.round(this.y); | ||
} | ||
ceil() { | ||
ceilCurrent() { | ||
this.x = Math.ceil(this.x); | ||
@@ -204,3 +278,3 @@ this.y = Math.ceil(this.y); | ||
} | ||
floor() { | ||
floorCurrent() { | ||
this.x = Math.floor(this.x); | ||
@@ -210,3 +284,3 @@ this.y = Math.floor(this.y); | ||
} | ||
toFixed(n = 2) { | ||
toFixedCurrent(n = 2) { | ||
this.x = parseFloat(this.x.toFixed(n)); | ||
@@ -216,3 +290,3 @@ this.y = parseFloat(this.y.toFixed(n)); | ||
} | ||
abs() { | ||
absCurrent() { | ||
this.x = Math.abs(this.x); | ||
@@ -222,3 +296,3 @@ this.y = Math.abs(this.y); | ||
} | ||
scale(x = 0, y = x) { | ||
scaleCurrent(x = 0, y = x) { | ||
let xV = 0; | ||
@@ -238,3 +312,3 @@ let yV = 0; | ||
} | ||
divide(x = 0, y = x) { | ||
divideCurrent(x = 0, y = x) { | ||
let xV = 0; | ||
@@ -317,3 +391,3 @@ let yV = 0; | ||
minus() { | ||
return this.scale(-1); | ||
return this.clone().scaleCurrent(-1); | ||
} | ||
@@ -320,0 +394,0 @@ orthodromicPath(point, pointsCount = 360) { |
@@ -105,3 +105,3 @@ "use strict"; | ||
get center() { | ||
return this.leftTop.move(this.size.divide(2)); | ||
return this.leftTop.moveCurrent(this.size.divideCurrent(2)); | ||
} | ||
@@ -317,3 +317,3 @@ get h() { | ||
setCenter(newCenter) { | ||
return this.clone().move(newCenter.move(this.center.minus())); | ||
return this.clone().move(newCenter.clone().moveCurrent(this.center.minus())); | ||
} | ||
@@ -328,3 +328,3 @@ toWKT() { | ||
rotate(a) { | ||
this.pPoints = this.pPoints.map((p) => p.rotate(a)); | ||
this.pPoints = this.pPoints.map((p) => p.rotateCurrent(a)); | ||
this.holes = this.holes.map((h) => h.rotate(a)); | ||
@@ -338,3 +338,3 @@ return this; | ||
move(x = 0, y) { | ||
this.pPoints = this.pPoints.map((p) => p.move(x, y)); | ||
this.pPoints = this.pPoints.map((p) => p.moveCurrent(x, y)); | ||
this.holes = this.holes.map((h) => h.move(x, y)); | ||
@@ -344,3 +344,3 @@ return this; | ||
scale(x = 0, y) { | ||
this.pPoints = this.pPoints.map((p) => p.scale(x, y)); | ||
this.pPoints = this.pPoints.map((p) => p.scaleCurrent(x, y)); | ||
this.holes = this.holes.map((h) => h.scale(x, y)); | ||
@@ -350,3 +350,3 @@ return this; | ||
divide(x = 0, y) { | ||
this.pPoints = this.pPoints.map((p) => p.divide(x, y)); | ||
this.pPoints = this.pPoints.map((p) => p.divideCurrent(x, y)); | ||
this.holes = this.holes.map((h) => h.divide(x, y)); | ||
@@ -356,3 +356,3 @@ return this; | ||
round() { | ||
this.pPoints = this.pPoints.map((p) => p.round()); | ||
this.pPoints = this.pPoints.map((p) => p.roundCurrent()); | ||
this.holes = this.holes.map((h) => h.round()); | ||
@@ -362,3 +362,3 @@ return this; | ||
floor() { | ||
this.pPoints = this.pPoints.map((p) => p.floor()); | ||
this.pPoints = this.pPoints.map((p) => p.floorCurrent()); | ||
this.holes = this.holes.map((h) => h.floor()); | ||
@@ -368,3 +368,3 @@ return this; | ||
ceil() { | ||
this.pPoints = this.pPoints.map((p) => p.ceil()); | ||
this.pPoints = this.pPoints.map((p) => p.ceilCurrent()); | ||
this.holes = this.holes.map((h) => h.ceil()); | ||
@@ -374,3 +374,3 @@ return this; | ||
toFixed(n = 2) { | ||
this.pPoints = this.pPoints.map((p) => p.toFixed(n)); | ||
this.pPoints = this.pPoints.map((p) => p.toFixedCurrent(n)); | ||
this.holes = this.holes.map((h) => h.toFixed(n)); | ||
@@ -555,3 +555,3 @@ return this; | ||
} | ||
const line = p.findLine(this.leftTop.move(move)); | ||
const line = p.findLine(this.leftTop.moveCurrent(move)); | ||
const poly = this.deintersection; | ||
@@ -558,0 +558,0 @@ const intersectionPoints = []; |
@@ -103,4 +103,4 @@ "use strict"; | ||
while (true) { | ||
const nextValue = getByPosition(m, p.clone().move(traceDirections[direction])); | ||
const nextNeighbourValue = getByPosition(m, p.clone().move(traceDirections[left(direction)])); | ||
const nextValue = getByPosition(m, p.clone().moveCurrent(traceDirections[direction])); | ||
const nextNeighbourValue = getByPosition(m, p.clone().moveCurrent(traceDirections[left(direction)])); | ||
if (nextValue === TraceMatrixValues.t && nextNeighbourValue === TraceMatrixValues.f) { | ||
@@ -115,3 +115,3 @@ break; | ||
} | ||
p = p.clone().move(traceDirections[direction]); | ||
p = p.clone().moveCurrent(traceDirections[direction]); | ||
direction = left(left(direction)); | ||
@@ -143,3 +143,3 @@ } | ||
for (const direction of fullTraceDirections) { | ||
const tmpPoint = point.clone().move(direction); | ||
const tmpPoint = point.clone().moveCurrent(direction); | ||
const value = getByPosition(tmpMatrix, tmpPoint, TraceMatrixValues.t); | ||
@@ -146,0 +146,0 @@ if (value === TraceMatrixValues.f) { |
{ | ||
"name": "dgeoutils", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "scripts": { |
73327
2112