angular-three-soba 1.4.0 → 1.5.0

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.
@@ -1,13 +1,13 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, CUSTOM_ELEMENTS_SCHEMA, Input, InjectionToken, inject, Directive, EventEmitter, TemplateRef, Output, ContentChild } from '@angular/core';
3
- import { extend, NgtRxStore, injectNgtRef, NgtStore, NgtPortal, NgtPortalContent, NgtArgs, NgtRepeat, startWithUndefined, NgtPush } from 'angular-three';
2
+ import { Component, CUSTOM_ELEMENTS_SCHEMA, Input, Directive, inject, InjectionToken, EventEmitter, TemplateRef, Output, ContentChild } from '@angular/core';
3
+ import { extend, NgtRxStore, injectNgtRef, NgtStore, startWithUndefined, NgtArgs, NgtPortal, NgtPortalContent, NgtRepeat, NgtPush } from 'angular-three';
4
4
  import * as THREE from 'three';
5
- import { Group, Vector3, Quaternion, Object3D, Matrix4, Mesh, BoxGeometry, MeshBasicMaterial, MeshLambertMaterial, CanvasTexture, AmbientLight, PointLight, Sprite, SpriteMaterial } from 'three';
6
- import { NgTemplateOutlet, DOCUMENT, NgFor, NgIf } from '@angular/common';
5
+ import { Group, CatmullRomCurve3, Vector3, Quaternion, Object3D, Matrix4, Mesh, BoxGeometry, MeshBasicMaterial, MeshLambertMaterial, CanvasTexture, AmbientLight, PointLight, Sprite, SpriteMaterial } from 'three';
6
+ import { combineLatest, map, switchMap, of } from 'rxjs';
7
+ import { LineMaterial, LineSegmentsGeometry, LineGeometry, LineSegments2, Line2, TextGeometry, FontLoader } from 'three-stdlib';
8
+ import { NgIf, NgTemplateOutlet, DOCUMENT, NgFor } from '@angular/common';
7
9
  import { selectSlice } from '@rx-angular/state';
8
10
  import { NgtsOrthographicCamera } from 'angular-three-soba/cameras';
9
- import { combineLatest, map, switchMap, of } from 'rxjs';
10
- import { TextGeometry, FontLoader } from 'three-stdlib';
11
11
  import { RxActionFactory } from '@rx-angular/state/actions';
12
12
  import { Text, preloadFont } from 'troika-three-text';
13
13
 
@@ -80,6 +80,420 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
80
80
  type: Input
81
81
  }] } });
82
82
 
