pimath 0.0.123 → 0.0.124

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/dist/pimath.js CHANGED
@@ -3581,7 +3581,15 @@ class Rational {
3581
3581
  this.reduce = () => {
3582
3582
  this._numerator.factorize();
3583
3583
  for (let f of this._numerator.factors) {
3584
- this.simplify(f);
3584
+ if (f.degree().isZero()) {
3585
+ // Do the simplify only if the factor can divide the denominator
3586
+ if (this._denominator.commonMonom().coefficient.clone().divide(f.monomByDegree().coefficient).isNatural()) {
3587
+ this.simplify(f);
3588
+ }
3589
+ }
3590
+ else {
3591
+ this.simplify(f);
3592
+ }
3585
3593
  }
3586
3594
  return this;
3587
3595
  };
@@ -3687,6 +3695,9 @@ class Rational {
3687
3695
  get tex() {
3688
3696
  return `\\frac{ ${this._numerator.tex} }{ ${this._denominator.tex} }`;
3689
3697
  }
3698
+ get display() {
3699
+ return `(${this._numerator.display})/(${this._denominator.display})`;
3700
+ }
3690
3701
  get texFactors() {
3691
3702
  return `\\frac{ ${this._numerator.texFactors} }{ ${this._denominator.texFactors} }`;
3692
3703
  }
@@ -6140,6 +6151,7 @@ class Triangle {
6140
6151
  return new vector_1.Vector(this.getPointByName(ptName1), this.getPointByName(ptName2));
6141
6152
  };
6142
6153
  this._calculateRemarquableLines = () => {
6154
+ const bA = this._calculateBisectors('A'), bB = this._calculateBisectors('B'), bC = this._calculateBisectors('C');
6143
6155
  let remarquables = {
6144
6156
  'medians': {
6145
6157
  'A': new line_1.Line(this._A, this._middles.BC),
@@ -6160,9 +6172,15 @@ class Triangle {
6160
6172
  'intersection': null
6161
6173
  },
6162
6174
  'bisectors': {
6163
- 'A': this._calculateBisectors('A'),
6164
- 'B': this._calculateBisectors('B'),
6165
- 'C': this._calculateBisectors('C'),
6175
+ 'A': bA.internal,
6176
+ 'B': bB.internal,
6177
+ 'C': bB.internal,
6178
+ 'intersection': null
6179
+ },
6180
+ externalBisectors: {
6181
+ 'A': bA.external,
6182
+ 'B': bB.external,
6183
+ 'C': bC.external,
6166
6184
  'intersection': null
6167
6185
  }
6168
6186
  };
@@ -6191,16 +6209,16 @@ class Triangle {
6191
6209
  let b1 = new line_1.Line(new equation_1.Equation(d1.equation.left.clone().multiply(d2.n.simplify().norm), d2.equation.left.clone().multiply(d1.n.simplify().norm)).reorder(true).simplify()), b2 = new line_1.Line(new equation_1.Equation(d1.equation.left.clone().multiply(d2.n.simplify().norm), d2.equation.left.clone().multiply(d1.n.simplify().norm).opposed()).reorder(true).simplify());
6192
6210
  // Must determine which bisectors is in the triangle
6193
6211
  if (pt === 'A') {
6194
- return b1.hitSegment(this.B, this.C) ? b1 : b2;
6212
+ return b1.hitSegment(this.B, this.C) ? { internal: b1, external: b2 } : { internal: b2, external: b1 };
6195
6213
  }
6196
6214
  if (pt === 'B') {
6197
- return b1.hitSegment(this.A, this.C) ? b1 : b2;
6215
+ return b1.hitSegment(this.A, this.C) ? { internal: b1, external: b2 } : { internal: b2, external: b1 };
6198
6216
  }
6199
6217
  if (pt === 'C') {
6200
- return b1.hitSegment(this.B, this.A) ? b1 : b2;
6218
+ return b1.hitSegment(this.B, this.A) ? { internal: b1, external: b2 } : { internal: b2, external: b1 };
6201
6219
  }
6202
6220
  // Default returns the first bisector
6203
- return b1;
6221
+ return { internal: b1, external: b2 };
6204
6222
  };
6205
6223
  if (values.length > 0) {
6206
6224
  this.parse(...values);