-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathHelpers_PointHelper.js.html
executable file
·735 lines (607 loc) · 50.8 KB
/
Helpers_PointHelper.js.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Helpers/PointHelper.js - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Lore.AABB.html">AABB</a><ul class='methods'><li data-type='method'><a href="Lore.AABB.html#.clone">clone</a></li><li data-type='method'><a href="Lore.AABB.html#.fromPoints">fromPoints</a></li><li data-type='method'><a href="Lore.AABB.html#.getCorners">getCorners</a></li><li data-type='method'><a href="Lore.AABB.html#cylinderTest">cylinderTest</a></li><li data-type='method'><a href="Lore.AABB.html#distanceFromCenterToPointSq">distanceFromCenterToPointSq</a></li><li data-type='method'><a href="Lore.AABB.html#distanceToPointSq">distanceToPointSq</a></li><li data-type='method'><a href="Lore.AABB.html#getLocCode">getLocCode</a></li><li data-type='method'><a href="Lore.AABB.html#rayTest">rayTest</a></li><li data-type='method'><a href="Lore.AABB.html#setLocCode">setLocCode</a></li><li data-type='method'><a href="Lore.AABB.html#testAABB">testAABB</a></li><li data-type='method'><a href="Lore.AABB.html#updateDimensions">updateDimensions</a></li></ul></li><li><a href="Lore.Attribute.html">Attribute</a><ul class='methods'><li data-type='method'><a href="Lore.Attribute.html#bind">bind</a></li><li data-type='method'><a href="Lore.Attribute.html#createBuffer">createBuffer</a></li><li data-type='method'><a href="Lore.Attribute.html#getGlType">getGlType</a></li><li data-type='method'><a href="Lore.Attribute.html#getW">getW</a></li><li data-type='method'><a href="Lore.Attribute.html#getX">getX</a></li><li data-type='method'><a href="Lore.Attribute.html#getY">getY</a></li><li data-type='method'><a href="Lore.Attribute.html#getZ">getZ</a></li><li data-type='method'><a href="Lore.Attribute.html#setFromVector">setFromVector</a></li><li data-type='method'><a href="Lore.Attribute.html#setFromVectorArray">setFromVectorArray</a></li><li data-type='method'><a href="Lore.Attribute.html#setW">setW</a></li><li data-type='method'><a href="Lore.Attribute.html#setX">setX</a></li><li data-type='method'><a href="Lore.Attribute.html#setY">setY</a></li><li data-type='method'><a href="Lore.Attribute.html#setZ">setZ</a></li><li data-type='method'><a href="Lore.Attribute.html#update">update</a></li></ul></li><li><a href="Lore.CameraBase.html">CameraBase</a><ul class='methods'><li data-type='method'><a href="Lore.CameraBase.html#getProjectionMatrix">getProjectionMatrix</a></li><li data-type='method'><a href="Lore.CameraBase.html#getViewMatrix">getViewMatrix</a></li><li data-type='method'><a href="Lore.CameraBase.html#init">init</a></li><li data-type='method'><a href="Lore.CameraBase.html#sceneToScreen">sceneToScreen</a></li><li data-type='method'><a href="Lore.CameraBase.html#setLookAt">setLookAt</a></li><li data-type='method'><a href="Lore.CameraBase.html#updateProjectionMatrix">updateProjectionMatrix</a></li><li data-type='method'><a href="Lore.CameraBase.html#updateViewMatrix">updateViewMatrix</a></li><li data-type='method'><a href="Lore.CameraBase.html#updateViewport">updateViewport</a></li></ul></li><li><a href="Lore.Color.html">Color</a><ul class='methods'><li data-type='method'><a href="Lore.Color.html#.fromHex">fromHex</a></li><li data-type='method'><a href="Lore.Color.html#.gdbHueShift">gdbHueShift</a></li><li data-type='method'><a href="Lore.Color.html#.hslToHex">hslToHex</a></li><li data-type='method'><a href="Lore.Color.html#.hslToRgb">hslToRgb</a></li><li data-type='method'><a href="Lore.Color.html#.hueToRgb">hueToRgb</a></li><li data-type='method'><a href="Lore.Color.html#.rgbToHsl">rgbToHsl</a></li><li data-type='method'><a href="Lore.Color.html#set">set</a></li></ul></li><li><a href="Lore.ControlsBase.html">ControlsBase</a><ul class='methods'><li data-type='method'><a href="Lore.ControlsBase.html#addEventListener">addEventListener</a></li><li data-type='method'><a href="Lore.ControlsBase.html#getLookAt">getLookAt</a></li><li data-type='method'><a href="Lore.ControlsBase.html#initWebVR">initWebVR</a></li><li data-type='method'><a href="Lore.ControlsBase.html#raiseEvent">raiseEvent</a></li><li data-type='method'><a href="Lore.ControlsBase.html#removeEventListener">removeEventListener</a></li><li data-type='method'><a href="Lore.ControlsBase.html#setLookAt">setLookAt</a></li><li data-type='method'><a href="Lore.ControlsBase.html#update">update</a></li></ul></li><li><a href="Lore.CoordinatesHelper.html">CoordinatesHelper</a><ul class='methods'><li data-type='method'><a href="Lore.CoordinatesHelper.html#init">init</a></li></ul></li><li><a href="Lore.CsvFileReader.html">CsvFileReader</a><ul class='methods'><li data-type='method'><a href="Lore.CsvFileReader.html#loaded">loaded</a></li></ul></li><li><a href="Lore.FileReaderBase.html">FileReaderBase</a><ul class='methods'><li data-type='method'><a href="Lore.FileReaderBase.html#addEventListener">addEventListener</a></li><li data-type='method'><a href="Lore.FileReaderBase.html#loaded">loaded</a></li><li data-type='method'><a href="Lore.FileReaderBase.html#raiseEvent">raiseEvent</a></li></ul></li><li><a href="Lore.FilterBase.html">FilterBase</a><ul class='methods'><li data-type='method'><a href="Lore.FilterBase.html#.isVisible">isVisible</a></li><li data-type='method'><a href="Lore.FilterBase.html#filter">filter</a></li><li data-type='method'><a href="Lore.FilterBase.html#getGeometry">getGeometry</a></li><li data-type='method'><a href="Lore.FilterBase.html#reset">reset</a></li><li data-type='method'><a href="Lore.FilterBase.html#setGeometry">setGeometry</a></li></ul></li><li><a href="Lore.FirstPersonControls.html">FirstPersonControls</a><ul class='methods'><li data-type='method'><a href="Lore.FirstPersonControls.html#update">update</a></li></ul></li><li><a href="Lore.Geometry.html">Geometry</a></li><li><a href="Lore.Graph.html">Graph</a><ul class='methods'><li data-type='method'><a href="Lore.Graph.html#.fromEdgeList">fromEdgeList</a></li><li data-type='method'><a href="Lore.Graph.html#forceLayout">forceLayout</a></li><li data-type='method'><a href="Lore.Graph.html#getDistanceMatrix">getDistanceMatrix</a></li><li data-type='method'><a href="Lore.Graph.html#getEdgeList">getEdgeList</a></li><li data-type='method'><a href="Lore.Graph.html#getUnweightedAdjacencyMatrix">getUnweightedAdjacencyMatrix</a></li><li data-type='method'><a href="Lore.Graph.html#kkLayout">kkLayout</a></li></ul></li><li><a href="Lore.HelperBase.html">HelperBase</a><ul class='methods'><li data-type='method'><a href="Lore.HelperBase.html#destruct">destruct</a></li><li data-type='method'><a href="Lore.HelperBase.html#draw">draw</a></li><li data-type='method'><a href="Lore.HelperBase.html#getAttribute">getAttribute</a></li><li data-type='method'><a href="Lore.HelperBase.html#setAttribute">setAttribute</a></li><li data-type='method'><a href="Lore.HelperBase.html#updateAttribute">updateAttribute</a></li><li data-type='method'><a href="Lore.HelperBase.html#updateAttributeAll">updateAttributeAll</a></li></ul></li><li><a href="Lore.InRangeFilter.html">InRangeFilter</a><ul class='methods'><li data-type='method'><a href="Lore.InRangeFilter.html#filter">filter</a></li><li data-type='method'><a href="Lore.InRangeFilter.html#getMax">getMax</a></li><li data-type='method'><a href="Lore.InRangeFilter.html#getMin">getMin</a></li><li data-type='method'><a href="Lore.InRangeFilter.html#reset">reset</a></li><li data-type='method'><a href="Lore.InRangeFilter.html#setMax">setMax</a></li><li data-type='method'><a href="Lore.InRangeFilter.html#setMin">setMin</a></li></ul></li><li><a href="Lore.Matrix3f.html">Matrix3f</a><ul class='methods'><li data-type='method'><a href="Lore.Matrix3f.html#clone">clone</a></li><li data-type='method'><a href="Lore.Matrix3f.html#equals">equals</a></li></ul></li><li><a href="Lore.Matrix4f.html">Matrix4f</a><ul class='methods'><li data-type='method'><a href="Lore.Matrix4f.html#.compose">compose</a></li><li data-type='method'><a href="Lore.Matrix4f.html#.fromQuaternion">fromQuaternion</a></li><li data-type='method'><a href="Lore.Matrix4f.html#.invert">invert</a></li><li data-type='method'><a href="Lore.Matrix4f.html#.lookAt">lookAt</a></li><li data-type='method'><a href="Lore.Matrix4f.html#.multiply">multiply</a></li><li data-type='method'><a href="Lore.Matrix4f.html#clone">clone</a></li><li data-type='method'><a href="Lore.Matrix4f.html#compose">compose</a></li><li data-type='method'><a href="Lore.Matrix4f.html#decompose">decompose</a></li><li data-type='method'><a href="Lore.Matrix4f.html#determinant">determinant</a></li><li data-type='method'><a href="Lore.Matrix4f.html#equals">equals</a></li><li data-type='method'><a href="Lore.Matrix4f.html#invert">invert</a></li><li data-type='method'><a href="Lore.Matrix4f.html#multiplyA">multiplyA</a></li><li data-type='method'><a href="Lore.Matrix4f.html#multiplyB">multiplyB</a></li><li data-type='method'><a href="Lore.Matrix4f.html#scale">scale</a></li><li data-type='method'><a href="Lore.Matrix4f.html#set">set</a></li><li data-type='method'><a href="Lore.Matrix4f.html#setPosition">setPosition</a></li><li data-type='method'><a href="Lore.Matrix4f.html#setRotation">setRotation</a></li><li data-type='method'><a href="Lore.Matrix4f.html#toString">toString</a></li></ul></li><li><a href="Lore.MatrixFileReader.html">MatrixFileReader</a><ul class='methods'><li data-type='method'><a href="Lore.MatrixFileReader.html#loaded">loaded</a></li></ul></li><li><a href="Lore.Node.html">Node</a><ul class='methods'><li data-type='method'><a href="Lore.Node.html#.createGUID">createGUID</a></li><li data-type='method'><a href="Lore.Node.html#applyMatrix">applyMatrix</a></li><li data-type='method'><a href="Lore.Node.html#getForwardVector">getForwardVector</a></li><li data-type='method'><a href="Lore.Node.html#getModelMatrix">getModelMatrix</a></li><li data-type='method'><a href="Lore.Node.html#getRightVector">getRightVector</a></li><li data-type='method'><a href="Lore.Node.html#getRotationMatrix">getRotationMatrix</a></li><li data-type='method'><a href="Lore.Node.html#getUpVector">getUpVector</a></li><li data-type='method'><a href="Lore.Node.html#rotate">rotate</a></li><li data-type='method'><a href="Lore.Node.html#rotateX">rotateX</a></li><li data-type='method'><a href="Lore.Node.html#rotateY">rotateY</a></li><li data-type='method'><a href="Lore.Node.html#rotateZ">rotateZ</a></li><li data-type='method'><a href="Lore.Node.html#setRotation">setRotation</a></li><li data-type='method'><a href="Lore.Node.html#setTranslation">setTranslation</a></li><li data-type='method'><a href="Lore.Node.html#translateOnAxis">translateOnAxis</a></li><li data-type='method'><a href="Lore.Node.html#translateX">translateX</a></li><li data-type='method'><a href="Lore.Node.html#translateY">translateY</a></li><li data-type='method'><a href="Lore.Node.html#translateZ">translateZ</a></li><li data-type='method'><a href="Lore.Node.html#update">update</a></li></ul></li><li><a href="Lore.Octree.html">Octree</a><ul class='methods'><li data-type='method'><a href="Lore.Octree.html#.clone">clone</a></li><li data-type='method'><a href="Lore.Octree.html#.concatTypedArrays">concatTypedArrays</a></li><li data-type='method'><a href="Lore.Octree.html#.mergeCellDistances">mergeCellDistances</a></li><li data-type='method'><a href="Lore.Octree.html#.mergePointDistances">mergePointDistances</a></li><li data-type='method'><a href="Lore.Octree.html#build">build</a></li><li data-type='method'><a href="Lore.Octree.html#cellDistancesSq">cellDistancesSq</a></li><li data-type='method'><a href="Lore.Octree.html#expandNeighbourhood">expandNeighbourhood</a></li><li data-type='method'><a href="Lore.Octree.html#generateLocCode">generateLocCode</a></li><li data-type='method'><a href="Lore.Octree.html#getCellDistancesToPoint">getCellDistancesToPoint</a></li><li data-type='method'><a href="Lore.Octree.html#getCenters">getCenters</a></li><li data-type='method'><a href="Lore.Octree.html#getClosestBox">getClosestBox</a></li><li data-type='method'><a href="Lore.Octree.html#getClosestBoxFromCenter">getClosestBoxFromCenter</a></li><li data-type='method'><a href="Lore.Octree.html#getClosestPoint">getClosestPoint</a></li><li data-type='method'><a href="Lore.Octree.html#getDepth">getDepth</a></li><li data-type='method'><a href="Lore.Octree.html#getFarthestBox">getFarthestBox</a></li><li data-type='method'><a href="Lore.Octree.html#getFarthestPoint">getFarthestPoint</a></li><li data-type='method'><a href="Lore.Octree.html#getLocCodes">getLocCodes</a></li><li data-type='method'><a href="Lore.Octree.html#getNeighbours">getNeighbours</a></li><li data-type='method'><a href="Lore.Octree.html#getParent">getParent</a></li><li data-type='method'><a href="Lore.Octree.html#kNearestNeighbours">kNearestNeighbours</a></li><li data-type='method'><a href="Lore.Octree.html#pointDistancesSq">pointDistancesSq</a></li><li data-type='method'><a href="Lore.Octree.html#raySearch">raySearch</a></li><li data-type='method'><a href="Lore.Octree.html#traverse">traverse</a></li><li data-type='method'><a href="Lore.Octree.html#traverseIf">traverseIf</a></li></ul></li><li><a href="Lore.OctreeHelper.html">OctreeHelper</a><ul class='methods'><li data-type='method'><a href="Lore.OctreeHelper.html#addEventListener">addEventListener</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#addSelected">addSelected</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#clearSelected">clearSelected</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#destruct">destruct</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#drawBoxes">drawBoxes</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#drawCenters">drawCenters</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#getIntersections">getIntersections</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#getScreenPosition">getScreenPosition</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#hide">hide</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#init">init</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#raiseEvent">raiseEvent</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#rayIntersections">rayIntersections</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#removeSelected">removeSelected</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#selectedContains">selectedContains</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#selectHovered">selectHovered</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#setHovered">setHovered</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#setPointSizeFromZoom">setPointSizeFromZoom</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#setThreshold">setThreshold</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#showCenters">showCenters</a></li><li data-type='method'><a href="Lore.OctreeHelper.html#showCubes">showCubes</a></li></ul></li><li><a href="Lore.OrbitalControls.html">OrbitalControls</a><ul class='methods'><li data-type='method'><a href="Lore.OrbitalControls.html#limitRotationToHorizon">limitRotationToHorizon</a></li><li data-type='method'><a href="Lore.OrbitalControls.html#setBackView">setBackView</a></li><li data-type='method'><a href="Lore.OrbitalControls.html#setBottomView">setBottomView</a></li><li data-type='method'><a href="Lore.OrbitalControls.html#setFreeView">setFreeView</a></li><li data-type='method'><a href="Lore.OrbitalControls.html#setFrontView">setFrontView</a></li><li data-type='method'><a href="Lore.OrbitalControls.html#setLeftView">setLeftView</a></li><li data-type='method'><a href="Lore.OrbitalControls.html#setRadius">setRadius</a></li><li data-type='method'><a href="Lore.OrbitalControls.html#setRightView">setRightView</a></li><li data-type='method'><a href="Lore.OrbitalControls.html#setTopView">setTopView</a></li><li data-type='method'><a href="Lore.OrbitalControls.html#setView">setView</a></li><li data-type='method'><a href="Lore.OrbitalControls.html#setZoom">setZoom</a></li><li data-type='method'><a href="Lore.OrbitalControls.html#update">update</a></li><li data-type='method'><a href="Lore.OrbitalControls.html#zoomIn">zoomIn</a></li><li data-type='method'><a href="Lore.OrbitalControls.html#zoomOut">zoomOut</a></li></ul></li><li><a href="Lore.OrthographicCamera.html">OrthographicCamera</a><ul class='methods'><li data-type='method'><a href="Lore.OrthographicCamera.html#updateProjectionMatrix">updateProjectionMatrix</a></li><li data-type='method'><a href="Lore.OrthographicCamera.html#updateViewport">updateViewport</a></li></ul></li><li><a href="Lore.PerspectiveCamera.html">PerspectiveCamera</a><ul class='methods'><li data-type='method'><a href="Lore.PerspectiveCamera.html#updateProjectionMatrix">updateProjectionMatrix</a></li><li data-type='method'><a href="Lore.PerspectiveCamera.html#updateViewport">updateViewport</a></li></ul></li><li><a href="Lore.PointHelper.html">PointHelper</a><ul class='methods'><li data-type='method'><a href="Lore.PointHelper.html#addFilter">addFilter</a></li><li data-type='method'><a href="Lore.PointHelper.html#getCenter">getCenter</a></li><li data-type='method'><a href="Lore.PointHelper.html#getCutoff">getCutoff</a></li><li data-type='method'><a href="Lore.PointHelper.html#getDimensions">getDimensions</a></li><li data-type='method'><a href="Lore.PointHelper.html#getFilter">getFilter</a></li><li data-type='method'><a href="Lore.PointHelper.html#getHue">getHue</a></li><li data-type='method'><a href="Lore.PointHelper.html#getMaxLength">getMaxLength</a></li><li data-type='method'><a href="Lore.PointHelper.html#getMaxRadius">getMaxRadius</a></li><li data-type='method'><a href="Lore.PointHelper.html#getPointScale">getPointScale</a></li><li data-type='method'><a href="Lore.PointHelper.html#getPointSize">getPointSize</a></li><li data-type='method'><a href="Lore.PointHelper.html#getPosition">getPosition</a></li><li data-type='method'><a href="Lore.PointHelper.html#getSaturation">getSaturation</a></li><li data-type='method'><a href="Lore.PointHelper.html#getSize">getSize</a></li><li data-type='method'><a href="Lore.PointHelper.html#initPointSize">initPointSize</a></li><li data-type='method'><a href="Lore.PointHelper.html#removeFilter">removeFilter</a></li><li data-type='method'><a href="Lore.PointHelper.html#setColors">setColors</a></li><li data-type='method'><a href="Lore.PointHelper.html#setCutoff">setCutoff</a></li><li data-type='method'><a href="Lore.PointHelper.html#setFogDistance">setFogDistance</a></li><li data-type='method'><a href="Lore.PointHelper.html#setHSS">setHSS</a></li><li data-type='method'><a href="Lore.PointHelper.html#setHSSFromArrays">setHSSFromArrays</a></li><li data-type='method'><a href="Lore.PointHelper.html#setHue">setHue</a></li><li data-type='method'><a href="Lore.PointHelper.html#setPointScale">setPointScale</a></li><li data-type='method'><a href="Lore.PointHelper.html#setPointSize">setPointSize</a></li><li data-type='method'><a href="Lore.PointHelper.html#setPositions">setPositions</a></li><li data-type='method'><a href="Lore.PointHelper.html#setPositionsXYZ">setPositionsXYZ</a></li><li data-type='method'><a href="Lore.PointHelper.html#setPositionsXYZHSS">setPositionsXYZHSS</a></li><li data-type='method'><a href="Lore.PointHelper.html#setRGB">setRGB</a></li><li data-type='method'><a href="Lore.PointHelper.html#setSaturation">setSaturation</a></li><li data-type='method'><a href="Lore.PointHelper.html#setSize">setSize</a></li><li data-type='method'><a href="Lore.PointHelper.html#updateColor">updateColor</a></li><li data-type='method'><a href="Lore.PointHelper.html#updateColors">updateColors</a></li><li data-type='method'><a href="Lore.PointHelper.html#updateHue">updateHue</a></li><li data-type='method'><a href="Lore.PointHelper.html#updatePointSize">updatePointSize</a></li></ul></li><li><a href="Lore.ProjectionMatrix.html">ProjectionMatrix</a><ul class='methods'><li data-type='method'><a href="Lore.ProjectionMatrix.html#setOrthographic">setOrthographic</a></li><li data-type='method'><a href="Lore.ProjectionMatrix.html#setPerspective">setPerspective</a></li></ul></li><li><a href="Lore.Quaternion.html">Quaternion</a><ul class='methods'><li data-type='method'><a href="Lore.Quaternion.html#.add">add</a></li><li data-type='method'><a href="Lore.Quaternion.html#.conjugate">conjugate</a></li><li data-type='method'><a href="Lore.Quaternion.html#.dot">dot</a></li><li data-type='method'><a href="Lore.Quaternion.html#.fromMatrix">fromMatrix</a></li><li data-type='method'><a href="Lore.Quaternion.html#.inverse">inverse</a></li><li data-type='method'><a href="Lore.Quaternion.html#.multiply">multiply</a></li><li data-type='method'><a href="Lore.Quaternion.html#.multiplyScalar">multiplyScalar</a></li><li data-type='method'><a href="Lore.Quaternion.html#.normalize">normalize</a></li><li data-type='method'><a href="Lore.Quaternion.html#.slerp">slerp</a></li><li data-type='method'><a href="Lore.Quaternion.html#.subtract">subtract</a></li><li data-type='method'><a href="Lore.Quaternion.html#add">add</a></li><li data-type='method'><a href="Lore.Quaternion.html#clone">clone</a></li><li data-type='method'><a href="Lore.Quaternion.html#conjugate">conjugate</a></li><li data-type='method'><a href="Lore.Quaternion.html#dot">dot</a></li><li data-type='method'><a href="Lore.Quaternion.html#equals">equals</a></li><li data-type='method'><a href="Lore.Quaternion.html#getW">getW</a></li><li data-type='method'><a href="Lore.Quaternion.html#getX">getX</a></li><li data-type='method'><a href="Lore.Quaternion.html#getY">getY</a></li><li data-type='method'><a href="Lore.Quaternion.html#getZ">getZ</a></li><li data-type='method'><a href="Lore.Quaternion.html#inverse">inverse</a></li><li data-type='method'><a href="Lore.Quaternion.html#length">length</a></li><li data-type='method'><a href="Lore.Quaternion.html#lengthSq">lengthSq</a></li><li data-type='method'><a href="Lore.Quaternion.html#lookAt">lookAt</a></li><li data-type='method'><a href="Lore.Quaternion.html#multiplyA">multiplyA</a></li><li data-type='method'><a href="Lore.Quaternion.html#multiplyB">multiplyB</a></li><li data-type='method'><a href="Lore.Quaternion.html#multiplyScalar">multiplyScalar</a></li><li data-type='method'><a href="Lore.Quaternion.html#normalize">normalize</a></li><li data-type='method'><a href="Lore.Quaternion.html#rotateX">rotateX</a></li><li data-type='method'><a href="Lore.Quaternion.html#rotateY">rotateY</a></li><li data-type='method'><a href="Lore.Quaternion.html#rotateZ">rotateZ</a></li><li data-type='method'><a href="Lore.Quaternion.html#set">set</a></li><li data-type='method'><a href="Lore.Quaternion.html#setFromAxisAngle">setFromAxisAngle</a></li><li data-type='method'><a href="Lore.Quaternion.html#setFromMatrix">setFromMatrix</a></li><li data-type='method'><a href="Lore.Quaternion.html#setFromUnitVectors">setFromUnitVectors</a></li><li data-type='method'><a href="Lore.Quaternion.html#setW">setW</a></li><li data-type='method'><a href="Lore.Quaternion.html#setX">setX</a></li><li data-type='method'><a href="Lore.Quaternion.html#setY">setY</a></li><li data-type='method'><a href="Lore.Quaternion.html#setZ">setZ</a></li><li data-type='method'><a href="Lore.Quaternion.html#subtract">subtract</a></li><li data-type='method'><a href="Lore.Quaternion.html#toRotationMatrix">toRotationMatrix</a></li><li data-type='method'><a href="Lore.Quaternion.html#toString">toString</a></li></ul></li><li><a href="Lore.RadixSort.html">RadixSort</a><ul class='methods'><li data-type='method'><a href="Lore.RadixSort.html#initHistograms">initHistograms</a></li><li data-type='method'><a href="Lore.RadixSort.html#lsbPass">lsbPass</a></li><li data-type='method'><a href="Lore.RadixSort.html#msbPass">msbPass</a></li><li data-type='method'><a href="Lore.RadixSort.html#pass">pass</a></li><li data-type='method'><a href="Lore.RadixSort.html#sort">sort</a></li></ul></li><li><a href="Lore.Ray.html">Ray</a><ul class='methods'><li data-type='method'><a href="Lore.Ray.html#applyProjection">applyProjection</a></li><li data-type='method'><a href="Lore.Ray.html#closestPointToPoint">closestPointToPoint</a></li><li data-type='method'><a href="Lore.Ray.html#copyFrom">copyFrom</a></li><li data-type='method'><a href="Lore.Ray.html#distanceSqToPoint">distanceSqToPoint</a></li></ul></li><li><a href="Lore.Raycaster.html">Raycaster</a><ul class='methods'><li data-type='method'><a href="Lore.Raycaster.html#set">set</a></li></ul></li><li><a href="Lore.Renderer.html">Renderer</a><ul class='methods'><li data-type='method'><a href="Lore.Renderer.html#animate">animate</a></li><li data-type='method'><a href="Lore.Renderer.html#createGeometry">createGeometry</a></li><li data-type='method'><a href="Lore.Renderer.html#disableContextMenu">disableContextMenu</a></li><li data-type='method'><a href="Lore.Renderer.html#getDevicePixelRatio">getDevicePixelRatio</a></li><li data-type='method'><a href="Lore.Renderer.html#getHeight">getHeight</a></li><li data-type='method'><a href="Lore.Renderer.html#getWidth">getWidth</a></li><li data-type='method'><a href="Lore.Renderer.html#init">init</a></li><li data-type='method'><a href="Lore.Renderer.html#setClearColor">setClearColor</a></li><li data-type='method'><a href="Lore.Renderer.html#setMaxFps">setMaxFps</a></li><li data-type='method'><a href="Lore.Renderer.html#updateViewport">updateViewport</a></li></ul></li><li><a href="Lore.Shader.html">Shader</a></li><li><a href="Lore.SphericalCoords.html">SphericalCoords</a><ul class='methods'><li data-type='method'><a href="Lore.SphericalCoords.html#clone">clone</a></li><li data-type='method'><a href="Lore.SphericalCoords.html#limit">limit</a></li><li data-type='method'><a href="Lore.SphericalCoords.html#secure">secure</a></li><li data-type='method'><a href="Lore.SphericalCoords.html#set">set</a></li><li data-type='method'><a href="Lore.SphericalCoords.html#setFromVector">setFromVector</a></li><li data-type='method'><a href="Lore.SphericalCoords.html#toString">toString</a></li></ul></li><li><a href="Lore.Statistics.html">Statistics</a><ul class='methods'><li data-type='method'><a href="Lore.Statistics.html#.getPercentile">getPercentile</a></li><li data-type='method'><a href="Lore.Statistics.html#.normalize">normalize</a></li><li data-type='method'><a href="Lore.Statistics.html#.normalizeNoOutliers">normalizeNoOutliers</a></li><li data-type='method'><a href="Lore.Statistics.html#.randomNormal">randomNormal</a></li><li data-type='method'><a href="Lore.Statistics.html#.randomNormalInRange">randomNormalInRange</a></li><li data-type='method'><a href="Lore.Statistics.html#.randomNormalScaled">randomNormalScaled</a></li><li data-type='method'><a href="Lore.Statistics.html#.scale">scale</a></li><li data-type='method'><a href="Lore.Statistics.html#.transpose2dArray">transpose2dArray</a></li></ul></li><li><a href="Lore.Tree.html">Tree</a><ul class='methods'><li data-type='method'><a href="Lore.Tree.html#.fromEdgeList">fromEdgeList</a></li><li data-type='method'><a href="Lore.Tree.html#layout">layout</a></li></ul></li><li><a href="Lore.Uniform.html">Uniform</a><ul class='methods'><li data-type='method'><a href="Lore.Uniform.html#.Set">Set</a></li><li data-type='method'><a href="Lore.Uniform.html#setValue">setValue</a></li></ul></li><li><a href="Lore.Utils.html">Utils</a><ul class='methods'><li data-type='method'><a href="Lore.Utils.html#.arrayContains">arrayContains</a></li><li data-type='method'><a href="Lore.Utils.html#.concatTypedArrays">concatTypedArrays</a></li><li data-type='method'><a href="Lore.Utils.html#.extend">extend</a></li><li data-type='method'><a href="Lore.Utils.html#.isFloat">isFloat</a></li><li data-type='method'><a href="Lore.Utils.html#.isInt">isInt</a></li><li data-type='method'><a href="Lore.Utils.html#.jsonp">jsonp</a></li><li data-type='method'><a href="Lore.Utils.html#.mergePointDistances">mergePointDistances</a></li><li data-type='method'><a href="Lore.Utils.html#.msb">msb</a></li></ul></li><li><a href="Lore.Vector3f.html">Vector3f</a><ul class='methods'><li data-type='method'><a href="Lore.Vector3f.html#.add">add</a></li><li data-type='method'><a href="Lore.Vector3f.html#.cross">cross</a></li><li data-type='method'><a href="Lore.Vector3f.html#.divide">divide</a></li><li data-type='method'><a href="Lore.Vector3f.html#.divideScalar">divideScalar</a></li><li data-type='method'><a href="Lore.Vector3f.html#.dot">dot</a></li><li data-type='method'><a href="Lore.Vector3f.html#.forward">forward</a></li><li data-type='method'><a href="Lore.Vector3f.html#.multiply">multiply</a></li><li data-type='method'><a href="Lore.Vector3f.html#.multiplyScalar">multiplyScalar</a></li><li data-type='method'><a href="Lore.Vector3f.html#.normalize">normalize</a></li><li data-type='method'><a href="Lore.Vector3f.html#.right">right</a></li><li data-type='method'><a href="Lore.Vector3f.html#.subtract">subtract</a></li><li data-type='method'><a href="Lore.Vector3f.html#.up">up</a></li><li data-type='method'><a href="Lore.Vector3f.html#add">add</a></li><li data-type='method'><a href="Lore.Vector3f.html#applyProjection">applyProjection</a></li><li data-type='method'><a href="Lore.Vector3f.html#applyQuaternion">applyQuaternion</a></li><li data-type='method'><a href="Lore.Vector3f.html#clone">clone</a></li><li data-type='method'><a href="Lore.Vector3f.html#copyFrom">copyFrom</a></li><li data-type='method'><a href="Lore.Vector3f.html#cross">cross</a></li><li data-type='method'><a href="Lore.Vector3f.html#distanceTo">distanceTo</a></li><li data-type='method'><a href="Lore.Vector3f.html#distanceToSq">distanceToSq</a></li><li data-type='method'><a href="Lore.Vector3f.html#divide">divide</a></li><li data-type='method'><a href="Lore.Vector3f.html#divideScalar">divideScalar</a></li><li data-type='method'><a href="Lore.Vector3f.html#dot">dot</a></li><li data-type='method'><a href="Lore.Vector3f.html#equals">equals</a></li><li data-type='method'><a href="Lore.Vector3f.html#getX">getX</a></li><li data-type='method'><a href="Lore.Vector3f.html#getY">getY</a></li><li data-type='method'><a href="Lore.Vector3f.html#getZ">getZ</a></li><li data-type='method'><a href="Lore.Vector3f.html#length">length</a></li><li data-type='method'><a href="Lore.Vector3f.html#lengthSq">lengthSq</a></li><li data-type='method'><a href="Lore.Vector3f.html#multiply">multiply</a></li><li data-type='method'><a href="Lore.Vector3f.html#multiplyScalar">multiplyScalar</a></li><li data-type='method'><a href="Lore.Vector3f.html#normalize">normalize</a></li><li data-type='method'><a href="Lore.Vector3f.html#project">project</a></li><li data-type='method'><a href="Lore.Vector3f.html#set">set</a></li><li data-type='method'><a href="Lore.Vector3f.html#setFromSphericalCoords">setFromSphericalCoords</a></li><li data-type='method'><a href="Lore.Vector3f.html#setLength">setLength</a></li><li data-type='method'><a href="Lore.Vector3f.html#setX">setX</a></li><li data-type='method'><a href="Lore.Vector3f.html#setY">setY</a></li><li data-type='method'><a href="Lore.Vector3f.html#setZ">setZ</a></li><li data-type='method'><a href="Lore.Vector3f.html#subtract">subtract</a></li><li data-type='method'><a href="Lore.Vector3f.html#toDirection">toDirection</a></li><li data-type='method'><a href="Lore.Vector3f.html#toString">toString</a></li><li data-type='method'><a href="Lore.Vector3f.html#unproject">unproject</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Lore">Lore</a></li></ul>
</nav>
<div id="main">
<h1 class="page-title">Helpers/PointHelper.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* A helper class wrapping a point cloud.
*
* @property {Object} opts An object containing options.
* @property {Number[]} indices Indices associated with the data.
* @property {Lore.Octree} octree The octree associated with the point cloud.
* @property {Object} filters A map mapping filter names to Lore.Filter instances associated with this helper class.
* @property {Number} pointSize The scaled and constrained point size of this data.
* @property {Number} pointScale The scale of the point size.
* @property {Number} rawPointSize The point size before scaling and constraints.
* @property {Object} dimensions An object with the properties min and max, each a 3D vector containing the extremes.
*/
Lore.PointHelper = class PointHelper extends Lore.HelperBase {
/**
* Creates an instance of PointHelper.
* @param {Lore.Renderer} renderer An instance of Lore.Renderer.
* @param {String} geometryName The name of this geometry.
* @param {String} shaderName The name of the shader used to render the geometry.
* @param {Object} options An object containing options.
*/
constructor(renderer, geometryName, shaderName, options) {
super(renderer, geometryName, shaderName);
let defaults = {
octree: true,
octreeThreshold: 500.0,
octreeMaxDepth: 8,
pointScale: 1.0,
maxPointSize: 100.0
};
this.opts = Lore.Utils.extend(true, defaults, options);
this.indices = null;
this.octree = null;
this.geometry.setMode(Lore.DrawModes.points);
this.initPointSize();
this.filters = {};
this.pointScale = this.opts.pointScale;
this.rawPointSize = 1.0;
this.pointSize = this.rawPointSize * this.pointScale;
this.dimensions = {
min: new Lore.Vector3f(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY),
max: new Lore.Vector3f(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY)
};
}
/**
* Get the max length of the length of three arrays.
*
* @param {Array} x
* @param {Array} y
* @param {Array} z
* @returns {Number} The length of the largest array.
*/
getMaxLength(x, y, z) {
return Math.max(x.length, Math.max(y.length, z.length));
}
/**
* Returns an object containing the dimensions of this point cloud.
*
* @returns {Object} An object with the properties min and max, each a 3D vector containing the extremes.
*/
getDimensions() {
return this.dimensions;
}
/**
* Get the center (average) of the point cloud.
*
* @returns {Lore.Vector3f} The center (average) of the point cloud.
*/
getCenter() {
return new Lore.Vector3f((this.dimensions.max.getX() + this.dimensions.min.getX()) / 2.0,
(this.dimensions.max.getY() + this.dimensions.min.getY()) / 2.0,
(this.dimensions.max.getZ() + this.dimensions.min.getZ()) / 2.0);
}
/**
* Gets the distance between the center and the point furthest from the center.
*
* @return {Number} The maximal radius.
*/
getMaxRadius() {
let center = this.getCenter();
return center.subtract(this.dimensions.max).length();
}
/**
* Set the positions of points in this point cloud.
*
* @param {TypedArray} positions The positions (linear array).
* @returns {Lore.PointHelper} Itself.
*/
setPositions(positions) {
// Min, max will NOT be calculated as of now!
// TODO?
this.setAttribute('position', positions);
return this;
}
/**
* Set the positions of points in this point clouds.
*
* @param {TypedArray} x An array containing the x components.
* @param {TypedArray} y An array containing the y components.
* @param {TypedArray} z An array containing the z components.
* @param {Number} length The length of the arrays.
* @returns {Lore.PointHelper} Itself.
*/
setPositionsXYZ(x, y, z, length) {
let positions = new Float32Array(length * 3);
for (var i = 0; i < length; i++) {
let j = 3 * i;
positions[j] = x[i] || 0;
positions[j + 1] = y[i] || 0;
positions[j + 2] = z[i] || 0;
if (x[i] > this.dimensions.max.getX()) {
this.dimensions.max.setX(x[i]);
}
if (x[i] < this.dimensions.min.getX()) {
this.dimensions.min.setX(x[i]);
}
if (y[i] > this.dimensions.max.getY()) {
this.dimensions.max.setY(y[i]);
}
if (y[i] < this.dimensions.min.getY()) {
this.dimensions.min.setY(y[i]);
}
if (z[i] > this.dimensions.max.getZ()) {
this.dimensions.max.setZ(z[i]);
}
if (z[i] < this.dimensions.min.getZ()) {
this.dimensions.min.setZ(z[i]);
}
}
if (this.opts.octree) {
let initialBounds = Lore.AABB.fromPoints(positions);
let indices = new Uint32Array(length);
for (var i = 0; i < length; i++) {
indices[i] = i;
}
this.octree = new Lore.Octree(this.opts.octreeThreshold, this.opts.octreeMaxDepth);
this.octree.build(indices, positions, initialBounds);
}
this.setAttribute('position', positions);
return this;
}
/**
* Set the positions and the HSS (Hue, Saturation, Size) values of the points in the point cloud.
*
* @param {TypedArray} x An array containing the x components.
* @param {TypedArray} y An array containing the y components.
* @param {TypedArray} z An array containing the z components.
* @param {TypedArray} hue An array containing the hues of the data points.
* @param {TypedArray} saturation An array containing the saturations of the data points.
* @param {TypedArray} size An array containing the sizes of the data points.
* @returns {Lore.PointHelper} Itself.
*/
setPositionsXYZHSS(x, y, z, hue, saturation, size) {
let length = this.getMaxLength(x, y, z);
this.setPositionsXYZ(x, y, z, length);
if (typeof hue === 'number' && typeof saturation === 'number' && typeof size === 'number') {
this.setHSS(hue, saturation, size, length);
} else if (typeof hue !== 'number' && typeof saturation !== 'number' && typeof size !== 'number') {
this.setHSSFromArrays(hue, saturation, size, length);
} else {
if (typeof hue === 'number') {
let hueTmp = new Float32Array(length);
hueTmp.fill(hue);
hue = hueTmp;
}
if (typeof saturation === 'number') {
let saturationTmp = new Float32Array(length);
saturationTmp.fill(saturation);
saturation = saturationTmp;
}
if (typeof size === 'number') {
let sizeTmp = new Float32Array(length);
sizeTmp.fill(size);
size = sizeTmp;
}
this.setHSSFromArrays(hue, saturation, size, length);
}
// TODO: Check why the projection matrix update is needed
this.renderer.camera.updateProjectionMatrix();
this.renderer.camera.updateViewMatrix();
return this;
}
/**
* Set the hue from an rgb values.
*
* @param {TypeArray} r An array containing the red components of the colors.
* @param {TypeArray} g An array containing the green components of the colors.
* @param {TypeArray} b An array containing the blue components of the colors.
* @returns {Lore.PointHelper} Itself.
*/
setRGB(r, g, b) {
let c = new Float32Array(r.length * 3);
let colors = this.getAttribute('color');
for (let i = 0; i < r.length; i++) {
let j = 3 * i;
c[j] = r[i];
c[j + 1] = g[i];
c[j + 2] = b[i];
}
// Convert to HOS (Hue, Saturation, Size)
for (let i = 0; i < c.length; i += 3) {
let r = c[i];
let g = c[i + 1];
let b = c[i + 2];
c[i] = Lore.Color.rgbToHsl(r, g, b)[0];
c[i + 1] = colors[i + 1];
c[i + 2] = colors[i + 2];
}
this.updateColors(c);
return this;
}
/**
* Set the colors (HSS) for the points.
*
* @param {TypedArray} colors An array containing the HSS values.
* @returns {Lore.PointHelper} Itself.
*/
setColors(colors) {
this.setAttribute('color', colors);
return this;
}
/**
* Update the colors (HSS) for the points.
*
* @param {TypedArray} colors An array containing the HSS values.
* @returns {Lore.PointHelper} Itself.
*/
updateColors(colors) {
this.updateAttributeAll('color', colors);
return this;
}
/**
* Update the color (HSS) at a specific index.
*
* @param {Number} index The index of the data point.
* @param {Lore.Color} color An instance of Lore.Color containing HSS values.
* @returns {Lore.PointHelper} Itself.
*/
updateColor(index, color) {
this.updateAttribute('color', index, color.components);
return this;
}
/**
* Set the global point size.
*
* @param {Number} size The global point size.
* @returns {Number} The threshold for the raycaster.
*/
setPointSize(size) {
this.rawPointSize = size;
this.updatePointSize();
let pointSize = this.rawPointSize * this.opts.pointScale;
if (pointSize > this.opts.maxPointSize) {
return 0.5 * (this.opts.maxPointSize / pointSize);
} else {
return 0.5;
}
}
/**
* Updates the displayed point size.
*/
updatePointSize() {
let pointSize = this.rawPointSize * this.opts.pointScale;
if (pointSize > this.opts.maxPointSize) {
this.pointSize = this.opts.maxPointSize;
} else {
this.pointSize = pointSize;
}
this.geometry.shader.uniforms.size.value = this.pointSize;
}
/**
* Get the global point size.
*
* @returns {Number} The global point size.
*/
getPointSize() {
return this.geometry.shader.uniforms.size.value;
}
/**
* Get the global point scale.
*
* @returns {Number} The global point size.
*/
getPointScale() {
return this.opts.pointScale;
}
/**
* Sets the global point scale.
*
* @param {Number} pointScale The global point size.
* @returns {Lore.PointHelper} Itself.
*/
setPointScale(pointScale) {
this.opts.pointScale = pointScale;
this.updatePointSize();
return this;
}
/**
* Sets the fog start and end distances, as seen from the camera.
*
* @param {Number} fogStart The start distance of the fog.
* @param {Number} fogEnd The end distance of the fog.
* @returns {Lore.PointHelper} Itself.
*/
setFogDistance(fogStart, fogEnd) {
console.warn('This function is deprecated.');
// this.geometry.shader.uniforms.fogStart.value = fogStart;
// this.geometry.shader.uniforms.fogEnd.value = fogEnd;
return this;
}
/**
* Initialize the point size based on the current zoom.
*
* @returns {Lore.PointHelper} Itself.
*/
initPointSize() {
this.setPointSize(this.renderer.camera.zoom + 0.1);
return this;
}
/**
* Get the current cutoff value.
*
* @returns {Number} The current cutoff value.
*/
getCutoff() {
return this.geometry.shader.uniforms.cutoff.value;
}
/**
* Set the cutoff value.
*
* @param {Number} cutoff A cutoff value.
* @returns {Lore.PointHelper} Itself.
*/
setCutoff(cutoff) {
this.geometry.shader.uniforms.cutoff.value = cutoff;
return this;
}
/**
* Get the hue for a given index.
*
* @param {Number} index An index.
* @returns {Number} The hue of the specified index.
*/
getHue(index) {
let colors = this.getAttribute('color');
return colors[index * 3];
}
/**
* Get the saturation for a given index.
*
* @param {Number} index An index.
* @returns {Number} The saturation of the specified index.
*/
getSaturation(index) {
let colors = this.getAttribute('color');
return colors[index * 3 + 1];
}
/**
* Get the size for a given index.
*
* @param {Number} index An index.
* @returns {Number} The size of the specified index.
*/
getSize(index) {
let colors = this.getAttribute('color');
return colors[index * 3 + 2];
}
/**
* Get the position for a given index.
*
* @param {Number} index An index.
* @returns {Number} The position of the specified index.
*/
getPosition(index) {
let positions = this.getAttribute('position');
return new Lore.Vector3f(positions[index * 3], positions[index * 3 + 1],
positions[index * 3 + 2]);
}
/**
* Set the hue. If a number is supplied, all the hues are set to the supplied number.
*
* @param {TypedArray|Number} hue The hue to be set. If a number is supplied, all hues are set to its value.
*/
setHue(hue) {
let colors = this.getAttribute('color');
let c = null;
let index = 0;
if (typeof hue === 'number') {
let length = colors.length;
c = new Float32Array(length * 3);
for (let i = 0; i < length * 3; i += 3) {
c[i] = hue;
c[i + 1] = colors[i + 1];
c[i + 2] = colors[i + 2];
}
} else {
let length = hue.length;
c = new Float32Array(length * 3);
for (let i = 0; i < length * 3; i += 3) {
c[i] = hue[index++];
c[i + 1] = colors[i + 1];
c[i + 2] = colors[i + 2];
}
}
this.setColors(c);
}
/**
* Update the hue of the points.
*
* @param {TypedArray|Number} hue The hue to be set. If a number is supplied, all hues are set to its value.
* @param {Number|Number[]} index The index or the indices of vertices to be set to a hue.
*/
updateHue(hue, index) {
index *= 3;
let colors = this.getAttribute('color');
let c = null;
if (index > colors.length - 1) {
console.warn('The color index is out of range.');
return;
}
if (typeof index === 'number') {
if (typeof hue !== 'number') {
console.warn('The hue value cannot be an array if index is a number.')
} else {
this.updateColor(index, new Lore.Color(hue, colors[index + 1], colors[index + 2]));
}
} else if (Array.isArray(index)) {
if (Array.isArray(hue)) {
if (hue.length !== index.length) {
console.warn('Hue and index arrays have to be of the same length.');
} else {
for (var i = 0; i < index.length; i++) {
this.updateColor(index[i], new Lore.Color(hue[i], colors[index + 1], colors[index + 2]));
}
}
} else if (typeof hue === 'number') {
for (var i = 0; i < index.length; i++) {
this.updateColor(index[i], new Lore.Color(hue, colors[index + 1], colors[index + 2]));
}
}
} else {
console.warn('The type of index is not supported: ' + (typeof index));
}
}
/**
* Set the saturation. If a number is supplied, all the saturations are set to the supplied number.
*
* @param {TypedArray|Number} hue The saturation to be set. If a number is supplied, all saturations are set to its value.
*/
setSaturation(saturation) {
let colors = this.getAttribute('color');
let c = null;
let index = 0;
if (typeof saturation === 'number') {
let length = colors.length;
c = new Float32Array(length * 3);
for (let i = 0; i < length * 3; i += 3) {
c[i] = colors[i];
c[i + 1] = saturation;
c[i + 2] = colors[i + 2];
}
} else {
let length = saturation.length;
c = new Float32Array(length * 3);
for (let i = 0; i < length * 3; i += 3) {
c[i] = colors[i];
c[i + 1] = saturation[index++];
c[i + 2] = colors[i + 2];
}
}
this.setColors(c);
}
/**
* Set the size. If a number is supplied, all the sizes are set to the supplied number.
*
* @param {TypedArray|Number} hue The size to be set. If a number is supplied, all sizes are set to its value.
*/
setSize(size) {
let colors = this.getAttribute('color');
let c = null;
let index = 0;
if (typeof size === 'number') {
let length = colors.length;
c = new Float32Array(length * 3);
for (let i = 0; i < length * 3; i += 3) {
c[i] = colors[i];
c[i + 1] = colors[i + 1];
c[i + 2] = size;
}
} else {
let length = size.length;
c = new Float32Array(length * 3);
for (let i = 0; i < length * 3; i += 3) {
c[i] = colors[i];
c[i + 1] = colors[i + 1];
c[i + 2] = size[index++];
}
}
this.setColors(c);
}
/**
* Set the HSS values. Sets all indices to the same values.
*
* @param {Number} hue A hue value.
* @param {Number} saturation A saturation value.
* @param {Number} size A size value.
* @param {Number} length The length of the arrays.
*/
setHSS(hue, saturation, size, length) {
let c = new Float32Array(length * 3);
for (let i = 0; i < length * 3; i += 3) {
c[i] = hue;
c[i + 1] = saturation;
c[i + 2] = size;
}
this.setColors(c);
}
/**
* Set the HSS values.
*
* @param {TypedArray} hue An array of hue values.
* @param {TypedArray} saturation An array of saturation values.
* @param {TypedArray} size An array of size values.
* @param {Number} length The length of the arrays.
*/
setHSSFromArrays(hue, saturation, size, length) {
let c = new Float32Array(length * 3);
let index = 0;
if (hue.length !== length && saturation.length !== length && size.length !== length) {
throw 'Hue, saturation and size have to be arrays of length "length" (' + length + ').';
}
for (let i = 0; i < length * 3; i += 3) {
c[i] = hue[index];
c[i + 1] = saturation[index];
c[i + 2] = size[index];
index++;
}
this.setColors(c);
}
/**
* Add a filter to this point helper.
*
* @param {String} name The name of the filter.
* @param {Lore.FilterBase} filter A filter instance.
* @returns {Lore.PointHelper} Itself.
*/
addFilter(name, filter) {
filter.setGeometry(this.geometry);
this.filters[name] = filter;
return this;
}
/**
* Remove a filter by name.
*
* @param {String} name The name of the filter to be removed.
* @returns {Lore.PointHelper} Itself.
*/
removeFilter(name) {
delete this.filters[name];
return this;
}
/**
* Get a filter by name.
*
* @param {String} name The name of a filter.
* @returns {Lore.FilterBase} A filter instance.
*/
getFilter(name) {
return this.filters[name];
}
}</code></pre>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Apr 24 2018 17:59:04 GMT+0200 (W. Europe Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>