83
+ class NgtsLineInput extends NgtRxStore {
84
+ set vertexColors(vertexColors) {
85
+ this.set({ vertexColors });
86
+ }
87
+ set lineWidth(lineWidth) {
88
+ this.set({ lineWidth });
89
+ }
90
+ set alphaToCoverage(alphaToCoverage) {
91
+ this.set({ alphaToCoverage });
92
+ }
93
+ set color(color) {
94
+ this.set({ color });
95
+ }
96
+ set dashed(dashed) {
97
+ this.set({ dashed });
98
+ }
99
+ set dashScale(dashScale) {
100
+ this.set({ dashScale });
101
+ }
102
+ set dashSize(dashSize) {
103
+ this.set({ dashSize });
104
+ }
105
+ set dashOffset(dashOffset) {
106
+ this.set({ dashOffset });
107
+ }
108
+ set gapSize(gapSize) {
109
+ this.set({ gapSize });
110
+ }
111
+ set resolution(resolution) {
112
+ this.set({ resolution });
113
+ }
114
+ set wireframe(wireframe) {
115
+ this.set({ wireframe });
116
+ }
117
+ set worldUnits(worldUnits) {
118
+ this.set({ worldUnits });
119
+ }
120
+ initialize() {
121
+ super.initialize();
122
+ this.set({ color: 'black' });
123
+ }
124
+ }
125
+ NgtsLineInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsLineInput, deps: null, target: i0.ɵɵFactoryTarget.Directive });
126
+ NgtsLineInput.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.3", type: NgtsLineInput, inputs: { vertexColors: "vertexColors", lineWidth: "lineWidth", alphaToCoverage: "alphaToCoverage", color: "color", dashed: "dashed", dashScale: "dashScale", dashSize: "dashSize", dashOffset: "dashOffset", gapSize: "gapSize", resolution: "resolution", wireframe: "wireframe", worldUnits: "worldUnits" }, usesInheritance: true, ngImport: i0 });
127
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsLineInput, decorators: [{
128
+ type: Directive
129
+ }], propDecorators: { vertexColors: [{
130
+ type: Input
131
+ }], lineWidth: [{
132
+ type: Input
133
+ }], alphaToCoverage: [{
134
+ type: Input
135
+ }], color: [{
136
+ type: Input
137
+ }], dashed: [{
138
+ type: Input
139
+ }], dashScale: [{
140
+ type: Input
141
+ }], dashSize: [{
142
+ type: Input
143
+ }], dashOffset: [{
144
+ type: Input
145
+ }], gapSize: [{
146
+ type: Input
147
+ }], resolution: [{
148
+ type: Input
149
+ }], wireframe: [{
150
+ type: Input
151
+ }], worldUnits: [{
152
+ type: Input
153
+ }] } });
154
+
155
+ class NgtsLine extends NgtsLineInput {
156
+ constructor() {
157
+ super(...arguments);
158
+ this.Boolean = Boolean;
159
+ this.lineMaterial = new LineMaterial();
160
+ this.store = inject(NgtStore);
161
+ this.lineRef = injectNgtRef();
162
+ }
163
+ set points(points) {
164
+ this.set({ points });
165
+ }
166
+ set segments(segments) {
167
+ this.set({ segments });
168
+ }
169
+ // TODO: Figure out if this is the case for everything else.
170
+ // We'd want to run computeLineDistances on the Line2 on "points" changed
171
+ // Consequently,when "points" changes, LineGeometry also changes and that causes
172
+ // the Renderer to replace the LineGeometry on the Line2, which is what's happening.
173
+ // But the effect that runs line.computeLineDistances() runs a little BEFORE the new lineGeometry
174
+ // has been attached. So it doesn't work with the props changed from the Material
175
+ //
176
+ // Alternatively, we can also run the effect on line#children changes.
177
+ onAfterGeometryAttached({ parent }) {
178
+ // parent.computeLineDistances();
179
+ }
180
+ initialize() {
181
+ super.initialize();
182
+ this.set({ segments: false });
183
+ this.connect('lineGeometry', combineLatest([
184
+ this.select('points'),
185
+ this.select('segments'),
186
+ this.select('vertexColors').pipe(startWithUndefined()),
187
+ ]).pipe(map(([points, segments, vertexColors]) => {
188
+ const geometry = segments ? new LineSegmentsGeometry() : new LineGeometry();
189
+ const pValues = points.map((p) => {
190
+ const isArray = Array.isArray(p);
191
+ return p instanceof THREE.Vector3
192
+ ? [p.x, p.y, p.z]
193
+ : p instanceof THREE.Vector2
194
+ ? [p.x, p.y, 0]
195
+ : isArray && p.length === 3
196
+ ? [p[0], p[1], p[2]]
197
+ : isArray && p.length === 2
198
+ ? [p[0], p[1], 0]
199
+ : p;
200
+ });
201
+ geometry.setPositions(pValues.flat());
202
+ if (vertexColors) {
203
+ const cValues = vertexColors.map((c) => c instanceof THREE.Color ? c.toArray() : c);
204
+ geometry.setColors(cValues.flat());
205
+ }
206
+ return geometry;
207
+ })));
208
+ }
209
+ ngOnInit() {
210
+ this.connect('materialResolution', combineLatest([this.store.select('size'), this.select('resolution').pipe(startWithUndefined())]).pipe(map(([size, resolution]) => resolution !== null && resolution !== void 0 ? resolution : [size.width, size.height])));
211
+ if (!this.lineRef.nativeElement) {
212
+ this.lineRef.nativeElement = this.get('segments') ? new LineSegments2() : new Line2();
213
+ }
214
+ this.computeLineDistances();
215
+ this.disposeGeometry();
216
+ }
217
+ computeLineDistances() {
218
+ this.hold(combineLatest([this.lineRef.$, this.lineRef.children$('nonObjects'), this.select('points')]), ([line]) => {
219
+ line.computeLineDistances();
220
+ });
221
+ }
222
+ disposeGeometry() {
223
+ this.effect(this.select('lineGeometry'), (lineGeometry) => {
224
+ return () => lineGeometry.dispose();
225
+ });
226
+ }
227
+ }
228
+ NgtsLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
229
+ NgtsLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsLine, isStandalone: true, selector: "ngts-line[points]", inputs: { lineRef: "lineRef", points: "points", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
230
+ <ngt-primitive *args="[lineRef.nativeElement]" [ref]="lineRef" ngtCompound>
231
+ <ngt-primitive
232
+ *args="[get('lineGeometry')]"
233
+ attach="geometry"
234
+ (afterAttach)="onAfterGeometryAttached($any($event))"
235
+ />
236
+ <ngt-primitive
237
+ *args="[lineMaterial]"
238
+ attach="material"
239
+ [color]="get('color')"
240
+ [vertexColors]="Boolean(get('vertexColors'))"
241
+ [resolution]="get('materialResolution')"
242
+ [linewidth]="get('lineWidth')"
243
+ [alphaToCoverage]="get('alphaToCoverage')"
244
+ [dashed]="get('dashed')"
245
+ [dashScale]="get('dashScale') ?? lineMaterial.dashScale"
246
+ [dashSize]="get('dashSize') ?? lineMaterial.dashSize"
247
+ [dashOffset]="get('dashOffset') ?? lineMaterial.dashOffset"
248
+ [gapSize]="get('gapSize') ?? lineMaterial.gapSize"
249
+ [wireframe]="get('wireframe') ?? lineMaterial.wireframe"
250
+ [worldUnits]="get('worldUnits')"
251
+ />
252
+ </ngt-primitive>
253
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
254
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsLine, decorators: [{
255
+ type: Component,
256
+ args: [{
257
+ selector: 'ngts-line[points]',
258
+ standalone: true,
259
+ template: `
260
+ <ngt-primitive *args="[lineRef.nativeElement]" [ref]="lineRef" ngtCompound>
261
+ <ngt-primitive
262
+ *args="[get('lineGeometry')]"
263
+ attach="geometry"
264
+ (afterAttach)="onAfterGeometryAttached($any($event))"
265
+ />
266
+ <ngt-primitive
267
+ *args="[lineMaterial]"
268
+ attach="material"
269
+ [color]="get('color')"
270
+ [vertexColors]="Boolean(get('vertexColors'))"
271
+ [resolution]="get('materialResolution')"
272
+ [linewidth]="get('lineWidth')"
273
+ [alphaToCoverage]="get('alphaToCoverage')"
274
+ [dashed]="get('dashed')"
275
+ [dashScale]="get('dashScale') ?? lineMaterial.dashScale"
276
+ [dashSize]="get('dashSize') ?? lineMaterial.dashSize"
277
+ [dashOffset]="get('dashOffset') ?? lineMaterial.dashOffset"
278
+ [gapSize]="get('gapSize') ?? lineMaterial.gapSize"
279
+ [wireframe]="get('wireframe') ?? lineMaterial.wireframe"
280
+ [worldUnits]="get('worldUnits')"
281
+ />
282
+ </ngt-primitive>
283
+ `,
284
+ imports: [NgtArgs],
285
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
286
+ }]
287
+ }], propDecorators: { lineRef: [{
288
+ type: Input
289
+ }], points: [{
290
+ type: Input
291
+ }], segments: [{
292
+ type: Input
293
+ }] } });
294
+
295
+ class NgtsCatmullRomLine extends NgtsLineInput {
296
+ constructor() {
297
+ super(...arguments);
298
+ this.lineRef = injectNgtRef();
299
+ }
300
+ set points(points) {
301
+ this.set({ points });
302
+ }
303
+ set closed(closed) {
304
+ this.set({ closed });
305
+ }
306
+ set curveType(curveType) {
307
+ this.set({ curveType });
308
+ }
309
+ set tension(tension) {
310
+ this.set({ tension });
311
+ }
312
+ set segments(segments) {
313
+ this.set({ segments });
314
+ }
315
+ initialize() {
316
+ super.initialize();
317
+ this.set({ closed: false, curveType: 'centripetal', tension: 0.5, segments: 64 });
318
+ this.connect('curve', combineLatest([
319
+ this.select('points'),
320
+ this.select('closed'),
321
+ this.select('curveType'),
322
+ this.select('tension'),
323
+ ]).pipe(map(([points, closed, curveType, tension]) => {
324
+ const mappedPoints = points.map((p) => p instanceof THREE.Vector3 ? p : new THREE.Vector3(...p));
325
+ return new CatmullRomCurve3(mappedPoints, closed, curveType, tension);
326
+ })));
327
+ this.connect('segmentedPoints', combineLatest([this.select('curve'), this.select('segments')]).pipe(map(([curve, segments]) => curve.getPoints(segments))));
328
+ this.connect('interpolatedVertexColors', combineLatest([this.select('vertexColors').pipe(startWithUndefined()), this.select('segments')]).pipe(map(([vertexColors, segments]) => {
329
+ if (!vertexColors || vertexColors.length < 2)
330
+ return undefined;
331
+ if (vertexColors.length === segments + 1)
332
+ return vertexColors;
333
+ const mappedColors = vertexColors.map((color) => color instanceof THREE.Color ? color : new THREE.Color(...color));
334
+ if (this.get('closed'))
335
+ mappedColors.push(mappedColors[0].clone());
336
+ const iColors = [mappedColors[0]];
337
+ const divisions = segments / (mappedColors.length - 1);
338
+ for (let i = 0; i < segments; i++) {
339
+ const alpha = (i % divisions) / divisions;
340
+ const colorIndex = Math.floor(i / divisions);
341
+ iColors.push(mappedColors[colorIndex].clone().lerp(mappedColors[colorIndex + 1], alpha));
342
+ }
343
+ iColors.push(mappedColors[mappedColors.length - 1]);
344
+ })));
345
+ }
346
+ }
347
+ NgtsCatmullRomLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsCatmullRomLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
348
+ NgtsCatmullRomLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsCatmullRomLine, isStandalone: true, selector: "ngts-catmull-rom-line[points]", inputs: { lineRef: "lineRef", points: "points", closed: "closed", curveType: "curveType", tension: "tension", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
349
+ <ngts-line
350
+ [lineRef]="lineRef"
351
+ [points]="get('segmentedPoints')"
352
+ [color]="get('color')"
353
+ [vertexColors]="get('interpolatedVertexColors')"
354
+ [resolution]="get('resolution')"
355
+ [lineWidth]="get('lineWidth')"
356
+ [alphaToCoverage]="get('alphaToCoverage')"
357
+ [dashed]="get('dashed')"
358
+ [dashScale]="get('dashScale')"
359
+ [dashOffset]="get('dashOffset')"
360
+ [dashSize]="get('dashSize')"
361
+ [gapSize]="get('gapSize')"
362
+ [wireframe]="get('wireframe')"
363
+ [worldUnits]="get('worldUnits')"
364
+ />
365
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line[points]", inputs: ["lineRef", "points", "segments"] }] });
366
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsCatmullRomLine, decorators: [{
367
+ type: Component,
368
+ args: [{
369
+ selector: 'ngts-catmull-rom-line[points]',
370
+ standalone: true,
371
+ template: `
372
+ <ngts-line
373
+ [lineRef]="lineRef"
374
+ [points]="get('segmentedPoints')"
375
+ [color]="get('color')"
376
+ [vertexColors]="get('interpolatedVertexColors')"
377
+ [resolution]="get('resolution')"
378
+ [lineWidth]="get('lineWidth')"
379
+ [alphaToCoverage]="get('alphaToCoverage')"
380
+ [dashed]="get('dashed')"
381
+ [dashScale]="get('dashScale')"
382
+ [dashOffset]="get('dashOffset')"
383
+ [dashSize]="get('dashSize')"
384
+ [gapSize]="get('gapSize')"
385
+ [wireframe]="get('wireframe')"
386
+ [worldUnits]="get('worldUnits')"
387
+ />
388
+ `,
389
+ imports: [NgtsLine],
390
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
391
+ }]
392
+ }], propDecorators: { lineRef: [{
393
+ type: Input
394
+ }], points: [{
395
+ type: Input
396
+ }], closed: [{
397
+ type: Input
398
+ }], curveType: [{
399
+ type: Input
400
+ }], tension: [{
401
+ type: Input
402
+ }], segments: [{
403
+ type: Input
404
+ }] } });
405
+
406
+ class NgtsCubicBezierLine extends NgtsLineInput {
407
+ constructor() {
408
+ super(...arguments);
409
+ this.lineRef = injectNgtRef();
410
+ }
411
+ set start(start) {
412
+ this.set({ start });
413
+ }
414
+ set end(end) {
415
+ this.set({ end });
416
+ }
417
+ set midA(midA) {
418
+ this.set({ midA });
419
+ }
420
+ set midB(midB) {
421
+ this.set({ midB });
422
+ }
423
+ set segments(segments) {
424
+ this.set({ segments });
425
+ }
426
+ initialize() {
427
+ super.initialize();
428
+ this.set({ segments: 10 });
429
+ this.connect('points', this.select(['start', 'end', 'midA', 'midB', 'segments'], ({ start, end, midA, midB, segments }) => {
430
+ const startV = start instanceof THREE.Vector3 ? start : new THREE.Vector3(...start);
431
+ const endV = end instanceof THREE.Vector3 ? end : new THREE.Vector3(...end);
432
+ const midAV = midA instanceof THREE.Vector3 ? midA : new THREE.Vector3(...midA);
433
+ const midBV = midB instanceof THREE.Vector3 ? midB : new THREE.Vector3(...midB);
434
+ return new THREE.CubicBezierCurve3(startV, midAV, midBV, endV).getPoints(segments);
435
+ }));
436
+ }
437
+ }
438
+ NgtsCubicBezierLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsCubicBezierLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
439
+ NgtsCubicBezierLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsCubicBezierLine, isStandalone: true, selector: "ngts-cubic-bezier-line[start][end][midA][midB]", inputs: { lineRef: "lineRef", start: "start", end: "end", midA: "midA", midB: "midB", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
440
+ <ngts-line
441
+ [lineRef]="lineRef"
442
+ [points]="get('points')"
443
+ [color]="get('color')"
444
+ [vertexColors]="get('vertexColors')"
445
+ [resolution]="get('resolution')"
446
+ [lineWidth]="get('lineWidth')"
447
+ [alphaToCoverage]="get('alphaToCoverage')"
448
+ [dashed]="get('dashed')"
449
+ [dashScale]="get('dashScale')"
450
+ [dashSize]="get('dashSize')"
451
+ [dashOffset]="get('dashOffset')"
452
+ [gapSize]="get('gapSize')"
453
+ [wireframe]="get('wireframe')"
454
+ [worldUnits]="get('worldUnits')"
455
+ />
456
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line[points]", inputs: ["lineRef", "points", "segments"] }] });
457
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsCubicBezierLine, decorators: [{
458
+ type: Component,
459
+ args: [{
460
+ selector: 'ngts-cubic-bezier-line[start][end][midA][midB]',
461
+ standalone: true,
462
+ template: `
463
+ <ngts-line
464
+ [lineRef]="lineRef"
465
+ [points]="get('points')"
466
+ [color]="get('color')"
467
+ [vertexColors]="get('vertexColors')"
468
+ [resolution]="get('resolution')"
469
+ [lineWidth]="get('lineWidth')"
470
+ [alphaToCoverage]="get('alphaToCoverage')"
471
+ [dashed]="get('dashed')"
472
+ [dashScale]="get('dashScale')"
473
+ [dashSize]="get('dashSize')"
474
+ [dashOffset]="get('dashOffset')"
475
+ [gapSize]="get('gapSize')"
476
+ [wireframe]="get('wireframe')"
477
+ [worldUnits]="get('worldUnits')"
478
+ />
479
+ `,
480
+ imports: [NgtsLine, NgIf],
481
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
482
+ }]
483
+ }], propDecorators: { lineRef: [{
484
+ type: Input
485
+ }], start: [{
486
+ type: Input
487
+ }], end: [{
488
+ type: Input
489
+ }], midA: [{
490
+ type: Input
491
+ }], midB: [{
492
+ type: Input
493
+ }], segments: [{
494
+ type: Input
495
+ }] } });
496
+
83
497
  const isOrbitControls = (controls) => {
84
498
  return 'minPolarAngle' in controls;
85
499
  };
