@devexpress/utils
Advanced tools
Comparing version
@@ -18,10 +18,2 @@ import { IPoint, IRectangle } from './interfaces'; | ||
} | ||
export declare class LineEquation extends Segment { | ||
private A; | ||
private B; | ||
private C; | ||
constructor(startPoint: Point, endPoint: Point); | ||
static intersection(a: LineEquation, b: LineEquation): Point | null; | ||
private initEquationParams; | ||
} | ||
//# sourceMappingURL=segment.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LineEquation = exports.Segment = void 0; | ||
var tslib_1 = require("tslib"); | ||
exports.Segment = void 0; | ||
var math_1 = require("../utils/math"); | ||
@@ -98,33 +97,1 @@ var point_1 = require("./point"); | ||
exports.Segment = Segment; | ||
var LineEquation = (function (_super) { | ||
tslib_1.__extends(LineEquation, _super); | ||
function LineEquation(startPoint, endPoint) { | ||
var _this = _super.call(this, startPoint, endPoint) || this; | ||
_this.initEquationParams(); | ||
return _this; | ||
} | ||
LineEquation.intersection = function (a, b) { | ||
var A1 = a.A; | ||
var B1 = a.B; | ||
var C1 = a.C; | ||
var A2 = b.A; | ||
var B2 = b.B; | ||
var C2 = b.C; | ||
var v = A2 * B1 - A1 * B2; | ||
if (math_1.MathUtils.numberCloseTo(v, 0)) | ||
return null; | ||
if (A1 === 0) { | ||
var x = (B2 * C1 - C2 * B1) / (B1 * A2); | ||
return new point_1.Point(x, -C1 / B1); | ||
} | ||
var y = (C2 * A1 - C1 * A2) / v; | ||
return new point_1.Point((-B1 * y - C1) / A1, y); | ||
}; | ||
LineEquation.prototype.initEquationParams = function () { | ||
this.A = this.endPoint.y - this.startPoint.y; | ||
this.B = this.startPoint.x - this.endPoint.x; | ||
this.C = this.endPoint.x * this.startPoint.y - this.startPoint.x * this.endPoint.y; | ||
}; | ||
return LineEquation; | ||
}(Segment)); | ||
exports.LineEquation = LineEquation; |
{ | ||
"name": "@devexpress/utils", | ||
"version": "1.0.0-alpha-012", | ||
"version": "1.0.0", | ||
"description": "DevExpress utils", | ||
@@ -5,0 +5,0 @@ "author": "DevExpress Inc.", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
820994
1.18%150
2.74%16858
1.23%0
-100%