pimath 0.1.8 → 0.1.9

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
@@ -328,25 +328,25 @@ w = new WeakMap(), b = new WeakMap(), ht = new WeakMap(), Se = new WeakMap(), a(
328
328
  return t;
329
329
  });
330
330
  let c = $;
331
- var V, J, se, Xe;
331
+ var V, ee, se, Xe;
332
332
  class pt {
333
333
  constructor(...e) {
334
334
  d(this, V);
335
- d(this, J);
335
+ d(this, ee);
336
336
  d(this, se);
337
337
  d(this, Xe);
338
338
  // ------------------------------------------
339
339
  // Creation / parsing functions
340
340
  // ------------------------------------------
341
- a(this, "parse", (e, t, s) => (h(this, se, s ?? 1), h(this, J, t ?? 2), h(this, V, e), i(this, J) % 2 === 0 && i(this, V) < 0 && h(this, Xe, !1), this));
341
+ a(this, "parse", (e, t, s) => (h(this, se, s ?? 1), h(this, ee, t ?? 2), h(this, V, e), i(this, ee) % 2 === 0 && i(this, V) < 0 && h(this, Xe, !1), this));
342
342
  // ------------------------------------------
343
343
  // Mathematical operations
344
344
  // ------------------------------------------
345
345
  a(this, "reduce", () => {
346
- let e = Math.floor(Math.pow(i(this, V), 1 / i(this, J)));
346
+ let e = Math.floor(Math.pow(i(this, V), 1 / i(this, ee)));
347
347
  for (; e > 1; ) {
348
- if (i(this, V) % Math.pow(e, i(this, J)) === 0) {
349
- h(this, se, i(this, se) * e), h(this, V, i(this, V) / Math.pow(e, i(this, J))), e = Math.floor(Math.pow(i(this, V), 1 / i(this, J)));
348
+ if (i(this, V) % Math.pow(e, i(this, ee)) === 0) {
349
+ h(this, se, i(this, se) * e), h(this, V, i(this, V) / Math.pow(e, i(this, ee))), e = Math.floor(Math.pow(i(this, V), 1 / i(this, ee)));
350
350
  continue;
351
351
  }
352
352
  e--;
@@ -358,7 +358,7 @@ class pt {
358
358
  // Help functions
359
359
  // ------------------------------------------
360
360
  a(this, "hasRadical", () => !(i(this, V) === 1 || i(this, V) === 0 || !i(this, Xe)));
361
- h(this, V, 1), h(this, se, 1), h(this, J, 2), h(this, Xe, !0), e.length > 0 && this.parse(e[0], e[1], e[2]);
361
+ h(this, V, 1), h(this, se, 1), h(this, ee, 2), h(this, Xe, !0), e.length > 0 && this.parse(e[0], e[1], e[2]);
362
362
  }
363
363
  // ------------------------------------------
364
364
  // Getter and setter
@@ -370,10 +370,10 @@ class pt {
370
370
  h(this, V, e);
371
371
  }
372
372
  get nth() {
373
- return i(this, J);
373
+ return i(this, ee);
374
374
  }
375
375
  set nth(e) {
376
- Number.isSafeInteger(e) && e >= 2 ? h(this, J, e) : (console.log("Error setting the nth root"), h(this, J, 2));
376
+ Number.isSafeInteger(e) && e >= 2 ? h(this, ee, e) : (console.log("Error setting the nth root"), h(this, ee, 2));
377
377
  }
378
378
  get coefficient() {
379
379
  return i(this, se);
@@ -383,20 +383,20 @@ class pt {
383
383
  }
384
384
  get tex() {
385
385
  let e;
386
- return i(this, se) === 1 ? e = "" : i(this, se) === -1 ? e = "-" : e = i(this, se).toString(), i(this, V) === 1 ? `${i(this, se)}` : i(this, J) === 2 ? `${e}\\sqrt{${i(this, V)}}` : `${e}\\sqrt[${i(this, J)}]{${i(this, V)}}`;
386
+ return i(this, se) === 1 ? e = "" : i(this, se) === -1 ? e = "-" : e = i(this, se).toString(), i(this, V) === 1 ? `${i(this, se)}` : i(this, ee) === 2 ? `${e}\\sqrt{${i(this, V)}}` : `${e}\\sqrt[${i(this, ee)}]{${i(this, V)}}`;
387
387
  }
388
388
  get display() {
389
389
  let e;
390
- return i(this, se) === 1 ? e = "" : i(this, se) === -1 ? e = "-" : e = i(this, se).toString(), i(this, V) === 1 ? `${i(this, se)}` : i(this, J) === 2 ? `${e}sqrt{${i(this, V)}}` : `${e}root(${i(this, J)}){${i(this, V)}}`;
390
+ return i(this, se) === 1 ? e = "" : i(this, se) === -1 ? e = "-" : e = i(this, se).toString(), i(this, V) === 1 ? `${i(this, se)}` : i(this, ee) === 2 ? `${e}sqrt{${i(this, V)}}` : `${e}root(${i(this, ee)}){${i(this, V)}}`;
391
391
  }
392
392
  get value() {
393
- return i(this, se) * Math.pow(i(this, V), 1 / i(this, J));
393
+ return i(this, se) * Math.pow(i(this, V), 1 / i(this, ee));
394
394
  }
395
395
  }
396
- V = new WeakMap(), J = new WeakMap(), se = new WeakMap(), Xe = new WeakMap();
396
+ V = new WeakMap(), ee = new WeakMap(), se = new WeakMap(), Xe = new WeakMap();
397
397
  var Di = Object.defineProperty, fi = (o) => {
398
398
  throw TypeError(o);
399
- }, Vi = (o, e, t) => e in o ? Di(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t, Xt = (o, e, t) => Vi(o, typeof e != "symbol" ? e + "" : e, t), di = (o, e, t) => e.has(o) || fi("Cannot " + t), K = (o, e, t) => (di(o, e, "read from private field"), t ? t.call(o) : e.get(o)), st = (o, e, t) => e.has(o) ? fi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), be = (o, e, t, s) => (di(o, e, "write to private field"), e.set(o, t), t);
399
+ }, Vi = (o, e, t) => e in o ? Di(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t, Xt = (o, e, t) => Vi(o, typeof e != "symbol" ? e + "" : e, t), di = (o, e, t) => e.has(o) || fi("Cannot " + t), _ = (o, e, t) => (di(o, e, "read from private field"), t ? t.call(o) : e.get(o)), st = (o, e, t) => e.has(o) ? fi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), be = (o, e, t, s) => (di(o, e, "write to private field"), e.set(o, t), t);
400
400
  const ri = {
401
401
  pi: Math.PI,
402
402
  e: Math.exp(1)
@@ -497,13 +497,13 @@ class Gt {
497
497
  }
498
498
  // Getter
499
499
  get rpn() {
500
- return K(this, nt);
500
+ return _(this, nt);
501
501
  }
502
502
  get rpnToken() {
503
- return K(this, nt).map((e) => e.token);
503
+ return _(this, nt).map((e) => e.token);
504
504
  }
505
505
  tokenConfigInitialization() {
506
- return K(this, Ge) === Ve.SET ? (be(this, ie, Wi), be(this, Le, !1)) : K(this, Ge) === Ve.NUMERIC ? (be(this, ie, Gi), be(this, Le, !0)) : K(this, Ge) === Ve.EXPRESSION ? (be(this, ie, Ui), be(this, Le, !0)) : (be(this, ie, ji), be(this, Le, !0)), be(this, mt, Object.keys(K(this, ie)).sort((e, t) => t.length - e.length)), K(this, ie);
506
+ return _(this, Ge) === Ve.SET ? (be(this, ie, Wi), be(this, Le, !1)) : _(this, Ge) === Ve.NUMERIC ? (be(this, ie, Gi), be(this, Le, !0)) : _(this, Ge) === Ve.EXPRESSION ? (be(this, ie, Ui), be(this, Le, !0)) : (be(this, ie, ji), be(this, Le, !0)), be(this, mt, Object.keys(_(this, ie)).sort((e, t) => t.length - e.length)), _(this, ie);
507
507
  }
508
508
  /**
509
509
  * Get the next token to analyse.
@@ -519,9 +519,9 @@ class Gt {
519
519
  else if (e[t] === ",")
520
520
  s = ",", n = p.FUNCTION_ARGUMENT;
521
521
  else {
522
- for (const r of K(this, mt))
522
+ for (const r of _(this, mt))
523
523
  if (e.substring(t, t + r.length) === r) {
524
- s += r, n = K(this, ie)[r].type;
524
+ s += r, n = _(this, ie)[r].type;
525
525
  break;
526
526
  }
527
527
  for (const r in ri)
@@ -552,7 +552,7 @@ class Gt {
552
552
  parse(e, t) {
553
553
  const s = [], n = [];
554
554
  let r = "", l = 0, u;
555
- (t ?? K(this, Le)) && (e = Zi(e, K(this, ie)));
555
+ (t ?? _(this, Le)) && (e = Zi(e, _(this, ie)));
556
556
  const f = 50;
557
557
  let m = 50, g;
558
558
  for (; l < e.length; ) {
@@ -573,9 +573,9 @@ class Gt {
573
573
  case p.OPERATION:
574
574
  if (n.length > 0) {
575
575
  let E = n[n.length - 1];
576
- for (g = +f; E.token in K(this, ie) && //either o1 is left-associative and its precedence is less than or equal to that of o2,
577
- (K(this, ie)[r].associative === "left" && K(this, ie)[r].precedence <= K(this, ie)[E.token].precedence || //or o1 is right associative, and has precedence less than that of o2,
578
- K(this, ie)[r].associative === "right" && K(this, ie)[r].precedence < K(this, ie)[E.token].precedence); ) {
576
+ for (g = +f; E.token in _(this, ie) && //either o1 is left-associative and its precedence is less than or equal to that of o2,
577
+ (_(this, ie)[r].associative === "left" && _(this, ie)[r].precedence <= _(this, ie)[E.token].precedence || //or o1 is right associative, and has precedence less than that of o2,
578
+ _(this, ie)[r].associative === "right" && _(this, ie)[r].precedence < _(this, ie)[E.token].precedence); ) {
579
579
  if (g--, g === 0) {
580
580
  console.log("SECURITY LEVEL 2 OPERATION EXIT");
581
581
  break;
@@ -2866,7 +2866,7 @@ function de(o, e, t) {
2866
2866
  s = de(o, e);
2867
2867
  return s;
2868
2868
  }
2869
- function X(o, e) {
2869
+ function Y(o, e) {
2870
2870
  return e === !1 ? vi() ? de(1, o) : -de(1, o) : de(-o, o);
2871
2871
  }
2872
2872
  function Ji(o) {
@@ -2913,7 +2913,7 @@ class j extends x {
2913
2913
  return e.array = this.copy(), e.asPoint = !0, e;
2914
2914
  }
2915
2915
  }
2916
- var xi = /* @__PURE__ */ ((o) => (o.None = "none", o.Parallel = "parallel", o.Perpendicular = "perpendicular", o.Tangent = "tangent", o))(xi || {}), $e, B, S, U, re, Y, Ie, ve;
2916
+ var xi = /* @__PURE__ */ ((o) => (o.None = "none", o.Parallel = "parallel", o.Perpendicular = "perpendicular", o.Tangent = "tangent", o))(xi || {}), $e, B, S, U, re, Q, Ie, ve;
2917
2917
  const De = class De {
2918
2918
  /**
2919
2919
  * Value can be a mix of:
@@ -2927,15 +2927,15 @@ const De = class De {
2927
2927
  d(this, S);
2928
2928
  d(this, U);
2929
2929
  d(this, re);
2930
- d(this, Y);
2930
+ d(this, Q);
2931
2931
  d(this, Ie);
2932
2932
  d(this, ve, "canonical");
2933
- a(this, "randomPoint", (e) => i(this, Y).clone().multiplyByScalar(X(e === void 0 || e <= 1 ? 3 : e, !1)).add(i(this, re)));
2933
+ a(this, "randomPoint", (e) => i(this, Q).clone().multiplyByScalar(Y(e === void 0 || e <= 1 ? 3 : e, !1)).add(i(this, re)));
2934
2934
  a(this, "randomNearPoint", (e) => {
2935
2935
  const t = this.randomPoint(e);
2936
2936
  let s = 10;
2937
2937
  for (; this.isOnLine(t) && s > 0; )
2938
- t.x.add(X(1, !1)), t.y.add(X(1, !1)), s--;
2938
+ t.x.add(Y(1, !1)), t.y.add(Y(1, !1)), s--;
2939
2939
  return t;
2940
2940
  });
2941
2941
  // ------------------------------------------
@@ -3007,19 +3007,19 @@ const De = class De {
3007
3007
  e.left.monomByDegree(0).coefficient
3008
3008
  );
3009
3009
  });
3010
- a(this, "fromCoefficient", (e, t, s) => (h(this, B, new c(e)), h(this, S, new c(t)), h(this, U, new c(s)), h(this, Y, new x(i(this, S).clone(), i(this, B).clone().opposite())), h(this, re, new x(new c().zero(), i(this, U).clone())), h(this, Ie, i(this, Y).clone().normal()), this));
3010
+ a(this, "fromCoefficient", (e, t, s) => (h(this, B, new c(e)), h(this, S, new c(t)), h(this, U, new c(s)), h(this, Q, new x(i(this, S).clone(), i(this, B).clone().opposite())), h(this, re, new x(new c().zero(), i(this, U).clone())), h(this, Ie, i(this, Q).clone().normal()), this));
3011
3011
  a(this, "fromPointAndDirection", (e, t) => (this.fromCoefficient(
3012
3012
  t.y,
3013
3013
  t.x.clone().opposite(),
3014
3014
  e.x.clone().multiply(t.y).subtract(e.y.clone().multiply(t.x)).opposite()
3015
- ), h(this, re, e.clone()), h(this, Y, t.clone()), h(this, Ie, i(this, Y).clone().normal()), this));
3015
+ ), h(this, re, e.clone()), h(this, Q, t.clone()), h(this, Ie, i(this, Q).clone().normal()), this));
3016
3016
  a(this, "fromPointAndNormal", (e, t) => this.fromCoefficient(
3017
3017
  t.x,
3018
3018
  t.y,
3019
3019
  e.x.clone().multiply(t.x).add(e.y.clone().multiply(t.y)).opposite()
3020
3020
  ));
3021
3021
  a(this, "fromPointAndLine", (e, t, s) => (s === void 0 && (s = "parallel"), s === "parallel" ? this.fromPointAndNormal(e, t.normal) : s === "perpendicular" ? this.fromPointAndNormal(e, t.director) : this));
3022
- a(this, "clone", () => (h(this, B, i(this, B).clone()), h(this, S, i(this, S).clone()), h(this, U, i(this, U).clone()), h(this, Y, i(this, Y).clone()), h(this, re, i(this, re).clone()), h(this, Ie, i(this, Ie).clone()), this));
3022
+ a(this, "clone", () => (h(this, B, i(this, B).clone()), h(this, S, i(this, S).clone()), h(this, U, i(this, U).clone()), h(this, Q, i(this, Q).clone()), h(this, re, i(this, re).clone()), h(this, Ie, i(this, Ie).clone()), this));
3023
3023
  // ------------------------------------------
3024
3024
  // Mathematical operations
3025
3025
  // ------------------------------------------
@@ -3038,7 +3038,7 @@ const De = class De {
3038
3038
  i(this, U).clone().multiply(e).divide(t)
3039
3039
  ), this;
3040
3040
  });
3041
- a(this, "simplifyDirection", () => (i(this, Y).simplify(), this));
3041
+ a(this, "simplifyDirection", () => (i(this, Q).simplify(), this));
3042
3042
  a(this, "intersection", (e) => {
3043
3043
  const t = new x();
3044
3044
  let s = !1, n = !1;
@@ -3057,7 +3057,7 @@ const De = class De {
3057
3057
  const t = this.getEquation().isolate("x"), s = new c(e);
3058
3058
  return t instanceof H ? t.right.evaluate({ y: s }) : new c().invalid();
3059
3059
  });
3060
- return h(this, B, new c().zero()), h(this, S, new c().zero()), h(this, U, new c().zero()), h(this, re, new x()), h(this, Y, new x()), h(this, Ie, new x()), h(this, $e, !0), e.length > 0 && this.parse(...e), this;
3060
+ return h(this, B, new c().zero()), h(this, S, new c().zero()), h(this, U, new c().zero()), h(this, re, new x()), h(this, Q, new x()), h(this, Ie, new x()), h(this, $e, !0), e.length > 0 && this.parse(...e), this;
3061
3061
  }
3062
3062
  get a() {
3063
3063
  return i(this, B);
@@ -3086,10 +3086,10 @@ const De = class De {
3086
3086
  h(this, re, e);
3087
3087
  }
3088
3088
  get d() {
3089
- return i(this, Y);
3089
+ return i(this, Q);
3090
3090
  }
3091
3091
  set d(e) {
3092
- h(this, Y, e);
3092
+ h(this, Q, e);
3093
3093
  }
3094
3094
  get n() {
3095
3095
  return i(this, Ie);
@@ -3136,10 +3136,10 @@ const De = class De {
3136
3136
  return this.slope.isInfinity() ? "x=" + this.OA.x.tex : "y=" + new O().parse("x", this.slope, this.height).tex;
3137
3137
  case "parametric":
3138
3138
  case "system": {
3139
- const t = i(this, Y).clone();
3139
+ const t = i(this, Q).clone();
3140
3140
  return i(this, $e) && t.simplify(), e === "parametric" ? `${x.asTex("x", "y")} = ${x.asTex(i(this, re).x.tex, i(this, re).y.tex)} + k\\cdot ${x.asTex(t.x.tex, t.y.tex)}` : `\\left\\{\\begin{aligned}
3141
- x &= ${new O(i(this, re).x).add(new k(i(this, Y).x).multiply(new k("k"))).reorder("k", !0).tex}\\\\
3142
- y &= ${new O(i(this, re).y).add(new k(i(this, Y).y).multiply(new k("k"))).reorder("k", !0).tex}
3141
+ x &= ${new O(i(this, re).x).add(new k(i(this, Q).x).multiply(new k("k"))).reorder("k", !0).tex}\\\\
3142
+ y &= ${new O(i(this, re).y).add(new k(i(this, Q).y).multiply(new k("k"))).reorder("k", !0).tex}
3143
3143
  \\end{aligned}\\right.`;
3144
3144
  }
3145
3145
  default: {
@@ -3162,7 +3162,7 @@ const De = class De {
3162
3162
  case "mxh":
3163
3163
  return this.slope.isInfinity() ? "x=" + this.OA.x.display : "y=" + new O().parse("x", this.slope, this.height).display;
3164
3164
  case "parametric": {
3165
- const t = i(this, Y).clone();
3165
+ const t = i(this, Q).clone();
3166
3166
  return i(this, $e) && t.simplify(), `((x,y))=((${i(this, re).x.display},${i(this, re).y.display}))+k((${t.x.display},${t.y.display}))`;
3167
3167
  }
3168
3168
  default: {
@@ -3175,7 +3175,7 @@ const De = class De {
3175
3175
  return new x(i(this, B), i(this, S));
3176
3176
  }
3177
3177
  get director() {
3178
- return i(this, Y).clone();
3178
+ return i(this, Q).clone();
3179
3179
  }
3180
3180
  get slope() {
3181
3181
  return i(this, B).clone().opposite().divide(i(this, S));
@@ -3220,7 +3220,7 @@ const De = class De {
3220
3220
  return i(this, B).isZero() || (i(this, B).isOne() ? t = "x" : i(this, B).clone().opposite().isOne() ? t = "-x" : t = i(this, B).value.toFixed(e) + "x"), i(this, S).isZero() || (i(this, S).isPositive() && (t += "+"), t += i(this, S).value.toFixed(e) + "y"), i(this, U).isZero() || (i(this, U).isPositive() && (t += "+"), t += i(this, U).value.toFixed(e)), t + "=0";
3221
3221
  }
3222
3222
  };
3223
- $e = new WeakMap(), B = new WeakMap(), S = new WeakMap(), U = new WeakMap(), re = new WeakMap(), Y = new WeakMap(), Ie = new WeakMap(), ve = new WeakMap(), // A line is defined as the canonical form
3223
+ $e = new WeakMap(), B = new WeakMap(), S = new WeakMap(), U = new WeakMap(), re = new WeakMap(), Q = new WeakMap(), Ie = new WeakMap(), ve = new WeakMap(), // A line is defined as the canonical form
3224
3224
  a(De, "PERPENDICULAR", "perpendicular"), a(De, "PARALLEL", "parallel");
3225
3225
  let D = De;
3226
3226
  var oe, F, Ae, Lt, Dt, Vt, he, Ei, yt, Ni, Ti, Ai, ei;
@@ -3358,12 +3358,12 @@ oe = new WeakMap(), F = new WeakMap(), Ae = new WeakMap(), Lt = new WeakMap(), D
3358
3358
  return this;
3359
3359
  };
3360
3360
  let vt = Zt;
3361
- var Q, _, ee, et, Oe, ut, Ft, ft, Pe, jt, tt;
3361
+ var X, K, J, et, Oe, ut, Ft, ft, Pe, jt, tt;
3362
3362
  const Ut = class Ut {
3363
3363
  constructor(...e) {
3364
- d(this, Q);
3365
- d(this, _);
3366
- d(this, ee);
3364
+ d(this, X);
3365
+ d(this, K);
3366
+ d(this, J);
3367
3367
  d(this, et);
3368
3368
  d(this, Oe);
3369
3369
  d(this, ut);
@@ -3397,21 +3397,21 @@ const Ut = class Ut {
3397
3397
  h(this, et, { AB: t, BC: s, AC: n });
3398
3398
  let r = t.intersection(s);
3399
3399
  if (r.hasIntersection)
3400
- h(this, _, r.point.clone());
3400
+ h(this, K, r.point.clone());
3401
3401
  else
3402
3402
  throw new Error("Lines do not intersect !");
3403
3403
  if (r = s.intersection(n), r.hasIntersection)
3404
- h(this, ee, r.point.clone());
3404
+ h(this, J, r.point.clone());
3405
3405
  else
3406
3406
  throw new Error("Lines do not intersect !");
3407
3407
  if (r = n.intersection(t), r.hasIntersection)
3408
- h(this, Q, r.point.clone());
3408
+ h(this, X, r.point.clone());
3409
3409
  else
3410
3410
  throw new Error("Lines do not intersect !");
3411
- } else e.every((t) => t instanceof j) && (h(this, Q, e[0].clone()), h(this, _, e[1].clone()), h(this, ee, e[2].clone()), h(this, et, {
3412
- AB: new D(i(this, Q), i(this, _)),
3413
- BC: new D(i(this, _), i(this, ee)),
3414
- AC: new D(i(this, Q), i(this, ee))
3411
+ } else e.every((t) => t instanceof j) && (h(this, X, e[0].clone()), h(this, K, e[1].clone()), h(this, J, e[2].clone()), h(this, et, {
3412
+ AB: new D(i(this, X), i(this, K)),
3413
+ BC: new D(i(this, K), i(this, J)),
3414
+ AC: new D(i(this, X), i(this, J))
3415
3415
  }));
3416
3416
  } else if (e.length === 1 && e[0] instanceof Ut)
3417
3417
  return e[0].clone();
@@ -3421,9 +3421,9 @@ const Ut = class Ut {
3421
3421
  * Clone the Triangle class
3422
3422
  */
3423
3423
  a(this, "clone", () => new Ut(
3424
- i(this, Q).clone(),
3425
- i(this, _).clone(),
3426
- i(this, ee).clone()
3424
+ i(this, X).clone(),
3425
+ i(this, K).clone(),
3426
+ i(this, J).clone()
3427
3427
  ));
3428
3428
  // ------------------------------------------
3429
3429
  // Triangle operations and properties
@@ -3432,10 +3432,10 @@ const Ut = class Ut {
3432
3432
  * Generate the Line object for the three segments of the triangle
3433
3433
  */
3434
3434
  d(this, Ft, () => {
3435
- h(this, Oe, {
3436
- AB: new j().middleOf(i(this, Q), i(this, _)),
3437
- AC: new j().middleOf(i(this, Q), i(this, ee)),
3438
- BC: new j().middleOf(i(this, _), i(this, ee))
3435
+ i(this, X).asPoint = !0, i(this, K).asPoint = !0, i(this, J).asPoint = !0, h(this, Oe, {
3436
+ AB: new j().middleOf(i(this, X), i(this, K)),
3437
+ AC: new j().middleOf(i(this, X), i(this, J)),
3438
+ BC: new j().middleOf(i(this, K), i(this, J))
3439
3439
  }), h(this, ut, i(this, jt).call(this));
3440
3440
  });
3441
3441
  /**
@@ -3445,13 +3445,13 @@ const Ut = class Ut {
3445
3445
  d(this, ft, (e) => {
3446
3446
  switch (e.toUpperCase()) {
3447
3447
  case "A":
3448
- return i(this, Q);
3448
+ return i(this, X);
3449
3449
  case "B":
3450
- return i(this, _);
3450
+ return i(this, K);
3451
3451
  case "C":
3452
- return i(this, ee);
3452
+ return i(this, J);
3453
3453
  }
3454
- return i(this, Q);
3454
+ return i(this, X);
3455
3455
  });
3456
3456
  /**
3457
3457
  * Get the vector for the segment given by name.
@@ -3464,19 +3464,19 @@ const Ut = class Ut {
3464
3464
  ));
3465
3465
  d(this, jt, () => {
3466
3466
  const e = {
3467
- A: new D().fromPoints(i(this, Q), i(this, Oe).BC),
3468
- B: new D().fromPoints(i(this, _), i(this, Oe).AC),
3469
- C: new D().fromPoints(i(this, ee), i(this, Oe).AB),
3467
+ A: new D().fromPoints(i(this, X), i(this, Oe).BC),
3468
+ B: new D().fromPoints(i(this, K), i(this, Oe).AC),
3469
+ C: new D().fromPoints(i(this, J), i(this, Oe).AB),
3470
3470
  intersection: null
3471
3471
  }, t = {
3472
- AB: new D().fromPointAndNormal(i(this, Oe).AB, new x(i(this, Q), i(this, _)).normal()),
3473
- AC: new D().fromPointAndNormal(i(this, Oe).AC, new x(i(this, Q), i(this, ee)).normal()),
3474
- BC: new D().fromPointAndNormal(i(this, Oe).BC, new x(i(this, _), i(this, ee)).normal()),
3472
+ AB: new D().fromPointAndNormal(i(this, Oe).AB, new x(i(this, X), i(this, K)).normal()),
3473
+ AC: new D().fromPointAndNormal(i(this, Oe).AC, new x(i(this, X), i(this, J)).normal()),
3474
+ BC: new D().fromPointAndNormal(i(this, Oe).BC, new x(i(this, K), i(this, J)).normal()),
3475
3475
  intersection: null
3476
3476
  }, s = {
3477
- A: new D().fromPointAndNormal(i(this, Q), new x(i(this, _), i(this, ee)).normal()),
3478
- B: new D().fromPointAndNormal(i(this, _), new x(i(this, Q), i(this, ee)).normal()),
3479
- C: new D().fromPointAndNormal(i(this, ee), new x(i(this, Q), i(this, _)).normal()),
3477
+ A: new D().fromPointAndNormal(i(this, X), new x(i(this, K), i(this, J)).normal()),
3478
+ B: new D().fromPointAndNormal(i(this, K), new x(i(this, X), i(this, J)).normal()),
3479
+ C: new D().fromPointAndNormal(i(this, J), new x(i(this, X), i(this, K)).normal()),
3480
3480
  intersection: null
3481
3481
  }, n = i(this, tt).call(this, "A"), r = i(this, tt).call(this, "B"), l = i(this, tt).call(this, "C"), u = {
3482
3482
  A: n.internal,
@@ -3511,13 +3511,13 @@ const Ut = class Ut {
3511
3511
  // Getter and setters
3512
3512
  // ------------------------------------------
3513
3513
  get A() {
3514
- return i(this, Q);
3514
+ return i(this, X);
3515
3515
  }
3516
3516
  get B() {
3517
- return i(this, _);
3517
+ return i(this, K);
3518
3518
  }
3519
3519
  get C() {
3520
- return i(this, ee);
3520
+ return i(this, J);
3521
3521
  }
3522
3522
  get AB() {
3523
3523
  return i(this, Pe).call(this, "A", "B");
@@ -3553,7 +3553,7 @@ const Ut = class Ut {
3553
3553
  return i(this, ut);
3554
3554
  }
3555
3555
  };
3556
- Q = new WeakMap(), _ = new WeakMap(), ee = new WeakMap(), et = new WeakMap(), Oe = new WeakMap(), ut = new WeakMap(), Ft = new WeakMap(), ft = new WeakMap(), Pe = new WeakMap(), jt = new WeakMap(), tt = new WeakMap();
3556
+ X = new WeakMap(), K = new WeakMap(), J = new WeakMap(), et = new WeakMap(), Oe = new WeakMap(), ut = new WeakMap(), Ft = new WeakMap(), ft = new WeakMap(), Pe = new WeakMap(), jt = new WeakMap(), tt = new WeakMap();
3557
3557
  let ti = Ut;
3558
3558
  var R, W;
3559
3559
  const ot = class ot {
@@ -3601,7 +3601,7 @@ const ot = class ot {
3601
3601
  // return new Fraction().invalid()
3602
3602
  // }
3603
3603
  a(this, "randomPoint", (e = 5) => {
3604
- const t = i(this, R).clone(), s = new c(X(e, !1));
3604
+ const t = i(this, R).clone(), s = new c(Y(e, !1));
3605
3605
  return new j(
3606
3606
  t.x.clone().add(i(this, W).x.clone().multiply(s)),
3607
3607
  t.y.clone().add(i(this, W).y.clone().multiply(s)),
@@ -3794,7 +3794,7 @@ function xt(o) {
3794
3794
  },
3795
3795
  o
3796
3796
  ), t = new c();
3797
- if (e.negative ? t.numerator = X(e.max, e.zero) : t.numerator = de(e.zero ? 0 : 1, e.max), e.natural)
3797
+ if (e.negative ? t.numerator = Y(e.max, e.zero) : t.numerator = de(e.zero ? 0 : 1, e.max), e.natural)
3798
3798
  t.denominator = 1;
3799
3799
  else {
3800
3800
  let s = 0;
@@ -3901,7 +3901,7 @@ function Mi(o) {
3901
3901
  quadrant: null
3902
3902
  },
3903
3903
  o
3904
- ), t = e.axis === "x", s = e.axis === "y", n = e.fraction ? xt({ max: e.max, zero: t }) : new c(X(e.max, t)), r = e.fraction ? xt({ max: e.max, zero: s }) : new c(X(e.max, s));
3904
+ ), t = e.axis === "x", s = e.axis === "y", n = e.fraction ? xt({ max: e.max, zero: t }) : new c(Y(e.max, t)), r = e.fraction ? xt({ max: e.max, zero: s }) : new c(Y(e.max, s));
3905
3905
  return Number(e.quadrant) === 1 && (n.abs(), r.abs()), Number(e.quadrant) === 2 && (n.isPositive() && n.opposite(), r.isNegative() && r.opposite()), Number(e.quadrant) === 3 && (n.isPositive() && n.opposite(), r.isPositive() && r.opposite()), Number(e.quadrant) === 4 && (n.isNegative() && n.opposite(), r.isPositive() && r.opposite()), new j(n, r);
3906
3906
  }
3907
3907
  function ss(o) {
@@ -3922,31 +3922,31 @@ function ns(o) {
3922
3922
  const e = Object.assign(
3923
3923
  {
3924
3924
  A: {
3925
- x: X(10),
3926
- y: X(10)
3925
+ x: Y(10),
3926
+ y: Y(10)
3927
3927
  }
3928
3928
  },
3929
3929
  o
3930
3930
  ), t = new x(
3931
- X(10),
3932
- X(10)
3931
+ Y(10),
3932
+ Y(10)
3933
3933
  );
3934
3934
  for (; t.isNull; )
3935
- t.x = X(10), t.y = X(10);
3935
+ t.x = Y(10), t.y = Y(10);
3936
3936
  return e.slope === 1 ? t.x.sign() !== t.y.sign() && t.y.opposite() : e.slope === -1 && t.x.sign() !== t.y.sign() && t.y.opposite(), new D(new x(e.A.x, e.A.y), t);
3937
3937
  }
3938
3938
  function rs(o) {
3939
3939
  const e = Object.assign(
3940
3940
  {
3941
3941
  A: {
3942
- x: X(10),
3943
- y: X(10),
3944
- z: X(10)
3942
+ x: Y(10),
3943
+ y: Y(10),
3944
+ z: Y(10)
3945
3945
  },
3946
3946
  direction: {
3947
- x: X(10),
3948
- y: X(10),
3949
- z: X(10)
3947
+ x: Y(10),
3948
+ y: Y(10),
3949
+ z: Y(10)
3950
3950
  }
3951
3951
  },
3952
3952
  o
@@ -3959,7 +3959,7 @@ const os = {
3959
3959
  monom: (o) => Oi(o),
3960
3960
  fraction: (o) => xt(o),
3961
3961
  number: (o, e, t) => de(o, e, t),
3962
- numberSym: (o, e) => X(o, e),
3962
+ numberSym: (o, e) => Y(o, e),
3963
3963
  prime: (o) => Ji(o),
3964
3964
  bool: (o) => vi(o),
3965
3965
  array: (o, e) => _i(o, e),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pimath",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "A math library for teacher :)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,5 +1,6 @@
1
1
  import { Line } from './line';
2
2
  import { Vector } from './vector';
3
+ import { Point } from './point';
3
4
 
4
5
  export interface remarquableLines {
5
6
  'medians': {
@@ -36,9 +37,9 @@ export interface remarquableLines {
36
37
  export declare class Triangle {
37
38
  #private;
38
39
  constructor(...values: unknown[]);
39
- get A(): Vector;
40
- get B(): Vector;
41
- get C(): Vector;
40
+ get A(): Point;
41
+ get B(): Point;
42
+ get C(): Point;
42
43
  get AB(): Vector;
43
44
  get BA(): Vector;
44
45
  get BC(): Vector;
@@ -1 +1 @@
1
- {"version":3,"file":"triangle.d.ts","sourceRoot":"","sources":["../../src/geometry/triangle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGjC,MAAM,WAAW,gBAAgB;IAC7B,SAAS,EAAE;QACP,GAAG,EAAE,IAAI,CAAC;QACV,GAAG,EAAE,IAAI,CAAC;QACV,GAAG,EAAE,IAAI,CAAC;QACV,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;KAChC,CAAC;IACF,WAAW,EAAE;QACT,IAAI,EAAE,IAAI,CAAC;QACX,IAAI,EAAE,IAAI,CAAC;QACX,IAAI,EAAE,IAAI,CAAC;QACX,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;KAChC,CAAC;IACF,SAAS,EAAE;QACP,GAAG,EAAE,IAAI,CAAC;QACV,GAAG,EAAE,IAAI,CAAC;QACV,GAAG,EAAE,IAAI,CAAC;QACV,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;KAChC,CAAC;IACF,WAAW,EAAE;QACT,GAAG,EAAE,IAAI,CAAC;QACV,GAAG,EAAE,IAAI,CAAC;QACV,GAAG,EAAE,IAAI,CAAC;QACV,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;KAChC,CAAC;IACF,iBAAiB,EAAE;QACf,GAAG,EAAE,IAAI,CAAC;QACV,GAAG,EAAE,IAAI,CAAC;QACV,GAAG,EAAE,IAAI,CAAC;QACV,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;KAChC,CAAA;CACJ;AAED,qBAAa,QAAQ;;gBAQL,GAAG,MAAM,EAAE,OAAO,EAAE;IAYhC,IAAI,CAAC,IAAI,MAAM,CAEd;IAED,IAAI,CAAC,IAAI,M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