@@ -1181,6 +1595,126 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
1181
1595
  type: Output
1182
1596
  }] } });
1183
1597
 
1598
+ const v = new THREE.Vector3();
1599
+ class NgtsQuadraticBezierLine extends NgtsLineInput {
1600
+ constructor() {
1601
+ super(...arguments);
1602
+ this.curve = new THREE.QuadraticBezierCurve3(undefined, undefined, undefined);
1603
+ this.lineRef = injectNgtRef();
1604
+ }
1605
+ set start(start) {
1606
+ this.set({ start });
1607
+ }
1608
+ set end(end) {
1609
+ this.set({ end });
1610
+ }
1611
+ set mid(mid) {
1612
+ this.set({ mid });
1613
+ }
1614
+ set segments(segments) {
1615
+ this.set({ segments });
1616
+ }
1617
+ initialize() {
1618
+ super.initialize();
1619
+ this.set({ start: [0, 0, 0], end: [0, 0, 0], segments: 20 });
1620
+ }
1621
+ ngOnInit() {
1622
+ this.connect('points', combineLatest([
1623
+ this.select('start'),
1624
+ this.select('end'),
1625
+ this.select('mid').pipe(startWithUndefined()),
1626
+ this.select('segments'),
1627
+ ]).pipe(map(([start, end, mid, segments]) => this.getPoints(start, end, mid, segments))));
1628
+ this.replaceSetPoints();
1629
+ }
1630
+ replaceSetPoints() {
1631
+ this.hold(this.lineRef.$, (line) => {
1632
+ line.setPoints = (start, end, mid) => {
1633
+ const points = this.getPoints(start, end, mid);
1634
+ if (this.lineRef.nativeElement.geometry) {
1635
+ this.lineRef.nativeElement.geometry.setPositions(points.map((p) => p.toArray()).flat());
1636
+ }
1637
+ };
1638
+ });
1639
+ }
1640
+ getPoints(start, end, mid, segments = 20) {
1641
+ if (start instanceof THREE.Vector3)
1642
+ this.curve.v0.copy(start);
1643
+ else
1644
+ this.curve.v0.set(...start);
1645
+ if (end instanceof THREE.Vector3)
1646
+ this.curve.v2.copy(end);
1647
+ else
1648
+ this.curve.v2.set(...end);
1649
+ if (mid instanceof THREE.Vector3) {
1650
+ this.curve.v1.copy(mid);
1651
+ }
1652
+ else {
1653
+ this.curve.v1.copy(this.curve.v0
1654
+ .clone()
1655
+ .add(this.curve.v2.clone().sub(this.curve.v0))
1656
+ .add(v.set(0, this.curve.v0.y - this.curve.v2.y, 0)));
1657
+ }
1658
+ return this.curve.getPoints(segments);
1659
+ }
1660
+ }
1661
+ NgtsQuadraticBezierLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsQuadraticBezierLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
1662
+ NgtsQuadraticBezierLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsQuadraticBezierLine, isStandalone: true, selector: "ngts-quadratic-bezier-line", inputs: { lineRef: "lineRef", start: "start", end: "end", mid: "mid", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
1663
+ <ngts-line
1664
+ [lineRef]="lineRef"
1665
+ [points]="get('points')"
1666
+ [color]="get('color')"
1667
+ [vertexColors]="get('vertexColors')"
1668
+ [resolution]="get('resolution')"
1669
+ [lineWidth]="get('lineWidth')"
1670
+ [alphaToCoverage]="get('alphaToCoverage')"
1671
+ [dashed]="get('dashed')"
1672
+ [dashScale]="get('dashScale')"
1673
+ [dashSize]="get('dashSize')"
1674
+ [dashOffset]="get('dashOffset')"
1675
+ [gapSize]="get('gapSize')"
1676
+ [wireframe]="get('wireframe')"
1677
+ [worldUnits]="get('worldUnits')"
1678
+ />
1679
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line[points]", inputs: ["lineRef", "points", "segments"] }] });
1680
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsQuadraticBezierLine, decorators: [{
1681
+ type: Component,
1682
+ args: [{
1683
+ selector: 'ngts-quadratic-bezier-line',
1684
+ standalone: true,
1685
+ template: `
1686
+ <ngts-line
1687
+ [lineRef]="lineRef"
1688
+ [points]="get('points')"
1689
+ [color]="get('color')"
1690
+ [vertexColors]="get('vertexColors')"
1691
+ [resolution]="get('resolution')"
1692
+ [lineWidth]="get('lineWidth')"
1693
+ [alphaToCoverage]="get('alphaToCoverage')"
1694
+ [dashed]="get('dashed')"
1695
+ [dashScale]="get('dashScale')"
1696
+ [dashSize]="get('dashSize')"
1697
+ [dashOffset]="get('dashOffset')"
1698
+ [gapSize]="get('gapSize')"
1699
+ [wireframe]="get('wireframe')"
1700
+ [worldUnits]="get('worldUnits')"
1701
+ />
1702
+ `,
1703
+ imports: [NgtsLine],
1704
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1705
+ }]
1706
+ }], propDecorators: { lineRef: [{
1707
+ type: Input
1708
+ }], start: [{
1709
+ type: Input
1710
+ }], end: [{
1711
+ type: Input
1712
+ }], mid: [{
1713
+ type: Input
1714
+ }], segments: [{
1715
+ type: Input
1716
+ }] } });
1717
+
1184
1718
  extend({ Mesh, TextGeometry });
1185
1719
  class NgtsText3D extends NgtRxStore {
1186
1720
  constructor() {
@@ -1427,5 +1961,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
1427
1961
  * Generated bundle index. Do not edit.
1428
1962
  */
1429
1963
 
1430
- export { NGTS_GIZMO_HELPER_API, NgtsBillboard, NgtsGizmoHelper, NgtsGizmoHelperContent, NgtsGizmoViewcube, NgtsGizmoViewport, NgtsText, NgtsText3D };
1964
+ export { NGTS_GIZMO_HELPER_API, NgtsBillboard, NgtsCatmullRomLine, NgtsCubicBezierLine, NgtsGizmoHelper, NgtsGizmoHelperContent, NgtsGizmoViewcube, NgtsGizmoViewport, NgtsLine, NgtsQuadraticBezierLine, NgtsText, NgtsText3D };
1431
1965
  //# sourceMappingURL=angular-three-soba-abstractions.mjs.map