@mlightcad/data-model 1.1.5 → 1.1.6

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.
@@ -9211,28 +9211,29 @@ class ut {
9211
9211
  }
9212
9212
  }
9213
9213
  class Ut extends Ee {
9214
- constructor(t, e, s, n) {
9214
+ constructor(t, e, s, n, i) {
9215
9215
  super();
9216
- const i = +(t !== void 0) + +(e !== void 0) + +(s !== void 0) + +(n !== void 0);
9217
- if (i < 2 || i > 4)
9216
+ const a = arguments.length;
9217
+ if (a < 2 || a > 5)
9218
9218
  throw ot.ILLEGAL_PARAMETERS;
9219
- const a = 3;
9220
- if (this._closed = n || !1, Array.isArray(e)) {
9221
- if (this._controlPoints = t, i >= 4 && (this._closed = n), this._controlPoints.length < 4)
9219
+ if (this._degree = 3, this._closed = !1, Array.isArray(e)) {
9220
+ this._controlPoints = t;
9221
+ let o, c = 3, l = !1;
9222
+ if (a >= 3 && (Array.isArray(s) ? (o = s, a >= 4 && (c = n || 3), a >= 5 && (l = i)) : s !== void 0 && (c = s || 3, a >= 4 && (l = n))), s === void 0 && a >= 4 && (c = n || 3, a >= 5 && (l = i)), this._degree = c, this._closed = l, this._controlPoints.length < this._degree + 1)
9222
9223
  throw ot.ILLEGAL_PARAMETERS;
9223
9224
  this._nurbsCurve = ut.byKnotsControlPointsWeights(
9224
- a,
9225
+ this._degree,
9225
9226
  e,
9226
9227
  this._controlPoints,
9227
- s
9228
+ o
9228
9229
  );
9229
9230
  } else {
9230
- if (this._fitPoints = t, this._knotParameterization = e, i >= 3 && (this._closed = s), this._fitPoints.length < 4)
9231
+ if (this._fitPoints = t, this._knotParameterization = e, a >= 3 && (this._degree = s || 3), a >= 4 && (this._closed = n), this._fitPoints.length < this._degree + 1)
9231
9232
  throw ot.ILLEGAL_PARAMETERS;
9232
9233
  const o = this.toNurbsPoints(this._fitPoints);
9233
9234
  this._nurbsCurve = ut.byPoints(
9234
9235
  o,
9235
- a,
9236
+ this._degree,
9236
9237
  this._knotParameterization
9237
9238
  ), this._controlPoints = this._nurbsCurve.controlPoints();
9238
9239
  }
@@ -9246,14 +9247,14 @@ class Ut extends Ee {
9246
9247
  if (this._closed)
9247
9248
  this._nurbsCurve = ut.createClosedCurve(
9248
9249
  this._fitPoints,
9249
- 3,
9250
+ this._degree,
9250
9251
  this._knotParameterization
9251
9252
  );
9252
9253
  else {
9253
9254
  const t = this.toNurbsPoints(this._fitPoints);
9254
9255
  this._nurbsCurve = ut.byPoints(
9255
9256
  t,
9256
- 3,
9257
+ this._degree,
9257
9258
  this._knotParameterization
9258
9259
  );
9259
9260
  }
@@ -9263,13 +9264,13 @@ class Ut extends Ee {
9263
9264
  const t = this._knotParameterization || "Chord";
9264
9265
  this._nurbsCurve = ut.createClosedCurve(
9265
9266
  this._controlPoints,
9266
- 3,
9267
+ this._degree,
9267
9268
  t
9268
9269
  ), this._controlPoints = this._nurbsCurve.controlPoints();
9269
9270
  } else {
9270
9271
  const t = this._nurbsCurve.knots(), e = this._nurbsCurve.weights();
9271
9272
  this._nurbsCurve = ut.byKnotsControlPointsWeights(
9272
- 3,
9273
+ this._degree,
9273
9274
  t,
9274
9275
  this._controlPoints,
9275
9276
  e
@@ -9286,7 +9287,7 @@ class Ut extends Ee {
9286
9287
  * Degree of the spline to be created.
9287
9288
  */
9288
9289
  get degree() {
9289
- return this._nurbsCurve.degree();
9290
+ return this._degree;
9290
9291
  }
9291
9292
  get knotParameterization() {
9292
9293
  return this._knotParameterization;
@@ -9391,12 +9392,13 @@ class Ut extends Ee {
9391
9392
  * Create a closed spline from fit points using AcGeNurbsCurve.createClosedCurve
9392
9393
  * @param fitPoints - Array of fit points defining the curve
9393
9394
  * @param parameterization - Knot parameterization type for NURBS
9395
+ * @param degree - Optional degree of the spline (default: 3)
9394
9396
  * @returns A closed spline
9395
9397
  */
9396
- static createClosedSpline(t, e = "Uniform") {
9397
- if (t.length < 4)
9398
- throw new Error("At least 4 points are required for a closed spline");
9399
- return new Ut(t, e, !0);
9398
+ static createClosedSpline(t, e = "Uniform", s = 3) {
9399
+ if (t.length < s + 1)
9400
+ throw new Error(`At least ${s + 1} points are required for a degree ${s} closed spline`);
9401
+ return new Ut(t, e, s, !0);
9400
9402
  }
9401
9403
  }
9402
9404
  var Vt = 256, Pn = [], Js = 256, Fe;
@@ -11774,20 +11776,22 @@ class oo extends Tt {
11774
11776
  }
11775
11777
  }
11776
11778
  class tr extends mt {
11777
- constructor(t, e, s, n) {
11779
+ constructor(t, e, s, n, i) {
11778
11780
  super();
11779
- const i = +(t !== void 0) + +(e !== void 0) + +(s !== void 0) + +(n !== void 0);
11780
- if (i < 2 || i > 4)
11781
+ const a = +(t !== void 0) + +(e !== void 0) + +(s !== void 0) + +(n !== void 0) + +(i !== void 0);
11782
+ if (a < 2 || a > 5)
11781
11783
  throw ot.ILLEGAL_PARAMETERS;
11782
- i <= 3 && !Array.isArray(e) ? this._geo = new Ut(
11784
+ !Array.isArray(e) ? this._geo = new Ut(
11783
11785
  t,
11784
11786
  e,
11785
- s
11787
+ s,
11788
+ n
11786
11789
  ) : this._geo = new Ut(
11787
11790
  t,
11788
11791
  e,
11789
11792
  s,
11790
- n
11793
+ n,
11794
+ i
11791
11795
  );
11792
11796
  }
11793
11797
  /**
@@ -15155,6 +15159,7 @@ class rr {
15155
15159
  t.controlPoints,
15156
15160
  t.knots,
15157
15161
  t.weights,
15162
+ t.degree,
15158
15163
  !!(t.flag & 1)
15159
15164
  );
15160
15165
  if (t.numberOfFitPoints > 0) {
@@ -15163,7 +15168,7 @@ class rr {
15163
15168
  t.numberOfFitPoints
15164
15169
  );
15165
15170
  if (e != null)
15166
- return new tr(e, "Uniform", !!(t.flag & 1));
15171
+ return new tr(e, "Uniform", t.degree, !!(t.flag & 1));
15167
15172
  }
15168
15173
  return null;
15169
15174
  }