geomerative 1.1.0-java → 2.0.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.mvn/extensions.xml +1 -1
- data/.mvn/wrapper/maven-wrapper.properties +1 -1
- data/CHANGELOG.md +3 -0
- data/COPYING.md +1 -1
- data/README.md +0 -1
- data/Rakefile +2 -15
- data/docs/_includes/header.html +6 -6
- data/docs/_includes/icon-github.svg +3 -1
- data/docs/_includes/icon-twitter.svg +3 -1
- data/docs/_includes/navigation.html +18 -18
- data/docs/_sass/_base.scss +79 -79
- data/docs/_sass/_layout.scss +137 -137
- data/docs/_sass/_syntax-highlighting.scss +64 -64
- data/docs/index.html +18 -18
- data/examples/data/bot1.svg +1 -1
- data/examples/data/lion.svg +156 -156
- data/examples/data/ruby.svg +1 -1
- data/geomerative.gemspec +1 -2
- data/lib/geomerative/version.rb +1 -1
- data/mvnw +234 -0
- data/mvnw.cmd +145 -0
- data/pom.rb +14 -13
- data/pom.xml +14 -13
- data/src/geomerative/FastRClip.java +2149 -2156
- data/src/geomerative/RClip.java +2237 -2539
- data/src/geomerative/RClosest.java +33 -31
- data/src/geomerative/RCommand.java +1750 -1758
- data/src/geomerative/RContour.java +290 -292
- data/src/geomerative/RFont.java +277 -246
- data/src/geomerative/RG.java +722 -727
- data/src/geomerative/RGeomElem.java +967 -960
- data/src/geomerative/RGroup.java +508 -467
- data/src/geomerative/RMatrix.java +304 -289
- data/src/geomerative/RMesh.java +241 -229
- data/src/geomerative/RPath.java +924 -925
- data/src/geomerative/RPoint.java +391 -391
- data/src/geomerative/RPolygon.java +998 -988
- data/src/geomerative/RRectangle.java +43 -52
- data/src/geomerative/RSVG.java +480 -516
- data/src/geomerative/RShape.java +1767 -1777
- data/src/geomerative/RStrip.java +173 -176
- data/src/geomerative/RStyle.java +197 -194
- data/src/org/apache/batik/svggen/font/Font.java +141 -142
- data/src/org/apache/batik/svggen/font/Glyph.java +102 -71
- data/src/org/apache/batik/svggen/font/Point.java +12 -12
- data/src/org/apache/batik/svggen/font/RandomAccessFileEmulator.java +14 -12
- data/src/org/apache/batik/svggen/font/table/ClassDef.java +12 -12
- data/src/org/apache/batik/svggen/font/table/ClassDefFormat1.java +27 -24
- data/src/org/apache/batik/svggen/font/table/ClassDefFormat2.java +20 -17
- data/src/org/apache/batik/svggen/font/table/CmapFormat.java +43 -43
- data/src/org/apache/batik/svggen/font/table/CmapFormat0.java +33 -26
- data/src/org/apache/batik/svggen/font/table/CmapFormat2.java +25 -20
- data/src/org/apache/batik/svggen/font/table/CmapFormat4.java +106 -96
- data/src/org/apache/batik/svggen/font/table/CmapFormat6.java +36 -32
- data/src/org/apache/batik/svggen/font/table/CmapIndexEntry.java +69 -49
- data/src/org/apache/batik/svggen/font/table/CmapTable.java +50 -50
- data/src/org/apache/batik/svggen/font/table/Coverage.java +19 -19
- data/src/org/apache/batik/svggen/font/table/CoverageFormat1.java +30 -27
- data/src/org/apache/batik/svggen/font/table/CoverageFormat2.java +26 -24
- data/src/org/apache/batik/svggen/font/table/CvtTable.java +16 -16
- data/src/org/apache/batik/svggen/font/table/Device.java +32 -32
- data/src/org/apache/batik/svggen/font/table/DirectoryEntry.java +39 -39
- data/src/org/apache/batik/svggen/font/table/Feature.java +26 -23
- data/src/org/apache/batik/svggen/font/table/FeatureList.java +37 -35
- data/src/org/apache/batik/svggen/font/table/FeatureRecord.java +22 -22
- data/src/org/apache/batik/svggen/font/table/FeatureTags.java +4 -3
- data/src/org/apache/batik/svggen/font/table/FpgmTable.java +9 -9
- data/src/org/apache/batik/svggen/font/table/GlyfCompositeComp.java +134 -132
- data/src/org/apache/batik/svggen/font/table/GlyfCompositeDescript.java +123 -122
- data/src/org/apache/batik/svggen/font/table/GlyfDescript.java +44 -44
- data/src/org/apache/batik/svggen/font/table/GlyfSimpleDescript.java +110 -109
- data/src/org/apache/batik/svggen/font/table/GlyfTable.java +46 -46
- data/src/org/apache/batik/svggen/font/table/GlyphDescription.java +25 -13
- data/src/org/apache/batik/svggen/font/table/GposTable.java +26 -23
- data/src/org/apache/batik/svggen/font/table/GsubTable.java +85 -82
- data/src/org/apache/batik/svggen/font/table/HeadTable.java +131 -131
- data/src/org/apache/batik/svggen/font/table/HheaTable.java +80 -80
- data/src/org/apache/batik/svggen/font/table/HmtxTable.java +50 -49
- data/src/org/apache/batik/svggen/font/table/KernSubtable.java +29 -27
- data/src/org/apache/batik/svggen/font/table/KernSubtableFormat0.java +35 -32
- data/src/org/apache/batik/svggen/font/table/KernSubtableFormat2.java +28 -26
- data/src/org/apache/batik/svggen/font/table/KernTable.java +36 -31
- data/src/org/apache/batik/svggen/font/table/KerningPair.java +27 -23
- data/src/org/apache/batik/svggen/font/table/LangSys.java +28 -26
- data/src/org/apache/batik/svggen/font/table/LangSysRecord.java +22 -22
- data/src/org/apache/batik/svggen/font/table/Ligature.java +24 -24
- data/src/org/apache/batik/svggen/font/table/LigatureSet.java +24 -24
- data/src/org/apache/batik/svggen/font/table/LigatureSubst.java +9 -9
- data/src/org/apache/batik/svggen/font/table/LigatureSubstFormat1.java +30 -30
- data/src/org/apache/batik/svggen/font/table/LocaTable.java +37 -37
- data/src/org/apache/batik/svggen/font/table/Lookup.java +41 -40
- data/src/org/apache/batik/svggen/font/table/LookupList.java +34 -34
- data/src/org/apache/batik/svggen/font/table/LookupSubtableFactory.java +7 -5
- data/src/org/apache/batik/svggen/font/table/MaxpTable.java +96 -96
- data/src/org/apache/batik/svggen/font/table/NameRecord.java +64 -65
- data/src/org/apache/batik/svggen/font/table/NameTable.java +33 -33
- data/src/org/apache/batik/svggen/font/table/Os2Table.java +196 -196
- data/src/org/apache/batik/svggen/font/table/Panose.java +14 -12
- data/src/org/apache/batik/svggen/font/table/PostTable.java +338 -338
- data/src/org/apache/batik/svggen/font/table/PrepTable.java +9 -9
- data/src/org/apache/batik/svggen/font/table/Program.java +15 -15
- data/src/org/apache/batik/svggen/font/table/RangeRecord.java +26 -25
- data/src/org/apache/batik/svggen/font/table/Script.java +38 -38
- data/src/org/apache/batik/svggen/font/table/ScriptList.java +42 -42
- data/src/org/apache/batik/svggen/font/table/ScriptRecord.java +22 -22
- data/src/org/apache/batik/svggen/font/table/ScriptTags.java +2 -1
- data/src/org/apache/batik/svggen/font/table/SingleSubst.java +15 -16
- data/src/org/apache/batik/svggen/font/table/SingleSubstFormat1.java +33 -33
- data/src/org/apache/batik/svggen/font/table/SingleSubstFormat2.java +32 -32
- data/src/org/apache/batik/svggen/font/table/Table.java +171 -170
- data/src/org/apache/batik/svggen/font/table/TableDirectory.java +55 -55
- data/src/org/apache/batik/svggen/font/table/TableFactory.java +92 -93
- metadata +10 -11
- data/.travis.yml +0 -9
data/src/geomerative/RG.java
CHANGED
@@ -18,741 +18,736 @@
|
|
18
18
|
*/
|
19
19
|
package geomerative;
|
20
20
|
|
21
|
-
|
22
|
-
|
23
21
|
import processing.core.PApplet;
|
24
22
|
import processing.core.PConstants;
|
25
23
|
import processing.core.PGraphics;
|
26
24
|
|
27
|
-
|
28
25
|
/**
|
29
26
|
* RG is a static class containing all the states, modes, etc.. Geomerative is
|
30
27
|
* mostly used by calling RG methods. e.g. RShape s = RG.getEllipse(30, 40, 80,
|
31
28
|
* 80)
|
32
29
|
*/
|
33
|
-
public class RG {
|
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
|
-
RCommand.setSegmentStep(step);
|
756
|
-
}
|
30
|
+
public class RG {
|
31
|
+
|
32
|
+
/**
|
33
|
+
*
|
34
|
+
*/
|
35
|
+
private static boolean initialized = false;
|
36
|
+
|
37
|
+
/**
|
38
|
+
*
|
39
|
+
*/
|
40
|
+
private static PApplet parent;
|
41
|
+
|
42
|
+
/**
|
43
|
+
*
|
44
|
+
*/
|
45
|
+
public static boolean ignoreStyles = false;
|
46
|
+
|
47
|
+
/**
|
48
|
+
*
|
49
|
+
*/
|
50
|
+
public static boolean useFastClip = true;
|
51
|
+
|
52
|
+
/**
|
53
|
+
* The adaptor adapts the shape to a particular shape by adapting each of the
|
54
|
+
* groups points. This can cause deformations of the individual elements in
|
55
|
+
* the group.
|
56
|
+
*/
|
57
|
+
public final static int BYPOINT = 0;
|
58
|
+
|
59
|
+
/**
|
60
|
+
* The adaptor adapts the shape to a particular shape by adapting each of the
|
61
|
+
* groups elements positions. This maintains the proportions of the shapes.
|
62
|
+
*/
|
63
|
+
public final static int BYELEMENTPOSITION = 1;
|
64
|
+
|
65
|
+
/**
|
66
|
+
* The adaptor adapts the shape to a particular shape by adapting each of the
|
67
|
+
* groups elements indices. This maintains the proportions of the shapes.
|
68
|
+
*/
|
69
|
+
public final static int BYELEMENTINDEX = 2;
|
70
|
+
|
71
|
+
/**
|
72
|
+
*
|
73
|
+
*/
|
74
|
+
static int adaptorType = BYELEMENTPOSITION;
|
75
|
+
|
76
|
+
/**
|
77
|
+
*
|
78
|
+
*/
|
79
|
+
static float adaptorScale = 1F;
|
80
|
+
|
81
|
+
/**
|
82
|
+
*
|
83
|
+
*/
|
84
|
+
static float adaptorLengthOffset = 0F;
|
85
|
+
|
86
|
+
/**
|
87
|
+
* ADAPTATIVE segmentator minimizes the number of segments avoiding perceptual
|
88
|
+
* artifacts like angles or cusps. Use this in order to have polygons and
|
89
|
+
* meshes with the fewest possible vertices.
|
90
|
+
*/
|
91
|
+
public static int ADAPTATIVE = RCommand.ADAPTATIVE;
|
92
|
+
|
93
|
+
/**
|
94
|
+
* UNIFORMLENGTH segmentator is the slowest segmentator and it segments the
|
95
|
+
* curve on segments of equal length. This can be useful for very specific
|
96
|
+
* applications when for example drawing incrementaly a shape with a uniform
|
97
|
+
* speed.
|
98
|
+
*/
|
99
|
+
public static int UNIFORMLENGTH = RCommand.UNIFORMLENGTH;
|
100
|
+
|
101
|
+
/**
|
102
|
+
* UNIFORMSTEP segmentator is the fastest segmentator and it segments the
|
103
|
+
* curve based on a constant value of the step of the curve parameter, or on
|
104
|
+
* the number of segments wanted. This can be useful when segmpointsentating
|
105
|
+
* very often a Shape or when we know the amount of segments necessary for our
|
106
|
+
* specific application.
|
107
|
+
*/
|
108
|
+
public static int UNIFORMSTEP = RCommand.UNIFORMSTEP;
|
109
|
+
|
110
|
+
static int dpi = 72;
|
111
|
+
|
112
|
+
/**
|
113
|
+
*
|
114
|
+
*/
|
115
|
+
public static class LibraryNotInitializedException extends NullPointerException {
|
116
|
+
|
117
|
+
private static final long serialVersionUID = -3710605630786298671L;
|
118
|
+
|
119
|
+
LibraryNotInitializedException() {
|
120
|
+
super("Must call RG.init(this); before using this library.");
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
*
|
126
|
+
*/
|
127
|
+
public static class FontNotLoadedException extends NullPointerException {
|
128
|
+
|
129
|
+
private static final long serialVersionUID = -3710605630786298672L;
|
130
|
+
|
131
|
+
FontNotLoadedException() {
|
132
|
+
super("Use RG.loadFont(filename) and RG.textFont(font, size) to load and set fonts first.");
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
/**
|
137
|
+
*
|
138
|
+
*/
|
139
|
+
public static class NoPathInitializedException extends NullPointerException {
|
140
|
+
|
141
|
+
private static final long serialVersionUID = -3710605630786298673L;
|
142
|
+
|
143
|
+
NoPathInitializedException() {
|
144
|
+
super("Must initialize a path by calling RG.beginShape() first.");
|
145
|
+
}
|
146
|
+
}
|
147
|
+
|
148
|
+
static RShape shape;
|
149
|
+
|
150
|
+
static RFont fntLoader = null;
|
151
|
+
|
152
|
+
// Font methods
|
153
|
+
/**
|
154
|
+
* Load and get the font object that can be used in the textFont method.
|
155
|
+
*
|
156
|
+
loadFont
|
157
|
+
* @param fontFile the filename of the font to be loaded
|
158
|
+
* @return RFont, the font object
|
159
|
+
*/
|
160
|
+
public static RFont loadFont(String fontFile) {
|
161
|
+
RFont newFntLoader = new RFont(fontFile);
|
162
|
+
if (fntLoader == null) {
|
163
|
+
fntLoader = newFntLoader;
|
164
|
+
}
|
165
|
+
return newFntLoader;
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
/**
|
170
|
+
* Draw text to the screen using the font set using the textFont method.
|
171
|
+
*
|
172
|
+
text
|
173
|
+
* @param text the string to be drawn on the screen
|
174
|
+
*/
|
175
|
+
public static void text(String text) {
|
176
|
+
RShape grp = getText(text);
|
177
|
+
grp.draw();
|
178
|
+
}
|
179
|
+
|
180
|
+
/**
|
181
|
+
* Set the font object to be used in all text calls.
|
182
|
+
*
|
183
|
+
textFont
|
184
|
+
* @param font the font object to be set
|
185
|
+
* @param size the size of the font
|
186
|
+
*/
|
187
|
+
public static void textFont(RFont font, int size) {
|
188
|
+
font.setSize(size);
|
189
|
+
fntLoader = font;
|
190
|
+
}
|
191
|
+
|
192
|
+
/**
|
193
|
+
* Get the shape corresponding to a text. Use the textFont method to select
|
194
|
+
* the font and size.
|
195
|
+
*
|
196
|
+
getText
|
197
|
+
* @param font the filename of the font to be loaded
|
198
|
+
* @param text the string to be created
|
199
|
+
* @param size the size of the font to be used
|
200
|
+
* @param align the alignment. Use RG.CENTER, RG.LEFT or RG.RIGHT
|
201
|
+
* @return RShape, the shape created
|
202
|
+
*/
|
203
|
+
public static RShape getText(String text, String font, int size, int align) {
|
204
|
+
RFont tempFntLoader = new RFont(font, size, align);
|
205
|
+
return tempFntLoader.toShape(text);
|
206
|
+
}
|
207
|
+
|
208
|
+
public static RShape getText(String text) {
|
209
|
+
if (fntLoader == null) {
|
210
|
+
throw new FontNotLoadedException();
|
211
|
+
}
|
212
|
+
|
213
|
+
return fntLoader.toShape(text);
|
214
|
+
}
|
215
|
+
|
216
|
+
// Shape methods
|
217
|
+
/**
|
218
|
+
* Draw a shape to a given position on the screen.
|
219
|
+
*
|
220
|
+
shape
|
221
|
+
* @param shp the shape to be drawn
|
222
|
+
* @param x the horizontal coordinate
|
223
|
+
* @param y the vertical coordinate
|
224
|
+
* @param w the width with which we draw the shape
|
225
|
+
* @param h the height with which we draw the shape
|
226
|
+
*/
|
227
|
+
public static void shape(RShape shp, float x, float y, float w, float h) {
|
228
|
+
RShape tshp = new RShape(shp);
|
229
|
+
|
230
|
+
RMatrix transf = new RMatrix();
|
231
|
+
transf.translate(x, y);
|
232
|
+
transf.scale(w / tshp.getOrigWidth(), h / tshp.getOrigHeight());
|
233
|
+
tshp.transform(transf);
|
234
|
+
|
235
|
+
tshp.draw();
|
236
|
+
}
|
237
|
+
|
238
|
+
public static void shape(RShape shp, float x, float y) {
|
239
|
+
RShape tshp = new RShape(shp);
|
240
|
+
|
241
|
+
RMatrix transf = new RMatrix();
|
242
|
+
transf.translate(x, y);
|
243
|
+
tshp.transform(transf);
|
244
|
+
|
245
|
+
tshp.draw();
|
246
|
+
}
|
247
|
+
|
248
|
+
public static void shape(RShape shp) {
|
249
|
+
shp.draw();
|
250
|
+
}
|
251
|
+
|
252
|
+
/**
|
253
|
+
* Create a shape from an array of point arrays.
|
254
|
+
*
|
255
|
+
* @param points
|
256
|
+
* @return
|
257
|
+
createShape
|
258
|
+
*/
|
259
|
+
public static RShape createShape(RPoint[][] points) {
|
260
|
+
return new RShape(points);
|
261
|
+
}
|
262
|
+
|
263
|
+
/**
|
264
|
+
* Load a shape object from a file.
|
265
|
+
*
|
266
|
+
* @return
|
267
|
+
loadShape
|
268
|
+
* @param filename the SVG file to be loaded. Must be in the data directory
|
269
|
+
*/
|
270
|
+
public static RShape loadShape(String filename) {
|
271
|
+
RSVG svgLoader = new RSVG();
|
272
|
+
return svgLoader.toShape(filename);
|
273
|
+
}
|
274
|
+
|
275
|
+
/**
|
276
|
+
* Save a shape object to a file.
|
277
|
+
*
|
278
|
+
saveShape
|
279
|
+
* @param filename the SVG file to be saved.
|
280
|
+
* @param shape the shape to be saved.
|
281
|
+
*/
|
282
|
+
public static void saveShape(String filename, RShape shape) {
|
283
|
+
RSVG svgSaver = new RSVG();
|
284
|
+
String str = svgSaver.fromShape(shape);
|
285
|
+
String[] strs = PApplet.split(str, "\n");
|
286
|
+
RG.parent().saveStrings(filename, strs);
|
287
|
+
}
|
288
|
+
|
289
|
+
// Methods to create shapes
|
290
|
+
/**
|
291
|
+
* Begin to create a shape.
|
292
|
+
*
|
293
|
+
createShape
|
294
|
+
*/
|
295
|
+
public static void beginShape() {
|
296
|
+
shape = new RShape();
|
297
|
+
}
|
298
|
+
|
299
|
+
/**
|
300
|
+
* Begin a new path in the current shape. Can only be called inside
|
301
|
+
* beginShape() and endShape().
|
302
|
+
*
|
303
|
+
* @param endMode if called with RG.CLOSE it closes the current path before
|
304
|
+
* starting the new one.
|
305
|
+
createShape
|
306
|
+
*/
|
307
|
+
public static void breakShape(int endMode) {
|
308
|
+
if (endMode == PConstants.CLOSE) {
|
309
|
+
shape.addClose();
|
310
|
+
}
|
311
|
+
|
312
|
+
shape.updateOrigParams();
|
313
|
+
|
314
|
+
breakShape();
|
315
|
+
}
|
316
|
+
|
317
|
+
public static void breakShape() {
|
318
|
+
shape.addPath();
|
319
|
+
}
|
320
|
+
|
321
|
+
/**
|
322
|
+
* Add a vertex to the shape. Can only be called inside beginShape() and
|
323
|
+
* endShape().
|
324
|
+
*
|
325
|
+
createShape
|
326
|
+
* @param x the x coordinate of the vertex
|
327
|
+
* @param y the y coordinate of the vertex
|
328
|
+
*/
|
329
|
+
public static void vertex(float x, float y) {
|
330
|
+
if (shape.countPaths() == 0) {
|
331
|
+
shape.addMoveTo(x, y);
|
332
|
+
} else {
|
333
|
+
shape.addLineTo(x, y);
|
334
|
+
}
|
335
|
+
}
|
336
|
+
|
337
|
+
/**
|
338
|
+
* Add a bezierVertex to the shape. Can only be called inside beginShape() and
|
339
|
+
* endShape().
|
340
|
+
*
|
341
|
+
createShape
|
342
|
+
* @param cx1 the x coordinate of the first control point
|
343
|
+
* @param cy1 the y coordinate of the first control point
|
344
|
+
* @param cx2 the x coordinate of the second control point
|
345
|
+
* @param cy2 the y coordinate of the second control point
|
346
|
+
* @param x the x coordinate of the end point
|
347
|
+
* @param y the y coordinate of the end point
|
348
|
+
*/
|
349
|
+
public static void bezierVertex(float cx1, float cy1, float cx2, float cy2, float x, float y) {
|
350
|
+
if (shape.countPaths() == 0) {
|
351
|
+
throw new NoPathInitializedException();
|
352
|
+
} else {
|
353
|
+
shape.addBezierTo(cx1, cy1, cx2, cy2, x, y);
|
354
|
+
}
|
355
|
+
}
|
356
|
+
|
357
|
+
/**
|
358
|
+
* End the shape being created and draw it to the screen or the PGraphics
|
359
|
+
* passed as parameter.
|
360
|
+
*
|
361
|
+
createShape
|
362
|
+
* @param g the canvas on which to draw. By default it draws on the screen
|
363
|
+
*/
|
364
|
+
public static void endShape(PGraphics g) {
|
365
|
+
shape.draw(g);
|
366
|
+
shape = null;
|
367
|
+
}
|
368
|
+
|
369
|
+
public static void endShape() {
|
370
|
+
shape.draw();
|
371
|
+
shape = null;
|
372
|
+
}
|
373
|
+
|
374
|
+
/**
|
375
|
+
* End the shape being created and get it as an object.
|
376
|
+
*
|
377
|
+
* @return
|
378
|
+
getShape
|
379
|
+
*/
|
380
|
+
public static RShape getShape() {
|
381
|
+
RShape returningGroup = new RShape();
|
382
|
+
returningGroup.addChild(shape);
|
383
|
+
|
384
|
+
shape = null;
|
385
|
+
|
386
|
+
returningGroup.updateOrigParams();
|
387
|
+
|
388
|
+
return returningGroup;
|
389
|
+
}
|
390
|
+
|
391
|
+
/**
|
392
|
+
* Get an ellipse as a shape object.
|
393
|
+
*
|
394
|
+
getEllipse
|
395
|
+
* @param x x coordinate of the center of the shape
|
396
|
+
* @param y y coordinate of the center of the shape
|
397
|
+
* @param w width of the ellipse
|
398
|
+
* @param h height of the ellipse
|
399
|
+
* @return RShape, the shape created
|
400
|
+
*/
|
401
|
+
public static RShape getEllipse(float x, float y, float w, float h) {
|
402
|
+
return RShape.createEllipse(x, y, w, h);
|
403
|
+
}
|
404
|
+
|
405
|
+
public static RShape getEllipse(float x, float y, float w) {
|
406
|
+
return getEllipse(x, y, w, w);
|
407
|
+
}
|
408
|
+
|
409
|
+
/**
|
410
|
+
* Get a line as a shape object.
|
411
|
+
*
|
412
|
+
getLine
|
413
|
+
* @param x1 x coordinate of the first point of the line
|
414
|
+
* @param y1 y coordinate of the first point of the line
|
415
|
+
* @param x2 x coordinate of the last point of the line
|
416
|
+
* @param y2 y coordinate of the last point of the line
|
417
|
+
* @return RShape, the shape created
|
418
|
+
*/
|
419
|
+
public static RShape getLine(float x1, float y1, float x2, float y2) {
|
420
|
+
return RShape.createLine(x1, y1, x2, y2);
|
421
|
+
}
|
422
|
+
|
423
|
+
/**
|
424
|
+
* Get an rectangle as a shape object.
|
425
|
+
*
|
426
|
+
getRect
|
427
|
+
* @param x x coordinate of the top left corner of the shape
|
428
|
+
* @param y y coordinate of the top left of the shape
|
429
|
+
* @param w width of the rectangle
|
430
|
+
* @param h height of the rectangle
|
431
|
+
* @return RShape, the shape created
|
432
|
+
*/
|
433
|
+
public static RShape getRect(float x, float y, float w, float h) {
|
434
|
+
return RShape.createRectangle(x, y, w, h);
|
435
|
+
}
|
436
|
+
|
437
|
+
public static RShape getRect(float x, float y, float w) {
|
438
|
+
return getRect(x, y, w, w);
|
439
|
+
}
|
440
|
+
|
441
|
+
/**
|
442
|
+
* Get a star as a shape object.
|
443
|
+
*
|
444
|
+
getStar
|
445
|
+
* @param x x coordinate of the center of the shape
|
446
|
+
* @param y y coordinate of the center of the shape
|
447
|
+
* @param widthBig the outter width of the star polygon
|
448
|
+
* @param widthSmall the inner width of the star polygon
|
449
|
+
* @param spikes the amount of spikes on the star polygon
|
450
|
+
* @return RShape, the shape created
|
451
|
+
*/
|
452
|
+
public static RShape getStar(float x, float y, float widthBig, float widthSmall, int spikes) {
|
453
|
+
return RShape.createStar(x, y, widthBig, widthSmall, spikes);
|
454
|
+
}
|
455
|
+
|
456
|
+
/**
|
457
|
+
* Get a ring as a shape object.
|
458
|
+
*
|
459
|
+
getRing
|
460
|
+
* @param x x coordinate of the center of the shape
|
461
|
+
* @param y y coordinate of the center of the shape
|
462
|
+
* @param widthBig the outter width of the ring polygon
|
463
|
+
* @param widthSmall the inner width of the ring polygon
|
464
|
+
* @return RShape, the shape created
|
465
|
+
*/
|
466
|
+
public static RShape getRing(float x, float y, float widthBig, float widthSmall) {
|
467
|
+
return RShape.createRing(x, y, widthBig, widthSmall);
|
468
|
+
}
|
469
|
+
|
470
|
+
// Transformation methods
|
471
|
+
public static RShape centerIn(RShape grp, PGraphics g, float margin) {
|
472
|
+
RShape ret = new RShape(grp);
|
473
|
+
ret.centerIn(g, margin);
|
474
|
+
return ret;
|
475
|
+
}
|
476
|
+
|
477
|
+
public static RShape centerIn(RShape grp, PGraphics g) {
|
478
|
+
return centerIn(grp, g, 0);
|
479
|
+
}
|
480
|
+
|
481
|
+
/**
|
482
|
+
* Split a shape along the curve length in two parts.
|
483
|
+
*
|
484
|
+
split
|
485
|
+
* @param shp the shape to be splited
|
486
|
+
* @param t the proportion (a value from 0 to 1) along the curve where to
|
487
|
+
* split
|
488
|
+
* @return RShape[], an array of shapes with two elements, one for each side
|
489
|
+
* of the split
|
490
|
+
*/
|
491
|
+
public static RShape[] split(RShape shp, float t) {
|
492
|
+
return shp.split(t);
|
493
|
+
}
|
494
|
+
|
495
|
+
/**
|
496
|
+
* Adapt a shape along the curve of another shape.
|
497
|
+
*
|
498
|
+
split
|
499
|
+
* @param shp the shape to be adapted
|
500
|
+
* @param path the shape which curve will be followed
|
501
|
+
* @return RShape the adapted shape
|
502
|
+
* setAdaptor ( )
|
503
|
+
*/
|
504
|
+
public static RShape adapt(RShape shp, RShape path) {
|
505
|
+
RShape ret = new RShape(shp);
|
506
|
+
ret.adapt(path);
|
507
|
+
return ret;
|
508
|
+
}
|
509
|
+
|
510
|
+
/**
|
511
|
+
* Polygonize a shape.
|
512
|
+
*
|
513
|
+
split
|
514
|
+
* @param shp the shape to be polygonized
|
515
|
+
* @return RShape, the polygonized shape
|
516
|
+
* setPolygonizer ( )
|
517
|
+
*/
|
518
|
+
public static RShape polygonize(RShape shp) {
|
519
|
+
RShape ret = new RShape(shp);
|
520
|
+
ret.polygonize();
|
521
|
+
return ret;
|
522
|
+
}
|
523
|
+
|
524
|
+
// State methods
|
525
|
+
/**
|
526
|
+
* Initialize the library. Must be called before any call to Geomerative
|
527
|
+
* methods. Must be called by passing the PApplet. e.g. RG.init(this)
|
528
|
+
*
|
529
|
+
* @param _parent
|
530
|
+
*/
|
531
|
+
public static void init(PApplet _parent) {
|
532
|
+
parent = _parent;
|
533
|
+
initialized = true;
|
534
|
+
}
|
535
|
+
|
536
|
+
/**
|
537
|
+
* @return
|
538
|
+
*/
|
539
|
+
public static boolean initialized() {
|
540
|
+
return initialized;
|
541
|
+
}
|
542
|
+
|
543
|
+
/**
|
544
|
+
* @return
|
545
|
+
*/
|
546
|
+
protected static PApplet parent() {
|
547
|
+
if (parent == null) {
|
548
|
+
throw new LibraryNotInitializedException();
|
549
|
+
}
|
550
|
+
|
551
|
+
return parent;
|
552
|
+
}
|
553
|
+
|
554
|
+
/**
|
555
|
+
* @return
|
556
|
+
*/
|
557
|
+
protected static int dpi() {
|
558
|
+
return dpi;
|
559
|
+
}
|
560
|
+
|
561
|
+
/**
|
562
|
+
* Use this to set the resolution of the display. This specifies the Dots Per
|
563
|
+
* Inch of the display.
|
564
|
+
*
|
565
|
+
* @param _dpi the dots per inch of the display
|
566
|
+
*
|
567
|
+
*/
|
568
|
+
public static void setDpi(int _dpi) {
|
569
|
+
dpi = _dpi;
|
570
|
+
}
|
571
|
+
|
572
|
+
/**
|
573
|
+
* Binary difference between two shapes.
|
574
|
+
*
|
575
|
+
binaryOps
|
576
|
+
* @param a first shape to operate on
|
577
|
+
* @param b second shape to operate on
|
578
|
+
* @return RShape, the result of the operation
|
579
|
+
* diff ( )
|
580
|
+
* union ( )
|
581
|
+
* intersection ( )
|
582
|
+
* xor ( )
|
583
|
+
*/
|
584
|
+
public static RShape diff(RShape a, RShape b) {
|
585
|
+
return a.diff(b);
|
586
|
+
}
|
587
|
+
|
588
|
+
/**
|
589
|
+
* Binary union between two shapes.
|
590
|
+
*
|
591
|
+
binaryOps
|
592
|
+
* @param a first shape to operate on
|
593
|
+
* @param b second shape to operate on
|
594
|
+
* @return RShape, the result of the operation
|
595
|
+
* diff ( )
|
596
|
+
* union ( )
|
597
|
+
* intersection ( )
|
598
|
+
* xor ( )
|
599
|
+
*/
|
600
|
+
public static RShape union(RShape a, RShape b) {
|
601
|
+
return a.union(b);
|
602
|
+
}
|
603
|
+
|
604
|
+
/**
|
605
|
+
* Binary intersection between two shapes.
|
606
|
+
*
|
607
|
+
binaryOps
|
608
|
+
* @param a first shape to operate on
|
609
|
+
* @param b second shape to operate on
|
610
|
+
* @return RShape, the result of the operation
|
611
|
+
* diff ( )
|
612
|
+
* union ( )
|
613
|
+
* intersection ( )
|
614
|
+
* xor ( )
|
615
|
+
*/
|
616
|
+
public static RShape intersection(RShape a, RShape b) {
|
617
|
+
return a.intersection(b);
|
618
|
+
}
|
619
|
+
|
620
|
+
/**
|
621
|
+
* Binary xor between two shapes.
|
622
|
+
*
|
623
|
+
binaryOps
|
624
|
+
* @param a first shape to operate on
|
625
|
+
* @param b second shape to operate on
|
626
|
+
* @return RShape, the result of the operation
|
627
|
+
* diff ( )
|
628
|
+
* union ( )
|
629
|
+
* intersection ( )
|
630
|
+
* xor ( )
|
631
|
+
*/
|
632
|
+
public static RShape xor(RShape a, RShape b) {
|
633
|
+
return a.xor(b);
|
634
|
+
}
|
635
|
+
|
636
|
+
/**
|
637
|
+
* Ignore the styles of the shapes when drawing and use the Processing style
|
638
|
+
* methods.
|
639
|
+
*
|
640
|
+
ignoreStyles
|
641
|
+
* @param value value to which the ignoreStyles state should be set
|
642
|
+
*/
|
643
|
+
public static void ignoreStyles(boolean value) {
|
644
|
+
ignoreStyles = value;
|
645
|
+
}
|
646
|
+
|
647
|
+
public static void ignoreStyles() {
|
648
|
+
ignoreStyles = true;
|
649
|
+
}
|
650
|
+
|
651
|
+
/**
|
652
|
+
* Use this to set the adaptor type.
|
653
|
+
*
|
654
|
+
RShape_setAdaptor
|
655
|
+
* @param adptorType it can be RG.BYPOINT, RG.BYELEMENTPOSITION or
|
656
|
+
* RG.BYELEMENTINDEX
|
657
|
+
* BYPOINT
|
658
|
+
* BYELEMENTPOSITION
|
659
|
+
* BYELEMENTINDEX
|
660
|
+
*/
|
661
|
+
public static void setAdaptor(int adptorType) {
|
662
|
+
adaptorType = adptorType;
|
663
|
+
}
|
664
|
+
|
665
|
+
/**
|
666
|
+
* Use this to set the adaptor scaling. This scales the transformation of the
|
667
|
+
* adaptor.
|
668
|
+
*
|
669
|
+
RShape_setAdaptor
|
670
|
+
* @param adptorScale the scaling coefficient
|
671
|
+
*/
|
672
|
+
public static void setAdaptorScale(float adptorScale) {
|
673
|
+
adaptorScale = adptorScale;
|
674
|
+
}
|
675
|
+
|
676
|
+
/**
|
677
|
+
* Use this to set the adaptor length offset. This specifies where to start
|
678
|
+
* adapting the group to the shape.
|
679
|
+
*
|
680
|
+
RShape_setAdaptorLengthOffset
|
681
|
+
* @param adptorLengthOffset the offset along the curve of the shape. Must be
|
682
|
+
* a value between 0 and 1;
|
683
|
+
*
|
684
|
+
*/
|
685
|
+
public static void setAdaptorLengthOffset(float adptorLengthOffset) throws RuntimeException {
|
686
|
+
if (adptorLengthOffset >= 0F && adptorLengthOffset <= 1F) {
|
687
|
+
adaptorLengthOffset = adptorLengthOffset;
|
688
|
+
} else {
|
689
|
+
throw new RuntimeException("The adaptor length offset must take a value between 0 and 1.");
|
690
|
+
}
|
691
|
+
}
|
692
|
+
|
693
|
+
/**
|
694
|
+
* Use this to set the polygonizer type.
|
695
|
+
*
|
696
|
+
* @param segmenterMethod can be RG.ADAPTATIVE, RG.UNIFORMLENGTH or
|
697
|
+
* RG.UNIFORMSTEP.
|
698
|
+
*
|
699
|
+
setPolygonizer
|
700
|
+
* ADAPTATIVE
|
701
|
+
* UNIFORMLENGTH
|
702
|
+
* UNIFORMSTEP
|
703
|
+
*
|
704
|
+
*/
|
705
|
+
public static void setPolygonizer(int segmenterMethod) {
|
706
|
+
RCommand.setSegmentator(segmenterMethod);
|
707
|
+
}
|
708
|
+
|
709
|
+
/**
|
710
|
+
* Use this to set the segmentator angle tolerance for the ADAPTATIVE
|
711
|
+
* segmentator and set the segmentator to ADAPTATIVE.
|
712
|
+
*
|
713
|
+
setPolygonizerAngle
|
714
|
+
* @param angle an angle from 0 to PI/2 it defines the maximum angle between
|
715
|
+
* segments.
|
716
|
+
* ADAPTATIVE
|
717
|
+
*
|
718
|
+
*/
|
719
|
+
public static void setPolygonizerAngle(float angle) {
|
720
|
+
RCommand.setSegmentAngle(angle);
|
721
|
+
}
|
722
|
+
|
723
|
+
/**
|
724
|
+
* Use this to set the segmentator length for the UNIFORMLENGTH segmentator
|
725
|
+
* and set the segmentator to UNIFORMLENGTH.
|
726
|
+
*
|
727
|
+
setPolygonizerLength
|
728
|
+
* @param length the length of each resulting segment.
|
729
|
+
* UNIFORMLENGTH
|
730
|
+
* polygonize ( )
|
731
|
+
*/
|
732
|
+
public static void setPolygonizerLength(float length) {
|
733
|
+
RCommand.setSegmentLength(length);
|
734
|
+
}
|
735
|
+
|
736
|
+
/**
|
737
|
+
* Use this to set the segmentator step for the UNIFORMSTEP segmentator and
|
738
|
+
* set the segmentator to UNIFORMSTEP.
|
739
|
+
*
|
740
|
+
setSegmentStep
|
741
|
+
* @param step if a float from +0.0 to 1.0 is passed it's considered as the
|
742
|
+
* step, else it's considered as the number of steps. When a value of 0.0 is
|
743
|
+
* used the steps will be calculated automatically depending on an estimation
|
744
|
+
* of the length of the curve. The special value -1 is the same as 0.0 but
|
745
|
+
* also turning of the segmentation of lines (faster segmentation).
|
746
|
+
* UNIFORMSTEP
|
747
|
+
* polygonize ( )
|
748
|
+
*/
|
749
|
+
public static void setPolygonizerStep(float step) {
|
750
|
+
RCommand.setSegmentStep(step);
|
751
|
+
}
|
757
752
|
|
758
753
|
}
|