pimath 0.0.23 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dev/index.html +6 -5
- package/dev/pi.js +17 -4
- package/dev/pi.js.map +1 -1
- package/dist/pi.js +1 -1
- package/dist/pi.js.map +1 -1
- package/esm/maths/geometry/line.js +1 -1
- package/esm/maths/geometry/line.js.map +1 -1
- package/package.json +1 -1
- package/src/maths/geometry/line.ts +3 -3
package/dev/index.html
CHANGED
|
@@ -18,12 +18,13 @@
|
|
|
18
18
|
|
|
19
19
|
<script>
|
|
20
20
|
|
|
21
|
-
let
|
|
22
|
-
degree: 4,
|
|
23
|
-
fraction: false
|
|
24
|
-
})
|
|
21
|
+
let L = new Pi.Geometry.Line('6x-8y+12=0')
|
|
25
22
|
|
|
26
|
-
console.log(
|
|
23
|
+
console.log(L.a.display, L.b.display, L.c.display)
|
|
24
|
+
L.simplify()
|
|
25
|
+
console.log(L.a.display, L.b.display, L.c.display)
|
|
26
|
+
|
|
27
|
+
console.log(L.tex.canonical)
|
|
27
28
|
|
|
28
29
|
// let C1 = new Pi.Geometry.Point(-5, 4),
|
|
29
30
|
// r1 = 36,
|
package/dev/pi.js
CHANGED
|
@@ -3220,6 +3220,14 @@ class Line {
|
|
|
3220
3220
|
(values[2] instanceof coefficients_1.Fraction || typeof values[2] === 'number')) {
|
|
3221
3221
|
return this.parseByCoefficient(values[0], values[1], values[2]);
|
|
3222
3222
|
}
|
|
3223
|
+
else if (values[0] instanceof point_1.Point && values[1] instanceof vector_1.Vector) {
|
|
3224
|
+
if (values[2] === LinePropriety.Perpendicular) {
|
|
3225
|
+
return this.parseByPointAndNormal(values[0], values[1]);
|
|
3226
|
+
}
|
|
3227
|
+
else if (values[2] === LinePropriety.Parallel) {
|
|
3228
|
+
return this.parseByPointAndVector(values[0], values[1]);
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3223
3231
|
}
|
|
3224
3232
|
console.log('Someting wrong happend while creating the line');
|
|
3225
3233
|
return this;
|
|
@@ -3291,6 +3299,11 @@ class Line {
|
|
|
3291
3299
|
isSameAs = (line) => {
|
|
3292
3300
|
return this.slope.isEqual(line.slope) && this.height.isEqual(line.height);
|
|
3293
3301
|
};
|
|
3302
|
+
simplify = () => {
|
|
3303
|
+
let lcm = numeric_1.Numeric.lcm(this._a.denominator, this._b.denominator, this._c.denominator), gcd = numeric_1.Numeric.gcd(this._a.numerator, this._b.numerator, this._c.numerator);
|
|
3304
|
+
this.parseByCoefficient(this._a.clone().multiply(lcm).divide(gcd), this._b.clone().multiply(lcm).divide(gcd), this._c.clone().multiply(lcm).divide(gcd));
|
|
3305
|
+
return this;
|
|
3306
|
+
};
|
|
3294
3307
|
simplifyDirection = () => {
|
|
3295
3308
|
let lcm = numeric_1.Numeric.lcm(this._d.x.denominator, this._d.y.denominator), gcd = numeric_1.Numeric.gcd(this._d.x.numerator, this._d.y.numerator);
|
|
3296
3309
|
this._d.x.multiply(lcm).divide(gcd);
|
|
@@ -3360,16 +3373,16 @@ class Line {
|
|
|
3360
3373
|
return false;
|
|
3361
3374
|
}
|
|
3362
3375
|
getValueAtX = (value) => {
|
|
3363
|
-
const equ = this.equation.clone().isolate('y');
|
|
3376
|
+
const equ = this.equation.clone().isolate('y'), F = new coefficients_1.Fraction(value);
|
|
3364
3377
|
if (equ instanceof algebra_1.Equation) {
|
|
3365
|
-
return equ.right.evaluate({ x:
|
|
3378
|
+
return equ.right.evaluate({ x: F });
|
|
3366
3379
|
}
|
|
3367
3380
|
return;
|
|
3368
3381
|
};
|
|
3369
3382
|
getValueAtY = (value) => {
|
|
3370
|
-
const equ = this.equation.clone().isolate('x');
|
|
3383
|
+
const equ = this.equation.clone().isolate('x'), F = new coefficients_1.Fraction(value);
|
|
3371
3384
|
if (equ instanceof algebra_1.Equation) {
|
|
3372
|
-
return equ.right.evaluate({ y:
|
|
3385
|
+
return equ.right.evaluate({ y: F });
|
|
3373
3386
|
}
|
|
3374
3387
|
return;
|
|
3375
3388
|
};
|