Repository navigation
Expand file tree
/
Copy pathall.json
More file actions
3451 lines (3451 loc) · 161 KB
/
Copy pathall.json
File metadata and controls
3451 lines (3451 loc) · 161 KB
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
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"CanvasSpace": {
"cls": "CanvasSpace",
"description": "<h3>CanvasSpace is a space that represents a html canvas. It creates a new canvas or get an existing one in DOM by its <code>id</code> attribute. It also provide methods specific to html canvas, such as tracking resize and mouse position.</h3>",
"extend": "Space",
"file": "CanvasSpace.coffee",
"funcs": [
{
"description": "<h2>Create a CanvasSpace which represents a HTML Canvas Space</h2>",
"name": "CanvasSpace",
"param": [
"<p><code>id</code> an id property which refers to the \"id\" attribute of the canvas element in DOM. If no canvas element with this id is found, a new canvas element will be created.</p>",
"<p><code>bgcolor</code> a background color string to specify the canvas background. Default is <code>false</code> which shows a transparent background.</p>",
"<p><code>context</code> a string of canvas context type, such as \"2d\" or \"webgl\". Default is \"2d\"</p>"
],
"pname": "id='pt_space', bgcolor=false, context='2d'"
},
{
"description": "<h2>Place a new canvas element into a container dom element. When canvas is ready, a \"ready\" event will be fired. Track this event with <code>space.canvas.addEventListener(\"ready\")</code></h2>",
"name": "display",
"param": [
"<p><code>parent_id</code> the DOM element into which the canvas element should be appended</p>",
"<p><code>readyCallback</code> a callback function with parameters <code>width</code>, <code>height</code>, and <code>canvas_element</code>, which will get called when canvas is appended and ready.</p>",
"<p><code>devicePixelSupport</code> a boolean to set if device pixel scaling should be checked. This may make drawings on retina displays look sharper but may reduce performance slightly. Default is <code>true</code>.</p>"
],
"pname": "parent_id=\"#pt\", readyCallback, devicePixelSupport=true",
"return": "<p>this CanvasSpace</p>"
},
{
"description": "<h2>Set whether the canvas element should resize when its container is resized. Default will auto size</h2>",
"name": "autoResize",
"param": [
"<p><code>auto</code> a boolean value indicating if auto size is set. Default is <code>true</code>.</p>"
],
"pname": "auto=true",
"return": "<p>this CanvasSpace</p>"
},
{
"demo": "canvasspace.resize",
"description": "<h2>This overrides Space's <code>resize</code> function. It's a callback function for window's resize event. Keep track of this with <code>onSpaceResize(w,h,evt)</code> callback in your added objects.</h2>",
"name": "resize",
"param": [],
"pname": "w, h, evt",
"return": "<p>this CanvasSpace</p>"
},
{
"description": "<h2>Clear the canvas with its background color. Overrides Space's <code>clear</code> function.</h2>",
"name": "clear",
"param": [
"<p><code>bg</code> Optionally specify a custom background color. If evaluated to false, it will use its <code>bgcolor</code> property as background color.</p>"
],
"pname": "bg",
"return": "<p>this CanvasSpace</p>"
},
{
"description": "<h2>Overrides Space's <code>animate</code> function for canvas</h2>",
"name": "animate",
"param": [
"<p><code>time</code> current time</p>"
],
"pname": "time",
"return": "<p>this CanvasSpace</p>"
}
],
"props": [
{
"description": "<h2>A property to store canvas DOM element</h2>",
"name": "space",
"param": []
},
{
"description": "<h2>A boolean property to track if the canvas element is added to dom or not</h2>",
"name": "appended",
"param": []
}
],
"statics": []
},
"Circle": {
"cls": "Circle",
"description": "<h3>Imagine this shape: find a point in space, and draw a curve around it so that the distance between the point you picked and any points on that curve is the same. So by remembering how a circle can be constructed, and by considering PI not as a number but as a ratio, we can start to recognize all the expressive potentials of a circle.</h3>",
"extend": "Vector",
"file": "Circle.coffee",
"funcs": [
{
"description": "<h2>Create a new Circle. A Circle is a Vector which defines its center position, with a <code>radius</code> property to define its radius.</h2>",
"eg": "<p><code>new Circle()</code> <code>new Circle(1,2,3)</code> <code>new Circle(1,2,3,100)</code></p>",
"name": "Circle",
"param": [
"<p><code>args</code> Similar to Point constructor, use comma-separated values, an array, or a Point object as parameters to specify the center of circle. Optionally include a 4th parameter to set the radius directly, or use <code>setRadius()</code> afterwards.</p>"
],
"pname": "",
"return": "<p>a new Circle object</p>"
},
{
"description": "<h2>set radius of the circle</h2>",
"name": "setRadius",
"param": [
"<p><code>r</code> radius value</p>"
],
"pname": "r",
"return": "<p>this Circle</p>"
},
{
"demo": "circle.intersectPoint",
"description": "<h2>Check if a point is on this Circle on xy axis.</h2>",
"eg": "<p><code>circle.intersectPoint(1,2,3)</code> <code>circle.intersectPoint(pt)</code></p>",
"name": "intersectPoint",
"param": [
"<p><code>args</code> comma-separated values, or an array, or a Point object</p>"
],
"pname": "args",
"return": "<p>a boolean value to indicate if there is an intersection</p>"
},
{
"demo": "circle.intersectPath",
"description": "<h2>Check intersections between this Circle and an infinite Line on xy axis. Based on <a href=\"http://stackoverflow.com/questions/13053061/circle-line-intersection-points\">this algorithm</a>.</h2><p>@get_pts <code>get_pts</code> a boolean value to specify whether the results should include the intersection points. If <code>false</code>, then only the intersection state (true or false) will be returned.</p>",
"name": "intersectPath",
"param": [
"<p><code>path</code> a Pair or Line object to specify an infinite line</p>"
],
"pname": "path, get_pts=true",
"return": "<p>s an Array of intersection points (zero, one, or two points), or a boolean value. (Based on <code>get_pts</code> parameter)</p>"
},
{
"description": "<h2>Check intersections between this Circle and a Line segment on xy axis.</h2><p>@get_pts <code>get_pts</code> a boolean value to specify whether the results should include the intersection points. If <code>false</code>, then only the intersection state (true or false) will be returned.</p>",
"name": "intersectLine",
"param": [
"<p><code>line</code> a Pair or Line object to specify a line segment</p>"
],
"pname": "line, get_pts=true",
"return": "<p>s an Array of intersection points (zero, one, or two points), or a boolean value. (Based on <code>get_pts</code> parameter)</p>"
},
{
"description": "<h2>Check if this cirlce intersects with a set of lines ( useful for polygon or polyline such as <code>rectangle.sides()</code> ) on xy axis.</h2><p>@get_pts <code>get_pts</code> a boolean value to specify whether the results should include the intersection points. If <code>false</code>, then only the intersection state (true or false) will be returned.</p>",
"eg": "<p><code>circle.intersectLines( rect.sides() )</code> <code>circle.intersectLines( pointset.sides(), true )</code></p>",
"name": "intersectLines",
"param": [
"<p><code>lines</code> an array of Line</p>"
],
"pname": "lines, get_pts=true",
"return": "<p>s an Array of intersection points, or a boolean value. (Based on <code>get_pts</code> parameter)</p>"
},
{
"demo": "circle.intersectCircle",
"description": "<h2>Check if this circle intersects with another circle</h2><p>@get_pts <code>get_pts</code> a boolean value to specify whether the results should include the intersection points. If <code>false</code>, then only the intersection state (true or false) will be returned.</p>",
"name": "intersectCircle",
"param": [
"<p><code>circle</code> another Circle</p>"
],
"pname": "circle, get_pts=true",
"return": "<p>s an Array of intersection points (zero or two points) or a boolean value, based on <code>get_pts</code> parameter.</p>"
},
{
"description": "<h2>Check if this cirlce intersect with another element on xy axis</h2>",
"eg": "<p><code>circle.hasIntersect( another_circle )</code> <code>circle.hasIntersect(line)</code> <code>circle.hasIntersect(rect)</code></p>",
"name": "hasIntersect",
"param": [
"<p><code>item</code> any object that is based on Point. (Vector, Line, Rectangle, Circle, etc)</p>"
],
"pname": "item, get_pts=false",
"return": "<p>s an Array of intersection points or a boolean value. (Based on <code>get_pts</code> parameter)</p>"
},
{
"description": "<h2>Describe this point as a text string</h2>",
"name": "toString",
"param": [],
"pname": "",
"return": "<p>\"Vector x, y, z\" text</p>"
}
],
"props": [
{
"description": "<h2>the radius property</h2>",
"name": "radius",
"param": []
}
],
"statics": []
},
"Color": {
"cls": "Color",
"description": "<h3>Color is a sensation of electromagnetic radiation, but your mind interprets it with such obstinate attitude that your favorite color may be, god forbids, pink. Or perhaps color is more like music, whose harmony and rhythm evoke emotions, and can be organized in different sequences to create meaningful narratives.</h3>",
"extend": "Vector",
"file": "Color.coffee",
"funcs": [
{
"description": "<h2>Create a new Color. Color lets you define a color in a specific mode. <a href=\"https://software.intel.com/en-us/node/503873\">This article</a> from Intel has a good overview of different color models.</h2>",
"eg": "<p><code>new Color()</code> <code>new Color(255,100,20)</code> <code>new Color([2,4])</code> <code>new Color({x:3, y:6, z:9})</code> <code>new Color(360,1,1,0.5)</code>, <code>new Color(100,50,-50,1,'lab')</code></p>",
"name": "Color",
"param": [
"<p><code>args</code> Set the three values of a color as comma-separated values, as an array, or as an object with <code>{x, y, z}</code> properties. Optionally set <code>alpha</code> in a 4th parameter, and color mode string in 5th parameter.</p>"
],
"pname": "args",
"return": "<p>a new Color object</p>"
},
{
"description": "<h2>set a color mode and convert current color to new color mode</h2>",
"eg": "<p><code>color.setMode('lab')</code></p>",
"name": "setMode",
"param": [
"<p><code>m</code> a string to specify color mode: 'hsl', 'hsb', 'rgb', 'lab', 'lch', 'xyz'</p>"
],
"pname": "m",
"return": "<p>this Color object with new color mode</p>"
},
{
"description": "<h2>Get rgb value as hex string such as '#123456'</h2>",
"name": "hex",
"param": [],
"pname": ""
},
{
"description": "<h2>Get rgb string such as 'rgb(12,34,56)'</h2>",
"name": "rgb",
"param": [],
"pname": ""
},
{
"description": "<h2>Get rgba string such as 'rgba(12,34,56, 0.2)'</h2>",
"name": "rgba",
"param": [],
"pname": ""
},
{
"description": "<h2>Get color values (based on current color mode) as an array</h2>",
"name": "values",
"param": [
"<p><code>toRGB</code> Optional boolean value to convert to rgb value if set to <code>true</code>. Default is false.</p>"
],
"pname": "toRGB=false",
"return": "<p>an array of colro values</p>"
},
{
"description": "<h2>override clone</h2>",
"name": "clone",
"param": [],
"pname": ""
}
],
"props": [
{
"description": "<h2>alpha value from 0 to 1, where 0 is fully transparent, and 1 is fully opaque</h2>",
"name": "alpha",
"param": []
},
{
"description": "<h2>color mode id such as \"lab\" or \"rgb\"</h2>",
"name": "mode",
"param": []
},
{
"description": "<h2>A property to adject XYZ for Standard Observer 2deg, Daylight/sRGB illuminant D65</h2>",
"name": "XYZ",
"param": []
}
],
"statics": [
{
"description": "<h2>A static function <code>Color.RGBtoHSL</code> to convert RGB to HSL</h2>",
"eg": "<p><code>Color.RGBtoHSL(255,70,0)</code> <code>Color.RGBtoHSL(1,0.3,0, true)</code></p>",
"name": "RGBtoHSL",
"param": [
"<p><code>r, g, b</code> red, green, blue values from 0 to 255</p>",
"<p><code>normalizedInput, normalizedOutput</code> Optional boolean values to indicate if input parameters are normalized (0 to 1), and if return value should be normalized</p>"
],
"pname": "r, g, b, normalizedInput, normalizedOutput",
"return": "<p>an array of [h, s, l] where h is from 0 to 360, s is from 0 to 1, and l is from 0 to 1.</p>"
},
{
"demo": "color.HSLtoRGB",
"description": "<h2>A static function <code>Color.HSLtoRGB</code> to convert HSL to RGB</h2>",
"eg": "<p><code>Color.HSLtoRGB(360,0.7,0.9)</code> <code>Color.HSLtoRGB(1,0.3,0, true)</code></p>",
"name": "HSLtoRGB",
"param": [
"<p><code>h, s, l</code> hue, saturation, and lightness. hue value from 0 to 360, saturation and lightness values from 0 to 1</p>",
"<p><code>normalizedInput, normalizedOutput</code> Optional boolean values to indicate if input parameters are normalized (0 to 1), and if return value should be normalized</p>"
],
"pname": "h, s, l, normalizedInput, normalizedOutput",
"return": "<p>an array of [r, g, b] where each value is from 0 to 255</p>"
},
{
"description": "<h2>A static function <code>Color.RGBtoHSB</code> to convert RGB to HSB</h2>",
"eg": "<p><code>Color.RGBtoHSB(255,70,0)</code> <code>Color.RGBtoHSB(1,0.3,0, true)</code></p>",
"name": "RGBtoHSB",
"param": [
"<p><code>r, g, b</code> red, green, blue values from 0 to 255</p>",
"<p><code>normalizedInput, normalizedOutput</code> Optional boolean values to indicate if input parameters are normalized (0 to 1), and if return value should be normalized</p>"
],
"pname": "r, g, b, normalizedInput, normalizedOutput",
"return": "<p>an array of [h, s, b] where h is from 0 to 360, s is from 0 to 1, and b is from 0 to 1.</p>"
},
{
"demo": "color.HSBtoRGB",
"description": "<h2>A static function <code>Color.HSBtoRGB</code> to convert HSB to RGB</h2>",
"eg": "<p><code>Color.HSBtoRGB(360,0.7,0.9)</code> <code>Color.HSBtoRGB(1,0.3,0, true)</code></p>",
"name": "HSBtoRGB",
"param": [
"<p><code>h, s, b</code> hue, saturation, and brightness. hue value from 0 to 360, saturation and brightness values from 0 to 1</p>",
"<p><code>normalizedInput, normalizedOutput</code> Optional boolean values to indicate if input parameters are normalized (0 to 1), and if return value should be normalized</p>"
],
"pname": "h, s, v, normalizedInput, normalizedOutput",
"return": "<p>an array of [r, g, b] where each value is from 0 to 255</p>"
},
{
"description": "<h2>Static function <code>Color.RGBtoLAB</code> transforms RGB to LAB</h2>",
"name": "RGBtoLAB",
"param": [
"<p><code>r, g, b</code> red, green, and blue values from 0 to 255</p>",
"<p><code>normalizedInput, normalizedOutput</code> Optional boolean values to indicate if input parameters are normalized (0 to 1), and if return value should be normalized</p>"
],
"pname": "r, g, b, normalizedInput, normalizedOutput",
"return": "<p>an array of [L, a, b] where lightness (L) is from 0 to 100, a and b component values are from -128 to 127. red/green colors are represented in a, and yellow/blue colors are represented in b.</p>"
},
{
"demo": "color.LABtoRGB",
"description": "<h2>Static function <code>Color.LABtoRGB</code> transforms LAB to RGB</h2>",
"name": "LABtoRGB",
"param": [
"<p><code>L, a, b</code> lightness (L) is from 0 to 100, a and b component values are from -128 to 127. red/green colors are represented in a, and yellow/blue colors are represented in b.</p>",
"<p><code>normalizedInput, normalizedOutput</code> Optional boolean values to indicate if input parameters are normalized (0 to 1), and if return value should be normalized</p>"
],
"pname": "L, a, b, normalizedInput, normalizedOutput",
"return": "<p>an array of [r, g, b] where each value is from 0 to 255</p>"
},
{
"description": "<h2>Static function <code>Color.RGBtoLCH</code> transforms RGB to LCH (Cylindrical Lab)</h2>",
"name": "RGBtoLCH",
"param": [
"<p><code>r, g, b</code> red, green, and blue values from 0 to 255</p>",
"<p><code>normalizedInput, normalizedOutput</code> Optional boolean values to indicate if input parameters are normalized (0 to 1), and if return value should be normalized</p>"
],
"pname": "r, g, b, normalizedInput, normalizedOutput",
"return": "<p>an array of [L, c, h] where lightness (l) and chroma (c) is from 0 to 100, and hue (h) is from 0 to 360</p>"
},
{
"description": "<h2>Static function <code>Color.LCHtoRGB</code> transforms LCH to RGB</h2>",
"name": "LCHtoRGB",
"param": [
"<p><code>L, c, h</code> lightness (l) and chroma (c) is from 0 to 100, and hue (h) is from 0 to 360</p>"
],
"pname": "L, c, h, normalizedInput, normalizedOutput",
"return": "<p>an array of [r, g, b] where each value is from 0 to 255</p>"
},
{
"description": "<h2>Static function <code>Color.XYZtoRGB</code> to convert XYZ to RGB. This is usually used when converting between LAB and RGB.</h2>",
"name": "XYZtoRGB",
"param": [
"<p><code>x, y, z</code> x, y, z values from 0 to 100</p>",
"<p><code>normalizedInput, normalizedOutput</code> Optional boolean values to indicate if input parameters are normalized (0 to 1), and if return value should be normalized</p>"
],
"pname": "x, y, z, normalizedInput, normalizedOutput",
"return": "<p>an array of [r, g, b] where each value is from 0 to 255</p>"
},
{
"description": "<h2>A static function <code>Color.RGBtoXYZ</code> to convert RGB to XYZ. This is usually used when converting between LAB and RGB.</h2>",
"name": "RGBtoXYZ",
"param": [
"<p><code>r, g, b</code> red, green, blue values from 0 to 255</p>",
"<p><code>normalizedInput, normalizedOutput</code> Optional boolean values to indicate if input parameters are normalized (0 to 1), and if return value should be normalized</p>"
],
"pname": "r, g, b, normalizedInput, normalizedOutput",
"return": "<p>an array of [x, y, z] where each value is from 0 to 100</p>"
},
{
"description": "<h2>Static function <code>Color.XYZtoLAB</code> to convert XYZ to LAB.</h2>",
"name": "XYZtoLAB",
"param": [
"<p><code>x, y, z</code> x, y, z values from 0 to 100</p>"
],
"pname": "x, y, z",
"return": "<p>an array of [l, a, b] where lightness (L) is from 0 to 100, a and b values are from -128 to 127</p>"
},
{
"description": "<h2>Static function <code>Color.LABtoXYZ</code> to convert LAB to XYZ.</h2>",
"name": "LABtoXYZ",
"param": [
"<p><code>L, a, b</code> lightness (L) is from 0 to 100, a and b component values are from -128 to 127</p>"
],
"pname": "L, a, b",
"return": "<p>an array of [x, y, z] where each value is from 0 to 100</p>"
},
{
"description": "<h2>Static function <code>Color.XYZtoLUV</code> to convert XYZ to LUV.</h2>",
"name": "XYZtoLUV",
"param": [
"<p><code>x, y, z</code> x, y, z values from 0 to 100</p>"
],
10BC8
"pname": "x, y, z",
"return": "<p>an array of [l, u, v] where lightness is from 0 to 100, u is from -134 to 220, and v is from -140 o 122</p>"
},
{
"description": "<h2>Static function <code>Color.LUVtoXYZ</code> to convert LUV to XYZ.</h2>",
"name": "LUVtoXYZ",
"param": [
"<p><code>L, u, v</code> lightness (L) is from 0 to 100, u is from -134 to 220, and v is from -140 o 122</p>"
],
"pname": "L, u, v",
"return": "<p>an array of [x, y, z] where each value is from 0 to 100</p>"
},
{
"description": "<h2>Static function <code>Color.LABtoLCH</code> transforms LAB to Cylindrical LCH</h2>",
"name": "LABtoLCH",
"param": [
"<p><code>L, a, b</code> lightness (L) is from 0 to 100, a and b component values are from -128 to 127</p>"
],
"pname": "L, a, b",
"return": "<p>an array of [l, c, h] where lightness (l) and chroma (c) is from 0 to 100, and hue (h) is from 0 to 360</p>"
},
{
"description": "<h2>Static function <code>Color.LCHtoLAB</code> transforms Cylindrical LCH to LAB</h2>",
"name": "LCHtoLAB",
"param": [
"<p><code>L, c, h</code> lightness (L) and chroma (c) is from 0 to 100, and hue (h) is from 0 to 360</p>"
],
"pname": "L, c, h",
"return": "<p>an array of [l, a, b] where lightness (L) is from 0 to 100, a and b values are from -128 to 127</p>"
},
{
"description": "<h2>Static function <code>Color.LUVtoLCH</code> to convert LUV to LCH.</h2>",
"name": "LUVtoLCH",
"param": [
"<p><code>L, u, v</code> lightness (L) is from 0 to 100, u is from -134 to 220, and v is from -140 o 122</p>"
],
"pname": "L, u, v",
"return": "<p>an array of [l, c, h] where lightness (l) and chroma (c) is from 0 to 100, and hue (h) is from 0 to 360</p>"
},
{
"description": "<h2>Static function <code>Color.LCHtoLUV</code> transforms Cylindrical LCH to LUV</h2>",
"name": "LCHtoLUV",
"param": [
"<p><code>L, c, h</code> lightness (L) and chroma (c) is from 0 to 100, and hue (h) is from 0 to 360</p>"
],
"pname": "L, c, h",
"return": "<p>an array of [l, u, v] where lightness is from 0 to 100, u is from -134 to 220, and v is from -140 o 122</p>"
}
]
},
"Const": {
"cls": "Const",
"description": "<h3>A list of useful constant values for calculations and labeling.</h3>",
"extend": "",
"file": "Const.coffee",
"funcs": [],
"props": [
{
"description": "<h2>represents the xy plane</h2>",
"name": "xy",
"param": []
},
{
"description": "<h2>represents the yz plane</h2>",
"name": "yz",
"param": []
},
{
"description": "<h2>reporesents the xz plane</h2>",
"name": "xz",
"param": []
},
{
"description": "<h2>represents xyz space</h2>",
"name": "xyz",
"param": []
},
{
"description": "<h2>represents identical point or value</h2>",
"name": "identical",
"param": []
},
{
"description": "<h2>represents right position or direction</h2>",
"name": "right",
"param": []
},
{
"description": "<h2>represents bottom right position or direction</h2>",
"name": "bottom_right",
"param": []
},
{
"description": "<h2>represents bottom position or direction</h2>",
"name": "bottom",
"param": []
},
{
"description": "<h2>represents bottom left position or direction</h2>",
"name": "bottom_left",
"param": []
},
{
"description": "<h2>represents left position or direction</h2>",
"name": "left",
"param": []
},
{
"description": "<h2>represents top left position or direction</h2>",
"name": "top_left",
"param": []
},
{
"description": "<h2>represents top position or direction</h2>",
"name": "top",
"param": []
},
{
"description": "<h2>represents top right position or direction</h2>",
"name": "top_right",
"param": []
},
{
"description": "<h2>an array of strings to label position constants above. Eg, <code>Const.sideLabels[ Const.top_left]</code> will return the string \"top left\"</h2>",
"name": "sideLabels",
"param": []
},
{
"description": "<h2>represents an arbitrary very small number. It is set as 0.0001 here.</h2>",
"name": "epsilon",
"param": []
},
{
"description": "<h2>pi radian (180 deg)</h2>",
"name": "pi",
"param": []
},
{
"description": "<h2>two pi radian (360deg)</h2>",
"name": "two_pi",
"param": []
},
{
"description": "<h2>half pi radian (90deg)</h2>",
"name": "half_pi",
"param": []
},
{
"description": "<h2>pi/4 radian (45deg)</h2>",
"name": "quarter_pi",
"param": []
},
{
"description": "<h2>pi/180 = 1 degree in radian</h2>",
"name": "one_degree",
"param": []
},
{
"description": "<h2>multiply this constant with a radian to get a degree</h2>",
"name": "rad_to_deg",
"param": []
},
{
"description": "<h2>multiply this constant with a degree to get a radian</h2>",
"name": "deg_to_rad",
"param": []
},
{
"description": "<h2>Gravity acceleration (unit = m/s^2) and gravity force (unit = Newton) on 1kg of mass.</h2>",
"name": "gravity",
"param": []
},
{
"description": "<h2>1 Newton = 0.10197 Kilogram-force</h2>",
"name": "newton",
"param": []
},
{
"description": "<h2>Gaussian constant (1 / Math.sqrt(2 * Math.PI))</h2>",
"name": "gaussian",
"param": []
}
],
"statics": []
},
"Curve": {
"cls": "Curve",
"description": "<h3>A straight line or a moving particle, swayed by external forces or internal constraints, gradually deviates from its ideal path and becomes a curve. A river meanders and a strain of hair curls. A curve expresses the effects of forces and constraints.</h3>",
"extend": "PointSet",
"file": "Curve.coffee",
"funcs": [
{
"description": "<h2>Create a new Curve. A Curve uses a set of anchor and/or control points to interpolate a curve.</h2>",
"eg": "<p><code>new PointSet()</code> <code>new PointSet(1,2,3)</code> <code>new PointSet([2,4])</code> <code>new PointSet({x:3, y:6, z:9}).to(1,2,3)</code> <code>new PointSet(1,2,3).to([p1, p2, p3, p4, p5])</code></p>",
"name": "Curve",
"param": [
"<p><code>args</code> Similar to PointSet constructor, use comma-separated values, an array, or an object as parameters to specify the anchor point. Use <code>to()</code> to add points to the set.</p>"
],
"pname": "",
"return": "<p>a new Curve object</p>"
},
{
"description": "<h2>Given an index for the starting position in <code>points</code> array, get the control and/or end points of a curve segment</h2>",
"name": "controlPoints",
"param": [
"<p><code>index</code> start index in <code>points</code> array. Default is 0.</p>",
"<p><code>copyStart</code> an optional boolean value to indicate if the start index should be used twice. Default is false.</p>"
],
"pname": "index=0, copyStart=false",
"return": "<p>an object with 4 points <code>{p0, p1, p2, p3}</code></p>"
},
{
"description": "<h2>Create a Catmull-Rom curve. Catmull-Rom is a kind of Cardinal curve with smooth-looking curve.</h2>",
"name": "catmullRom",
"param": [
"<p><code>step</code> the number of line segments. Defaults to 10 steps.</p>"
],
"pname": "steps=10",
"return": "<p>an array of Points</p>"
},
{
"description": "<h2>Interpolate to get a point on Catmull-Rom curve</h2>",
"name": "catmullRomPoint",
"param": [
"<p><code>step</code> the point to interpolate, as an array of <code>[t, t*t, t*t*t]</code> where <code>t</code> is between 0 to 1</p>",
"<p><code>ctrls</code> the control points which can be provided by <code>controlPoints()</code> function</p>"
],
"pname": "step, ctrls",
"return": "<p>a Point on the curve</p>"
},
{
"demo": "curve.cardinal",
"description": "<h2>Create a Cardinal spline curve</h2>",
"name": "cardinal",
"param": [
"<p><code>step</code> the number of line segments. Defaults to 10 steps.</p>",
"<p><code>tension</code> optional value between 0 to 1 to specify a \"tension\". Default to 0.5 which is the tension for Catmull-Rom curve</p>"
],
"pname": "steps=10, tension=0.5",
"return": "<p>an array of Points</p>"
},
{
"description": "<h2>Interpolate to get a point on Cardinal curve</h2>",
"name": "cardinalPoint",
"param": [
"<p><code>step</code> the point to interpolate, as an array of <code>[t, t*t, t*t*t]</code> where <code>t</code> is between 0 to 1</p>",
"<p><code>ctrls</code> the control points which can be provided by <code>controlPoints()</code> function</p>",
"<p&
10BC8
gt;<code>tension</code> optional value between 0 to 1 to specify a \"tension\". Default to 0.5 which is the tension for Catmull-Rom curve</p>"
],
"pname": "step, ctrls, tension=0.5",
"return": "<p>a Point on the curve</p>"
},
{
"demo": "curve.bezier",
"description": "<h2>Create a Bezier curve. In a cubic bezier curve, the first and 4th points are end points, and 2nd and 3rd points are control points.</h2>",
"name": "bezier",
"param": [
"<p><code>step</code> the number of line segments. Defaults to 10 steps</p>"
],
"pname": "steps=10",
"return": "<p>an array of Points</p>"
},
{
"description": "<h2>Interpolate to get a point on a cubic Bezier curve</h2>",
"name": "bezierPoint",
"param": [
"<p><code>step</code> the point to interpolate, as an array of <code>[t, t*t, t*t*t]</code> where <code>t</code> is between 0 to 1</p>",
"<p><code>ctrls</code> the control and end points which can be provided by <code>controlPoints()</code> function. The first and 4th points are end points, and 2nd and 3rd points are control points.</p>"
],
"pname": "step, ctrls",
"return": "<p>a Point on the curve</p>"
},
{
"demo": "curve.bspline",
"description": "<h2>Create a B-Spline cuve</h2>",
"name": "bspline",
"param": [
"<p><code>step</code> the number of line segments. Defaults to 10 steps.</p>",
"<p><code>tension</code> optional value between 0 to 1 to specify a \"tension\". Or <code>false</code> to have normal tension. Default is false.</p>"
],
"pname": "steps=10, tension=false",
"return": "<p>an array of Points</p>"
},
{
"description": "<h2>Interpolate to get a point on B-Spline curve</h2>",
"name": "bsplinePoint",
"param": [
"<p><code>step</code> the point to interpolate, as an array of <code>[t, t*t, t*t*t]</code> where <code>t</code> is between 0 to 1</p>",
"<p><code>ctrls</code> the control points which can be provided by <code>controlPoints()</code> function</p>"
],
"pname": "step, ctrls",
"return": "<p>a Point on the curve</p>"
},
{
"description": "<h2>Interpolate to get a point on B-Spline curve with tension (Duff)</h2>",
"name": "bsplineTensionPoint",
"param": [
"<p><code>step</code> the point to interpolate, as an array of <code>[t, t*t, t*t*t]</code> where <code>t</code> is between 0 to 1</p>",
"<p><code>ctrls</code> the control points which can be provided by <code>controlPoints()</code> function</p>",
"<p><code>tension</code> optional value between 0 to 1 to specify a \"tension\". Default to 1 which is the normal tension.</p>"
],
"pname": "step, ctrls, tension=1",
"return": "<p>a Point on the curve</p>"
}
],
"props": [
{
"description": "<h2>a boolean value to specify if this Curve is 2D or 3D. Default is <code>false</code> (2D).</h2>",
"name": "is3D",
"param": []
}
],
"statics": []
},
"DOMSpace": {
"cls": "DOMSpace",
"description": "<h3>DOMSpace is a space that represents a html dom. It is similar to <code>CanvasSpace</code> but usually used as a space for SVG or HTML.</h3>",
"extend": "Space",
"file": "DOMSpace.coffee",
"funcs": [
{
"description": "<h2>Create a DOMSpace which represents a HTML DOM</h2>",
"name": "DOMSpace",
"param": [
"<p><code>id</code> an id property which refers to the \"id\" attribute of the element in DOM.</p>",
"<p><code>bgcolor</code> a background color string to specify the background. Default is <code>false</code> which shows a transparent background.</p>",
"<p><code>context</code> a string of dom context type, such as \"html\" or \"svg\". Default is \"html\"</p>"
],
"pname": "id='pt_space', bgcolor=false, context='html'"
},
{
"description": "<h2>Place a new canvas element into a container dom element. When canvas is ready, a \"ready\" event will be fired. Track this event with <code>space.canvas.addEventListener(\"ready\")</code></h2>",
"name": "display",
"param": [
"<p><code>parent_id</code> the DOM element into which the canvas element should be appended</p>",
"<p><code>readyCallback</code> a callback function with parameters <code>width</code>, <code>height</code>, and <code>canvas_element</code>, which will get called when canvas is appended and ready.</p>"
],
"pname": "parent_id=\"#pt\", readyCallback",
"return": "<p>this CanvasSpace</p>"
},
{
"description": "<h2>Set whether the canvas element should resize when its container is resized. Default will auto size</h2>",
"name": "autoResize",
"param": [
"<p><code>auto</code> a boolean value indicating if auto size is set. Default is <code>true</code>.</p>"
],
"pname": "auto=true",
"return": "<p>this CanvasSpace</p>"
},
{
"demo": "canvasspace.resize",
"description": "<h2>This overrides Space's <code>resize</code> function. It's a callback function for window's resize event. Keep track of this with <code>onSpaceResize(w,h,evt)</code> callback in your added objects.</h2>",
"name": "resize",
"param": [],
"pname": "w, h, evt",
"return": "<p>this CanvasSpace</p>"
},
{
"description": "<h2>Overrides Space's <code>animate</code> function</h2>",
"name": "animate",
"param": [
"<p><code>time</code> current time</p>"
],
"pname": "time",
"return": "<p>this CanvasSpace</p>"
}
],
"props": [
{
"description": "<h2>A property to store the DOM element</h2>",
"name": "space",
"param": []
},
{
"description": "<h2>A boolean property to track if the element is added to container or not</h2>",
"name": "appended",
"param": []
}
],
"statics": []
},
"Form": {
"cls": "Form",
"description": "<h3>Form makes visible the invisible. It transforms a point into an inkblot, or an arrow, or a musical note. By separating forms from its concepts, we may create a myriad of expressions on a single concept, or apply a unified style to various concepts. The Form class provides basic method to draw points, lines, and other primitives on CanvasSpace. Extend this class to visualize in different ways in different contexts.</h3>",
"extend": "",
"file": "Form.coffee",
"funcs": [
{
"description": "<h2>Create a new Form which is based on HTML Canvass</h2>",
"name": "Form",
"param": [
"<p><code>space</code> A space that has a valid context for this form. In this case, the space should represent an html canvas.</p>"
],
"pname": "space",
"return": "<p>a new Form object</p>"
},
{
"demo": "form.fill",
"description": "<h2>Set current fill style</h2>",
"eg": "<p><code>form.fill(\"#F90\")</code> <code>form.fill(\"rgba(0,0,0,.5\")</code> <code>form.fill(false)</code></p>",
"name": "fill",
"param": [
"<p><code>c</code> fill color which can be as color, gradient, or pattern. (See <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle\">canvas documentation</a>) Default is <code>false</code> (transparent)</p>"
],
"pname": "c",
"return": "<p>this Form</p>"
},
{
"description": "<h2>Set current stroke style</h2>",
"eg": "<p><code>form.stroke(\"#F90\")</code> <code>form.stroke(\"rgba(0,0,0,.5\")</code> <code>form.stroke(false)</code> <code>form.stroke(\"#000\", 0.5, 'round')</code></p>",
"name": "stroke",
"param": [
"<p><code>c</code> stroke color which can be as color, gradient, or pattern. (See <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/strokeStyle\">canvas documentation</a>) Default is false (transparent)</p>",
"<p><code>width</code> Optional value (can be floating point) to set line width</p>",
"<p><code>joint</code> Optional string to set line joint style. Can be \"miter\", \"bevel\", or \"round\".</p>"
],
"pname": "c, width, joint",
"return": "<p>this Form</p>"
},
{
"demo": "form.font",
"description": "<h2>Set font size and font face</h2>",
"eg": "<p><code>form.font(24)</code> <code>form.font(12, \"Georgia\")</code></p>",
"name": "font",
"param": [
"<p><code>size</code> an integer value to specify font size in pixels</p>",
"<p><code>face</code> optional name to change the font face, such as \"sans-serif\" or \"Helvetica\"</p>"
],
"pname": "size, face=@fontFace",
"return": "<p>this Form</p>"
},
{
"description": "<h2>Draw a shape. Defaults to <code>sketch()</code>. Override this function to draw differently.</h2>",
"name": "draw",
"param": [],
"pname": "shape",
"return": "<p>this Form</p>"
},
{
"description": "<h2>Default draw based on the types of shape (Point, Line, Circle, etc)</h2>",
"name": "sketch",
"param": [
"<p><code>shape</code> any shape such as <code>Point</code> or <code>Line</code>, or an array of Points</p>"
],
"pname": "shape",
"return": "<p>this Form</p>"
},
{
"description": "<h2>Draw a point</h2>",
"name": "point",
"param": [
"<p><code>p</code> a Point object</p>",
"<p><code>halfsize</code> radius or half size of the point. Default is 2.</p>",
"<p><code>isCircle</code> a boolean value to specify if the point should be drawn as a circle. Default is false.</p>"
],
"pname": "p, halfsize=2, isCircle=false",
"return": "<p>this Form</p>"
},
{
"demo": "form.points",
"description": "<h2>Draw a series of points</h2>",
"name": "points",
"param": [
"<p><code>ps</code> an array of Points</p>",
"<p><code>halfsize</code> radius or half size of the point. Default is 2.</p>",
"<p><code>isCircle</code> a boolean value to specify if the point should be drawn as a circle. Default is false.</p>"
],
"pname": "ps, halfsize=2, isCircle=false",
"return": "<p>this Form</p>"
},
{
"description": "<h2>Draw a line</h2>",
"name": "line",
"param": [
"<p><code>p</code> a Pair object</p>"
],
"pname": "p",
"return": "<p>this Form</p>"
},
{
"description": "<h2>Draw a series of lines</h2>",
"name": "lines",
"param": [
"<p><code>ps</code> an array of Lines</p>"
],
"pname": "ps",
"return": "<p>this Form</p>"
},
{
"description": "<h2>Draw a rectangle</h2>",
"name": "rect",
"param": [
"<p><code>p</code> a Pair object</p>"
],
"pname": "p",
"return": "<p>this Form</p>"
},
{
"description": "<h2>Draw a circle</h2>",
"name": "circle",
"param": [
"<p><code>p</code> a Circle object</p>"
],
"pname": "p",
"return": "<p>this Form</p>"
},
{
"description": "<h2>Draw an arc</h2>",
"name": "arc",
"param": [
"<p><code>p</code> a Circle object</p>",
"<p><code>start</code> start angle</p>",
"<p><code>end</code> end angle</p>"
],
"pname": "p, start, end",
"return": "<p>this Form</p>"
},
{
"description": "<h2>Draw a triangle</h2>",
"name": "triangle",
"param": [
"<p><code>p</code> a Triangle object</p>"
],
"pname": "p",
"return": "<p>this Form</p>"
},
{
"description": "<h2>Draw a polygon</h2>",
"name": "polygon",
"param": [
"<p><code>ps</code> an array of Points</p>",
"<p><code>closePath</code> a boolean value to specify if the path should be closed (joining last point with first point)</p>"
],
"pname": "ps, closePath",
"return": "<p>this Form</p>"
},
{
"demo": "form.curve",
"description": "<h2>Draw a curve</h2>",
"name": "curve",
"param": [
"<p><code>ps</code> an array of Points</p>"
],
"pname": "ps",
"return": "<p>this Form</p>"
},
{
"description": "<h2>Draw text</h2>",
"name": "text",
"param": [
"<p><code>p</code> a Point to specify anchor position</p>",
"<p><code>txt</code> a string of text</p>",
"<p><code>maxWidth</code> maximum width per line</p>",
"<p><code>xoff, yoff</code> x and y positional offset values</p>"
],
"pname": "p, txt, maxWidth=1000, xoff, yoff"
}
],
"props": [
{
"description": "<h2>a property to reference the space</h2>",
"name": "space",
"param": []
},
{
"description": "<h2>a property to reference the canvas rendering context</h2>",
"name": "cc",
"param": []
},
{
"description": "<h2>a boolean property to set if the next drawing should be filled with current fill style</h2>",
"name": "filled",
"param": []
},
{
"description": "<h2>a boolean property to set if the next drawing should be stroked with current stroke style</h2>",
"name": "stroked",
"param": []
},
{
"description": "<h2>a property to specify the current font size</h2>",
"name": "fontSize",
"param": []
},
{
"description": "<h2>a property to specify the current font face</h2>",
"name": "fontFace",
"param": []
}
],
"statics": [
{
"description": "<h2>A static function to get 2d context from a canvas element in the DOM</h2>",
"eg": "<p><code>Form.context('my_canvas')</code></p>",
"name": "context",
"param": [
"<p><code>canvas_id</code> the id attribute of the canvas element</p>"
],
"pname": "canvas_id",
"return": "<p>a canvas rendering context object</p>"
},
{
"description": "<h2>A static function to draw a line</h2>",
"name": "line",
"param": [
"<p><code>ctx</code> canvas rendering context</p>",
"<p><code>pair</code> a Pair object</p>"
],
"pname": "ctx, pair"
},
{
"description": "<h2>A static function to draw a line</h2>",