plotboilerplate 1.16.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/changelog.md +26 -1
- package/dist/index.esm.js +355 -441
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/plotboilerplate.browser.min.js +1 -1
- package/dist/plotboilerplate.browser.min.js.map +1 -1
- package/dist/plotboilerplate.js +357 -345
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +1 -1
- package/src/cjs/BezierPath.d.ts +0 -14
- package/src/cjs/BezierPath.js +0 -26
- package/src/cjs/BezierPath.js.map +1 -1
- package/src/cjs/Bounds.d.ts +22 -1
- package/src/cjs/Bounds.js +24 -1
- package/src/cjs/Bounds.js.map +1 -1
- package/src/cjs/Circle.d.ts +0 -13
- package/src/cjs/Circle.js +0 -23
- package/src/cjs/Circle.js.map +1 -1
- package/src/cjs/CircleSector.d.ts +0 -13
- package/src/cjs/CircleSector.js +0 -27
- package/src/cjs/CircleSector.js.map +1 -1
- package/src/cjs/CubicBezierCurve.d.ts +0 -15
- package/src/cjs/CubicBezierCurve.js +0 -36
- package/src/cjs/CubicBezierCurve.js.map +1 -1
- package/src/cjs/Line.d.ts +0 -14
- package/src/cjs/Line.js +0 -26
- package/src/cjs/Line.js.map +1 -1
- package/src/cjs/PBImage.d.ts +0 -13
- package/src/cjs/PBImage.js +0 -14
- package/src/cjs/PBImage.js.map +1 -1
- package/src/cjs/PBText.d.ts +0 -13
- package/src/cjs/PBText.js +0 -14
- package/src/cjs/PBText.js.map +1 -1
- package/src/cjs/Polygon.d.ts +9 -15
- package/src/cjs/Polygon.js +12 -39
- package/src/cjs/Polygon.js.map +1 -1
- package/src/cjs/Triangle.d.ts +0 -13
- package/src/cjs/Triangle.js +0 -37
- package/src/cjs/Triangle.js.map +1 -1
- package/src/cjs/VEllipse.d.ts +0 -10
- package/src/cjs/VEllipse.js +0 -21
- package/src/cjs/VEllipse.js.map +1 -1
- package/src/cjs/Vector.d.ts +0 -14
- package/src/cjs/Vector.js +0 -36
- package/src/cjs/Vector.js.map +1 -1
- package/src/cjs/Vertex.d.ts +0 -14
- package/src/cjs/Vertex.js +0 -25
- package/src/cjs/Vertex.js.map +1 -1
- package/src/cjs/draw.d.ts +41 -2
- package/src/cjs/draw.js +140 -3
- package/src/cjs/draw.js.map +1 -1
- package/src/cjs/drawgl.d.ts +38 -2
- package/src/cjs/drawgl.js +41 -2
- package/src/cjs/drawgl.js.map +1 -1
- package/src/cjs/drawutilssvg.d.ts +66 -3
- package/src/cjs/drawutilssvg.js +140 -15
- package/src/cjs/drawutilssvg.js.map +1 -1
- package/src/cjs/index.d.ts +0 -1
- package/src/cjs/index.js +0 -1
- package/src/cjs/index.js.map +1 -1
- package/src/cjs/interfaces/DrawLib.d.ts +61 -26
- package/src/cjs/interfaces/DrawLib.js +2 -0
- package/src/cjs/interfaces/DrawLib.js.map +1 -1
- package/src/cjs/interfaces/core.d.ts +0 -12
- package/src/cjs/module.d.ts +1 -3
- package/src/cjs/module.js +2 -5
- package/src/cjs/module.js.map +1 -1
- package/src/cjs/utils/creategui.js +16 -2
- package/src/cjs/utils/datastructures/Girih.d.ts +5 -0
- package/src/cjs/utils/datastructures/Girih.js +18 -14
- package/src/cjs/utils/datastructures/Girih.js.map +1 -1
- package/src/cjs/utils/datastructures/GirihPenroseRhombus.js +42 -25
- package/src/cjs/utils/datastructures/GirihPenroseRhombus.js.map +1 -1
- package/src/cjs/utils/datastructures/GirihTile.js +2 -13
- package/src/cjs/utils/datastructures/GirihTile.js.map +1 -1
- package/src/cjs/utils/helpers/BezierPathInteractionHelper.d.ts +2 -1
- package/src/cjs/utils/helpers/BezierPathInteractionHelper.js +9 -18
- package/src/cjs/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
- package/src/esm/BezierPath.d.ts +0 -14
- package/src/esm/BezierPath.js +0 -26
- package/src/esm/BezierPath.js.map +1 -1
- package/src/esm/Bounds.d.ts +22 -1
- package/src/esm/Bounds.js +24 -1
- package/src/esm/Bounds.js.map +1 -1
- package/src/esm/Circle.d.ts +0 -13
- package/src/esm/Circle.js +0 -23
- package/src/esm/Circle.js.map +1 -1
- package/src/esm/CircleSector.d.ts +0 -13
- package/src/esm/CircleSector.js +0 -27
- package/src/esm/CircleSector.js.map +1 -1
- package/src/esm/CubicBezierCurve.d.ts +0 -15
- package/src/esm/CubicBezierCurve.js +0 -36
- package/src/esm/CubicBezierCurve.js.map +1 -1
- package/src/esm/Line.d.ts +0 -14
- package/src/esm/Line.js +0 -26
- package/src/esm/Line.js.map +1 -1
- package/src/esm/PBImage.d.ts +0 -13
- package/src/esm/PBImage.js +0 -14
- package/src/esm/PBImage.js.map +1 -1
- package/src/esm/PBText.d.ts +0 -13
- package/src/esm/PBText.js +0 -14
- package/src/esm/PBText.js.map +1 -1
- package/src/esm/Polygon.d.ts +9 -15
- package/src/esm/Polygon.js +12 -39
- package/src/esm/Polygon.js.map +1 -1
- package/src/esm/Triangle.d.ts +0 -13
- package/src/esm/Triangle.js +0 -37
- package/src/esm/Triangle.js.map +1 -1
- package/src/esm/VEllipse.d.ts +0 -10
- package/src/esm/VEllipse.js +0 -21
- package/src/esm/VEllipse.js.map +1 -1
- package/src/esm/Vector.d.ts +0 -14
- package/src/esm/Vector.js +0 -36
- package/src/esm/Vector.js.map +1 -1
- package/src/esm/Vertex.d.ts +0 -14
- package/src/esm/Vertex.js +0 -25
- package/src/esm/Vertex.js.map +1 -1
- package/src/esm/draw.d.ts +41 -2
- package/src/esm/draw.js +139 -3
- package/src/esm/draw.js.map +1 -1
- package/src/esm/drawgl.d.ts +38 -2
- package/src/esm/drawgl.js +41 -2
- package/src/esm/drawgl.js.map +1 -1
- package/src/esm/drawutilssvg.d.ts +66 -3
- package/src/esm/drawutilssvg.js +140 -15
- package/src/esm/drawutilssvg.js.map +1 -1
- package/src/esm/index.d.ts +0 -1
- package/src/esm/index.js +0 -1
- package/src/esm/index.js.map +1 -1
- package/src/esm/interfaces/DrawLib.d.ts +61 -26
- package/src/esm/interfaces/DrawLib.js +2 -0
- package/src/esm/interfaces/DrawLib.js.map +1 -1
- package/src/esm/interfaces/core.d.ts +0 -12
- package/src/esm/module.d.ts +1 -3
- package/src/esm/module.js +5 -4
- package/src/esm/module.js.map +1 -1
- package/src/esm/utils/datastructures/Girih.d.ts +5 -0
- package/src/esm/utils/datastructures/Girih.js +18 -14
- package/src/esm/utils/datastructures/Girih.js.map +1 -1
- package/src/esm/utils/datastructures/GirihPenroseRhombus.js +42 -25
- package/src/esm/utils/datastructures/GirihPenroseRhombus.js.map +1 -1
- package/src/esm/utils/datastructures/GirihTile.js +2 -13
- package/src/esm/utils/datastructures/GirihTile.js.map +1 -1
- package/src/esm/utils/helpers/BezierPathInteractionHelper.d.ts +2 -1
- package/src/esm/utils/helpers/BezierPathInteractionHelper.js +9 -18
- package/src/esm/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
- package/src/ts/BezierPath.ts +0 -29
- package/src/ts/Bounds.ts +25 -1
- package/src/ts/Circle.ts +0 -26
- package/src/ts/CircleSector.ts +0 -30
- package/src/ts/CubicBezierCurve.ts +0 -39
- package/src/ts/Line.ts +0 -29
- package/src/ts/PBImage.ts +0 -15
- package/src/ts/PBText.ts +0 -17
- package/src/ts/Polygon.ts +16 -42
- package/src/ts/Triangle.ts +0 -40
- package/src/ts/VEllipse.ts +0 -24
- package/src/ts/Vector.ts +0 -40
- package/src/ts/Vertex.ts +0 -28
- package/src/ts/draw.ts +192 -3
- package/src/ts/drawgl.ts +44 -2
- package/src/ts/drawutilssvg.ts +181 -15
- package/src/ts/index.ts +0 -1
- package/src/ts/interfaces/DrawLib.ts +69 -26
- package/src/ts/interfaces/core.ts +0 -11
- package/src/ts/module.ts +2 -4
- package/src/ts/utils/datastructures/Girih.ts +204 -209
- package/src/ts/utils/datastructures/GirihPenroseRhombus.ts +170 -152
- package/src/ts/utils/datastructures/GirihTile.ts +394 -419
- package/src/ts/utils/helpers/BezierPathInteractionHelper.ts +9 -18
- package/src/ts/SVGBuilder.ts +0 -109
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
* @modified 2021-11-12 Added `text()` params fontSize, fontFamily, rotation, textAlign.
|
|
16
16
|
* @modified 2021-11-16 Added `text()` params fontWeight and fontStyle.
|
|
17
17
|
* @modified 2021-11-19 Added the `color` param to the `label(...)` function.
|
|
18
|
+
* @modified 2022-02-03 Added the `lineWidth` param to the `crosshair` function.
|
|
19
|
+
* @modified 2022-02-03 Added the `cross(...)` function.
|
|
18
20
|
**/
|
|
21
|
+
import { Bounds } from "../Bounds";
|
|
19
22
|
import { Polygon } from "../Polygon";
|
|
20
23
|
import { Vertex } from "../Vertex";
|
|
21
24
|
import { SVGPathParams, UID, XYCoords } from "./core";
|
|
@@ -104,7 +107,7 @@ export interface DrawLib<R> {
|
|
|
104
107
|
* @param {number=1} lineWidth? - [optional] The line's width.
|
|
105
108
|
* @return {void}
|
|
106
109
|
* @instance
|
|
107
|
-
* @memberof
|
|
110
|
+
* @memberof DrawLib
|
|
108
111
|
**/
|
|
109
112
|
line: (zA: Vertex, zB: Vertex, color: string, lineWidth?: number) => R;
|
|
110
113
|
/**
|
|
@@ -117,7 +120,7 @@ export interface DrawLib<R> {
|
|
|
117
120
|
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
118
121
|
* @return {void}
|
|
119
122
|
* @instance
|
|
120
|
-
* @memberof
|
|
123
|
+
* @memberof DrawLib
|
|
121
124
|
**/
|
|
122
125
|
arrow: (zA: Vertex, zB: Vertex, color: string, lineWidth?: number) => R;
|
|
123
126
|
/**
|
|
@@ -131,9 +134,25 @@ export interface DrawLib<R> {
|
|
|
131
134
|
* @param {Vertex} size - The x/y-size to draw the image with.
|
|
132
135
|
* @return {void}
|
|
133
136
|
* @instance
|
|
134
|
-
* @memberof
|
|
137
|
+
* @memberof DrawLib
|
|
135
138
|
**/
|
|
136
139
|
image: (image: HTMLImageElement, position: Vertex, size: Vertex) => R;
|
|
140
|
+
/**
|
|
141
|
+
* Draw an image at the given position with the given size.<br>
|
|
142
|
+
* <br>
|
|
143
|
+
* Note: SVG images may have resizing issues at the moment.Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.
|
|
144
|
+
*
|
|
145
|
+
* @method texturedPoly
|
|
146
|
+
* @param {Image} textureImage - The image object to draw.
|
|
147
|
+
* @param {Bounds} textureSize - The texture size to use; these are the original bounds to map the polygon vertices to.
|
|
148
|
+
* @param {Polygon} polygon - The polygon to use as clip path.
|
|
149
|
+
* @param {Vertex} polygonPosition - The polygon's position (relative), measured at the bounding box's center.
|
|
150
|
+
* @param {number} rotation - The rotation to use for the polygon (and for the texture).
|
|
151
|
+
* @return {void}
|
|
152
|
+
* @instance
|
|
153
|
+
* @memberof DrawLib
|
|
154
|
+
**/
|
|
155
|
+
texturedPoly: (textureImage: HTMLImageElement, textureSize: Bounds, polygon: Polygon, polygonPosition: Vertex, rotation: number) => R;
|
|
137
156
|
/**
|
|
138
157
|
* Draw the given (cubic) bézier curve.
|
|
139
158
|
*
|
|
@@ -146,7 +165,7 @@ export interface DrawLib<R> {
|
|
|
146
165
|
* @param {number} lineWidth - (optional) The line width to use.
|
|
147
166
|
* @return {void}
|
|
148
167
|
* @instance
|
|
149
|
-
* @memberof
|
|
168
|
+
* @memberof DrawLib
|
|
150
169
|
*/
|
|
151
170
|
cubicBezier: (startPoint: Vertex, endPoint: Vertex, startControlPoint: Vertex, endControlPoint: Vertex, color: string, lineWidth?: number) => R;
|
|
152
171
|
/**
|
|
@@ -162,7 +181,7 @@ export interface DrawLib<R> {
|
|
|
162
181
|
* @param {number=1} lineWidth - (optional) The line width to use.
|
|
163
182
|
* @return {void}
|
|
164
183
|
* @instance
|
|
165
|
-
* @memberof
|
|
184
|
+
* @memberof DrawLib
|
|
166
185
|
*/
|
|
167
186
|
cubicBezierPath: (path: Array<Vertex>, color: string, lineWidth?: number) => R;
|
|
168
187
|
/**
|
|
@@ -175,7 +194,7 @@ export interface DrawLib<R> {
|
|
|
175
194
|
* @param {Vertex} endPoint - The end point of the handle.
|
|
176
195
|
* @return {void}
|
|
177
196
|
* @instance
|
|
178
|
-
* @memberof
|
|
197
|
+
* @memberof DrawLib
|
|
179
198
|
*/
|
|
180
199
|
handle: (startPoint: Vertex, endPoint: Vertex) => R;
|
|
181
200
|
/**
|
|
@@ -186,7 +205,7 @@ export interface DrawLib<R> {
|
|
|
186
205
|
* @param {Vertex} endPoint - The end point to draw the handle at.
|
|
187
206
|
* @return {void}
|
|
188
207
|
* @instance
|
|
189
|
-
* @memberof
|
|
208
|
+
* @memberof DrawLib
|
|
190
209
|
*/
|
|
191
210
|
handleLine: (startPoint: Vertex, endPoint: Vertex) => R;
|
|
192
211
|
/**
|
|
@@ -197,7 +216,7 @@ export interface DrawLib<R> {
|
|
|
197
216
|
* @param {string} color - The CSS color to draw the dot with.
|
|
198
217
|
* @return {void}
|
|
199
218
|
* @instance
|
|
200
|
-
* @memberof
|
|
219
|
+
* @memberof DrawLib
|
|
201
220
|
*/
|
|
202
221
|
dot: (p: Vertex, color: string) => R;
|
|
203
222
|
/**
|
|
@@ -208,7 +227,7 @@ export interface DrawLib<R> {
|
|
|
208
227
|
* @param {string} color - The CSS color to draw the point with.
|
|
209
228
|
* @return {void}
|
|
210
229
|
* @instance
|
|
211
|
-
* @memberof
|
|
230
|
+
* @memberof DrawLib
|
|
212
231
|
*/
|
|
213
232
|
point: (p: Vertex, color: string) => R;
|
|
214
233
|
/**
|
|
@@ -223,7 +242,7 @@ export interface DrawLib<R> {
|
|
|
223
242
|
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
224
243
|
* @return {void}
|
|
225
244
|
* @instance
|
|
226
|
-
* @memberof
|
|
245
|
+
* @memberof DrawLib
|
|
227
246
|
*/
|
|
228
247
|
circle: (center: Vertex, radius: number, color: string, lineWidth?: number) => R;
|
|
229
248
|
/**
|
|
@@ -238,7 +257,7 @@ export interface DrawLib<R> {
|
|
|
238
257
|
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
239
258
|
* @return {void}
|
|
240
259
|
* @instance
|
|
241
|
-
* @memberof
|
|
260
|
+
* @memberof DrawLib
|
|
242
261
|
*/
|
|
243
262
|
circleArc: (center: Vertex, radius: number, startAngle: number, endAngle: number, color: string, lineWidth?: number) => R;
|
|
244
263
|
/**
|
|
@@ -253,7 +272,7 @@ export interface DrawLib<R> {
|
|
|
253
272
|
* @param {number=} rotation - (optional, default=0) The rotation of the ellipse.
|
|
254
273
|
* @return {void}
|
|
255
274
|
* @instance
|
|
256
|
-
* @memberof
|
|
275
|
+
* @memberof DrawLib
|
|
257
276
|
*/
|
|
258
277
|
ellipse: (center: Vertex, radiusX: number, radiusY: number, color: string, lineWidth?: number, rotation?: number) => R;
|
|
259
278
|
/**
|
|
@@ -268,7 +287,7 @@ export interface DrawLib<R> {
|
|
|
268
287
|
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
269
288
|
* @return {void}
|
|
270
289
|
* @instance
|
|
271
|
-
* @memberof
|
|
290
|
+
* @memberof DrawLib
|
|
272
291
|
*/
|
|
273
292
|
square: (center: XYCoords, size: number, color: string, lineWidth?: number) => R;
|
|
274
293
|
/**
|
|
@@ -282,7 +301,7 @@ export interface DrawLib<R> {
|
|
|
282
301
|
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
283
302
|
* @return {void}
|
|
284
303
|
* @instance
|
|
285
|
-
* @memberof
|
|
304
|
+
* @memberof DrawLib
|
|
286
305
|
*/
|
|
287
306
|
rect: (upperLeft: XYCoords, width: number, height: number, color: string, lineWidth?: number) => R;
|
|
288
307
|
/**
|
|
@@ -297,7 +316,7 @@ export interface DrawLib<R> {
|
|
|
297
316
|
* @param {string} color - The CSS color to draw the grid with.
|
|
298
317
|
* @return {void}
|
|
299
318
|
* @instance
|
|
300
|
-
* @memberof
|
|
319
|
+
* @memberof DrawLib
|
|
301
320
|
*/
|
|
302
321
|
grid: (center: Vertex, width: number, height: number, sizeX: number, sizeY: number, color: string) => R;
|
|
303
322
|
/**
|
|
@@ -314,7 +333,7 @@ export interface DrawLib<R> {
|
|
|
314
333
|
* @param {string} color - The CSS color to draw the raster with.
|
|
315
334
|
* @return {void}
|
|
316
335
|
* @instance
|
|
317
|
-
* @memberof
|
|
336
|
+
* @memberof DrawLib
|
|
318
337
|
*/
|
|
319
338
|
raster: (center: Vertex, width: number, height: number, sizeX: number, sizeY: number, color: string) => R;
|
|
320
339
|
/**
|
|
@@ -330,7 +349,7 @@ export interface DrawLib<R> {
|
|
|
330
349
|
* @param {string} color - The CSS color to draw the diamond with.
|
|
331
350
|
* @return {void}
|
|
332
351
|
* @instance
|
|
333
|
-
* @memberof
|
|
352
|
+
* @memberof DrawLib
|
|
334
353
|
*/
|
|
335
354
|
diamondHandle: (center: Vertex, size: number, color: string) => R;
|
|
336
355
|
/**
|
|
@@ -346,7 +365,7 @@ export interface DrawLib<R> {
|
|
|
346
365
|
* @param {string} color - The CSS color to draw the square with.
|
|
347
366
|
* @return {void}
|
|
348
367
|
* @instance
|
|
349
|
-
* @memberof
|
|
368
|
+
* @memberof DrawLib
|
|
350
369
|
*/
|
|
351
370
|
squareHandle: (center: Vertex, size: number, color: string) => R;
|
|
352
371
|
/**
|
|
@@ -362,7 +381,7 @@ export interface DrawLib<R> {
|
|
|
362
381
|
* @param {string} color - The CSS color to draw the circle with.
|
|
363
382
|
* @return {void}
|
|
364
383
|
* @instance
|
|
365
|
-
* @memberof
|
|
384
|
+
* @memberof DrawLib
|
|
366
385
|
*/
|
|
367
386
|
circleHandle: (center: Vertex, size: number, color: string) => R;
|
|
368
387
|
/**
|
|
@@ -374,11 +393,27 @@ export interface DrawLib<R> {
|
|
|
374
393
|
* @param {XYCoords} center - The center of the crosshair.
|
|
375
394
|
* @param {number} radius - The radius of the crosshair.
|
|
376
395
|
* @param {string} color - The CSS color to draw the crosshair with.
|
|
396
|
+
* @param {number=0.5} lineWidth - (optional, default=0.5) The line width to use.
|
|
397
|
+
* @return {void}
|
|
398
|
+
* @instance
|
|
399
|
+
* @memberof DrawLib
|
|
400
|
+
*/
|
|
401
|
+
crosshair: (center: XYCoords, radius: number, color: string, lineWidth?: number) => R;
|
|
402
|
+
/**
|
|
403
|
+
* Draw a cross with diagonal axes with given radius, color and lineWidth at the given position.<br>
|
|
404
|
+
* <br>
|
|
405
|
+
* Note that the x's radius will not be affected by scaling.
|
|
406
|
+
*
|
|
407
|
+
* @method crosshair
|
|
408
|
+
* @param {XYCoords} center - The center of the crosshair.
|
|
409
|
+
* @param {number} radius - The radius of the crosshair.
|
|
410
|
+
* @param {string} color - The CSS color to draw the crosshair with.
|
|
411
|
+
* @param {number=1} lineWidth - (optional, default=1.0) The line width to use.
|
|
377
412
|
* @return {void}
|
|
378
413
|
* @instance
|
|
379
|
-
* @memberof
|
|
414
|
+
* @memberof DrawLib
|
|
380
415
|
*/
|
|
381
|
-
|
|
416
|
+
cross: (center: XYCoords, radius: number, color: string, lineWidth?: number) => R;
|
|
382
417
|
/**
|
|
383
418
|
* Draw a polygon.
|
|
384
419
|
*
|
|
@@ -387,7 +422,7 @@ export interface DrawLib<R> {
|
|
|
387
422
|
* @param {string} color - The CSS color to draw the polygon with.
|
|
388
423
|
* @return {void}
|
|
389
424
|
* @instance
|
|
390
|
-
* @memberof
|
|
425
|
+
* @memberof DrawLib
|
|
391
426
|
*/
|
|
392
427
|
polygon: (polygon: Polygon, color: string, lineWidth?: number) => R;
|
|
393
428
|
/**
|
|
@@ -400,7 +435,7 @@ export interface DrawLib<R> {
|
|
|
400
435
|
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
401
436
|
* @return {void}
|
|
402
437
|
* @instance
|
|
403
|
-
* @memberof
|
|
438
|
+
* @memberof DrawLib
|
|
404
439
|
*/
|
|
405
440
|
polyline: (vertices: Array<Vertex>, isOpen: boolean, color: string, lineWidth?: number) => R;
|
|
406
441
|
/**
|
|
@@ -420,7 +455,7 @@ export interface DrawLib<R> {
|
|
|
420
455
|
* @param {string=} options.textAlign - The text align to use. According to the specifiactions (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textAlign) valid values are `"left" || "right" || "center" || "start" || "end"`.
|
|
421
456
|
* @return {void}
|
|
422
457
|
* @instance
|
|
423
|
-
* @memberof
|
|
458
|
+
* @memberof DrawLib
|
|
424
459
|
*/
|
|
425
460
|
text: (text: string, x: number, y: number, options?: FontOptions) => R;
|
|
426
461
|
/**
|
|
@@ -434,7 +469,7 @@ export interface DrawLib<R> {
|
|
|
434
469
|
* @param {string="black"} color - The color to use (default is black).
|
|
435
470
|
* @return {void}
|
|
436
471
|
* @instance
|
|
437
|
-
* @memberof
|
|
472
|
+
* @memberof DrawLib
|
|
438
473
|
*/
|
|
439
474
|
label: (text: string, x: number, y: number, rotation?: number, color?: string) => R;
|
|
440
475
|
/**
|
|
@@ -446,7 +481,7 @@ export interface DrawLib<R> {
|
|
|
446
481
|
* @param {number=1} lineWidth - (optional) the line width to use (default is 1).
|
|
447
482
|
* @param {boolean=false} options.inplace - (optional) If set to true then path transforamtions (scale and translate) will be done in-place in the array. This can boost the performance.
|
|
448
483
|
* @instance
|
|
449
|
-
* @memberof
|
|
484
|
+
* @memberof DrawLib
|
|
450
485
|
* @return {R} An instance representing the drawn path.
|
|
451
486
|
*/
|
|
452
487
|
path: (pathData: SVGPathParams, color?: string, lineWidth?: number, options?: {
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
* @modified 2021-11-12 Added `text()` params fontSize, fontFamily, rotation, textAlign.
|
|
16
16
|
* @modified 2021-11-16 Added `text()` params fontWeight and fontStyle.
|
|
17
17
|
* @modified 2021-11-19 Added the `color` param to the `label(...)` function.
|
|
18
|
+
* @modified 2022-02-03 Added the `lineWidth` param to the `crosshair` function.
|
|
19
|
+
* @modified 2022-02-03 Added the `cross(...)` function.
|
|
18
20
|
**/
|
|
19
21
|
export {};
|
|
20
22
|
//# sourceMappingURL=DrawLib.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawLib.js","sourceRoot":"","sources":["../../ts/interfaces/DrawLib.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"DrawLib.js","sourceRoot":"","sources":["../../ts/interfaces/DrawLib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;IAmBI"}
|
|
@@ -169,18 +169,6 @@ export interface SVGSerializable {
|
|
|
169
169
|
* Required to generate proper CSS classes and other class related IDs.
|
|
170
170
|
**/
|
|
171
171
|
readonly className: string;
|
|
172
|
-
/**
|
|
173
|
-
* Convert this vertex to SVG code.
|
|
174
|
-
*
|
|
175
|
-
* @method toSVGString
|
|
176
|
-
* @param {object=} options - An optional set of options, like 'className'.
|
|
177
|
-
* @return {string} A string representing the SVG code for this vertex.
|
|
178
|
-
* @instance
|
|
179
|
-
* @memberof Vertex
|
|
180
|
-
**/
|
|
181
|
-
toSVGString: (options: {
|
|
182
|
-
className?: string;
|
|
183
|
-
}) => string;
|
|
184
172
|
}
|
|
185
173
|
/**
|
|
186
174
|
* A type for SVG <path d="..." /> params.
|
package/src/esm/module.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { Circle } from "./Circle";
|
|
|
4
4
|
import { CircleSector } from "./CircleSector";
|
|
5
5
|
import { CubicBezierCurve } from "./CubicBezierCurve";
|
|
6
6
|
import { drawutils } from "./draw";
|
|
7
|
-
import { drawutilsgl } from "./drawgl";
|
|
8
7
|
import { geomutils } from "./geomutils";
|
|
9
8
|
import { Grid } from "./Grid";
|
|
10
9
|
import { KeyHandler } from "./KeyHandler";
|
|
@@ -13,7 +12,6 @@ import { MouseHandler } from "./MouseHandler";
|
|
|
13
12
|
import { PBImage } from "./PBImage";
|
|
14
13
|
import { PlotBoilerplate } from "./PlotBoilerplate";
|
|
15
14
|
import { Polygon } from "./Polygon";
|
|
16
|
-
import { SVGBuilder } from "./SVGBuilder";
|
|
17
15
|
import { Triangle } from "./Triangle";
|
|
18
16
|
import { UIDGenerator } from "./UIDGenerator";
|
|
19
17
|
import { Vector } from "./Vector";
|
|
@@ -24,5 +22,5 @@ import { VertexAttr } from "./VertexAttr";
|
|
|
24
22
|
import { VertexListeners } from "./VertexListeners";
|
|
25
23
|
import { VertTuple } from "./VertTuple";
|
|
26
24
|
import { drawutilssvg } from "./drawutilssvg";
|
|
27
|
-
export { BezierPath, Bounds, Circle, CircleSector, CubicBezierCurve, drawutils,
|
|
25
|
+
export { BezierPath, Bounds, Circle, CircleSector, CubicBezierCurve, drawutils, geomutils, Grid, KeyHandler, Line, MouseHandler, PBImage, PlotBoilerplate, Polygon, Triangle, UIDGenerator, Vector, VEllipse, VEllipseSector, Vertex, VertexAttr, VertexListeners, VertTuple, drawutilssvg };
|
|
28
26
|
export default PlotBoilerplate;
|
package/src/esm/module.js
CHANGED
|
@@ -10,7 +10,7 @@ import { Circle } from "./Circle";
|
|
|
10
10
|
import { CircleSector } from "./CircleSector";
|
|
11
11
|
import { CubicBezierCurve } from "./CubicBezierCurve";
|
|
12
12
|
import { drawutils } from "./draw";
|
|
13
|
-
import { drawutilsgl } from "./drawgl";
|
|
13
|
+
// import { drawutilsgl } from "./drawgl";
|
|
14
14
|
import { geomutils } from "./geomutils";
|
|
15
15
|
import { Grid } from "./Grid";
|
|
16
16
|
import { KeyHandler } from "./KeyHandler";
|
|
@@ -19,7 +19,6 @@ import { MouseHandler } from "./MouseHandler";
|
|
|
19
19
|
import { PBImage } from "./PBImage";
|
|
20
20
|
import { PlotBoilerplate } from "./PlotBoilerplate";
|
|
21
21
|
import { Polygon } from "./Polygon";
|
|
22
|
-
import { SVGBuilder } from "./SVGBuilder";
|
|
23
22
|
import { Triangle } from "./Triangle";
|
|
24
23
|
import { UIDGenerator } from "./UIDGenerator";
|
|
25
24
|
import { Vector } from "./Vector";
|
|
@@ -30,8 +29,10 @@ import { VertexAttr } from "./VertexAttr";
|
|
|
30
29
|
import { VertexListeners } from "./VertexListeners";
|
|
31
30
|
import { VertTuple } from "./VertTuple";
|
|
32
31
|
import { drawutilssvg } from "./drawutilssvg";
|
|
33
|
-
export { BezierPath, Bounds, Circle, CircleSector, CubicBezierCurve, drawutils,
|
|
32
|
+
export { BezierPath, Bounds, Circle, CircleSector, CubicBezierCurve, drawutils,
|
|
33
|
+
// drawutilsgl,
|
|
34
|
+
geomutils, Grid,
|
|
34
35
|
// ...interf,
|
|
35
|
-
KeyHandler, Line, MouseHandler, PBImage, PlotBoilerplate, Polygon,
|
|
36
|
+
KeyHandler, Line, MouseHandler, PBImage, PlotBoilerplate, Polygon, Triangle, UIDGenerator, Vector, VEllipse, VEllipseSector, Vertex, VertexAttr, VertexListeners, VertTuple, drawutilssvg };
|
|
36
37
|
export default PlotBoilerplate;
|
|
37
38
|
//# sourceMappingURL=module.js.map
|
package/src/esm/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../ts/module.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,uEAAuE;AACvE,MAAM;AACN,+EAA+E;AAC/E,EAAE;AACF,gBAAgB;AAEhB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../ts/module.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,uEAAuE;AACvE,MAAM;AACN,+EAA+E;AAC/E,EAAE;AACF,gBAAgB;AAEhB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,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AS;AACT,eAAe;AACf,SAAS,EACT,IAAI;AACJ,aAAa;AACb,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,eAAe,EACf,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,cAAc,EACd,MAAM,EACN,UAAU,EACV,eAAe,EACf,SAAS,EACT,YAAY,EACb,CAAC;AACF,eAAe,eAAe,CAAC"}
|
|
@@ -86,6 +86,11 @@ export declare class Girih {
|
|
|
86
86
|
* @return {void}
|
|
87
87
|
*/
|
|
88
88
|
removeTileAt(index: number): void;
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
* @param tiles
|
|
92
|
+
*/
|
|
93
|
+
replaceTiles(tiles: GirihTile): void;
|
|
89
94
|
/**
|
|
90
95
|
* Find that tile (index) which contains the given position. First match will be returned.
|
|
91
96
|
*
|
|
@@ -41,7 +41,6 @@ export class Girih {
|
|
|
41
41
|
this.tiles = [];
|
|
42
42
|
this.initTemplates(edgeLength);
|
|
43
43
|
}
|
|
44
|
-
;
|
|
45
44
|
/**
|
|
46
45
|
* Initialize the TILE_TEMPLATES array.
|
|
47
46
|
*
|
|
@@ -69,7 +68,6 @@ export class Girih {
|
|
|
69
68
|
this.TILE_TEMPLATES.push(decagon.transformTilePositionToAdjacency(5, bowtie));
|
|
70
69
|
this.TILE_TEMPLATES.push(pentagon.transformTilePositionToAdjacency(4, rhombus));
|
|
71
70
|
}
|
|
72
|
-
;
|
|
73
71
|
/**
|
|
74
72
|
* Add a new tile to this Girih pattern.
|
|
75
73
|
*
|
|
@@ -82,7 +80,6 @@ export class Girih {
|
|
|
82
80
|
addTile(tile) {
|
|
83
81
|
this.tiles.push(tile);
|
|
84
82
|
}
|
|
85
|
-
;
|
|
86
83
|
/**
|
|
87
84
|
* Remove the tile at given array position. The index must be inside valid bounds.
|
|
88
85
|
*
|
|
@@ -95,7 +92,16 @@ export class Girih {
|
|
|
95
92
|
removeTileAt(index) {
|
|
96
93
|
this.tiles.splice(index, 1);
|
|
97
94
|
}
|
|
98
|
-
|
|
95
|
+
/**
|
|
96
|
+
*
|
|
97
|
+
* @param tiles
|
|
98
|
+
*/
|
|
99
|
+
replaceTiles(tiles) {
|
|
100
|
+
this.tiles.splice(0, this.tiles.length);
|
|
101
|
+
for (var i in tiles) {
|
|
102
|
+
this.addTile(tiles[i]);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
99
105
|
/**
|
|
100
106
|
* Find that tile (index) which contains the given position. First match will be returned.
|
|
101
107
|
*
|
|
@@ -112,7 +118,6 @@ export class Girih {
|
|
|
112
118
|
}
|
|
113
119
|
return -1;
|
|
114
120
|
}
|
|
115
|
-
;
|
|
116
121
|
/**
|
|
117
122
|
* Turn the tile the mouse is hovering over.
|
|
118
123
|
* The turnCount is ab abstract number: -1 for one turn left, +1 for one turn right.
|
|
@@ -127,12 +132,12 @@ export class Girih {
|
|
|
127
132
|
* @return {void}
|
|
128
133
|
*/
|
|
129
134
|
turnTile(tileIndex, turnCount) {
|
|
130
|
-
if (tileIndex == -1)
|
|
135
|
+
if (tileIndex == -1)
|
|
136
|
+
// TODO: still required?
|
|
131
137
|
return;
|
|
132
138
|
const tile = this.tiles[tileIndex];
|
|
133
|
-
tile.rotate(turnCount * Math.PI * 2 / tile.symmetry);
|
|
139
|
+
tile.rotate((turnCount * Math.PI * 2) / tile.symmetry);
|
|
134
140
|
}
|
|
135
|
-
;
|
|
136
141
|
/**
|
|
137
142
|
* Move that tile the mouse is hovering over.
|
|
138
143
|
* The move amounts are abstract numbers, 1 indicating one unit along each axis.
|
|
@@ -146,12 +151,12 @@ export class Girih {
|
|
|
146
151
|
* @return {void}
|
|
147
152
|
*/
|
|
148
153
|
moveTile(tileIndex, moveXAmount, moveYAmount) {
|
|
149
|
-
if (tileIndex == -1)
|
|
154
|
+
if (tileIndex == -1)
|
|
155
|
+
// TODO: still required?
|
|
150
156
|
return;
|
|
151
157
|
const tile = this.tiles[tileIndex];
|
|
152
158
|
tile.move({ x: moveXAmount * 10, y: moveYAmount * 10 });
|
|
153
159
|
}
|
|
154
|
-
;
|
|
155
160
|
/**
|
|
156
161
|
* Find all possible adjadent tiles and their locations (type, rotation and offset). The
|
|
157
162
|
* function will return an array of all possible tiles matching at the given tile and edge.
|
|
@@ -165,7 +170,8 @@ export class Girih {
|
|
|
165
170
|
*/
|
|
166
171
|
findPossibleAdjacentTiles(tileIndex, edgeIndex) {
|
|
167
172
|
var adjTiles = [];
|
|
168
|
-
if (tileIndex == -1 || edgeIndex == -1)
|
|
173
|
+
if (tileIndex == -1 || edgeIndex == -1)
|
|
174
|
+
// TODO: still required?
|
|
169
175
|
return [];
|
|
170
176
|
let template = null;
|
|
171
177
|
for (var i in this.TILE_TEMPLATES) {
|
|
@@ -180,7 +186,5 @@ export class Girih {
|
|
|
180
186
|
// previewTilePointer = Math.min( adjTiles.length-1, previewTiilePointer );
|
|
181
187
|
return adjTiles;
|
|
182
188
|
}
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
; // END class Girih
|
|
189
|
+
} // END class Girih
|
|
186
190
|
//# sourceMappingURL=Girih.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Girih.js","sourceRoot":"","sources":["../../../ts/utils/datastructures/Girih.ts"],"names":[],"mappings":"AAAA;;;;;;IAMI;AAEJ,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Girih.js","sourceRoot":"","sources":["../../../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AAS,IAAI,CAAC,CAAC,IAAI,SAAS,IAAI,CAAC,CAAC;YACpC,wBAAwB;YACxB,OAAO,EAAE,CAAC;QAEZ,IAAI,QAAQ,GAAc,IAAI,CAAC;QAC/B,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC,cAAc,EAAE;YACjC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;YAC1C,0DAA0D;YAC1D,MAAM,UAAU,GAAqB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,0BAA0B,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAC3G,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,EAAE;gBAC1B,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;aACxC;SACF;QACD,6BAA6B;QAC7B,2EAA2E;QAC3E,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAC,kBAAkB"}
|
|
@@ -38,19 +38,21 @@ export class GirihPenroseRhombus extends GirihTile {
|
|
|
38
38
|
// Overwrite the default symmetries:
|
|
39
39
|
// the penrose-rhombus tile has a 180° symmetry (5/10 * 360°)
|
|
40
40
|
this.uniqueSymmetries = 5;
|
|
41
|
-
if (typeof addCenterPolygon
|
|
41
|
+
if (typeof addCenterPolygon === "undefined") {
|
|
42
42
|
addCenterPolygon = true; // Add by default
|
|
43
|
+
}
|
|
43
44
|
// Init the actual decahedron shape with the passed size
|
|
44
45
|
let pointA = new Vertex(0, 0);
|
|
45
46
|
let pointB = pointA;
|
|
46
47
|
this.addVertex(pointB);
|
|
47
|
-
const angles = [
|
|
48
|
+
const angles = [
|
|
49
|
+
0.0,
|
|
48
50
|
36.0,
|
|
49
51
|
144.0 // 108.0
|
|
50
52
|
];
|
|
51
53
|
let theta = 0.0;
|
|
52
54
|
for (var i = 0; i < angles.length; i++) {
|
|
53
|
-
theta +=
|
|
55
|
+
theta += 180.0 - angles[i];
|
|
54
56
|
pointA = pointB; // center of rotation
|
|
55
57
|
pointB = pointB.clone();
|
|
56
58
|
pointB.x += this.edgeLength;
|
|
@@ -63,55 +65,67 @@ export class GirihPenroseRhombus extends GirihTile {
|
|
|
63
65
|
for (var i = 0; i < this.vertices.length; i++) {
|
|
64
66
|
this.vertices[i].add(move).add(position);
|
|
65
67
|
}
|
|
66
|
-
this.textureSource.min.x = 2 / 500.0
|
|
67
|
-
|
|
68
|
+
this.textureSource.min.x = 2 / 500.0;
|
|
69
|
+
this.textureSource.min.y = 8 / 460.0;
|
|
68
70
|
this.textureSource.max.x = this.textureSource.min.x + 173 / 500.0;
|
|
69
71
|
this.textureSource.max.y = this.textureSource.min.y + 56 / 460.0;
|
|
70
|
-
;
|
|
71
72
|
this.baseBounds = this.getBounds();
|
|
72
73
|
this._buildInnerPolygons(this.edgeLength, addCenterPolygon);
|
|
73
74
|
this._buildOuterPolygons(this.edgeLength, addCenterPolygon);
|
|
74
75
|
}
|
|
75
|
-
;
|
|
76
76
|
/**
|
|
77
77
|
* @override
|
|
78
78
|
*/
|
|
79
79
|
clone() {
|
|
80
80
|
return new GirihPenroseRhombus(this.position.clone(), this.edgeLength, true).rotate(this.rotation);
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
_buildInnerPolygons(edgeLength, addCenterPolygon) {
|
|
82
|
+
_buildInnerPolygons(_edgeLength, addCenterPolygon) {
|
|
84
83
|
const indices = [0, 2];
|
|
85
84
|
const centerTile = new Polygon();
|
|
86
85
|
for (var i = 0; i < indices.length; i++) {
|
|
87
86
|
const innerTile = new Polygon();
|
|
88
87
|
const index = indices[i];
|
|
89
|
-
const left = this.getVertexAt(index)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const
|
|
88
|
+
const left = this.getVertexAt(index)
|
|
89
|
+
.clone()
|
|
90
|
+
.scale(0.5, this.getVertexAt(index + 1));
|
|
91
|
+
const right = this.getVertexAt(index + 1)
|
|
92
|
+
.clone()
|
|
93
|
+
.scale(0.5, this.getVertexAt(index + 2));
|
|
94
|
+
const innerA = this.getVertexAt(index + 1)
|
|
95
|
+
.clone()
|
|
96
|
+
.scale(0.28, this.position);
|
|
97
|
+
const innerB = this.getVertexAt(index + 1)
|
|
98
|
+
.clone()
|
|
99
|
+
.scale(0.55, this.position);
|
|
93
100
|
innerTile.addVertex(left);
|
|
94
101
|
innerTile.addVertex(innerA);
|
|
95
102
|
innerTile.addVertex(right);
|
|
96
103
|
innerTile.addVertex(innerB);
|
|
97
|
-
centerTile.addVertex(this.getVertexAt(index)
|
|
104
|
+
centerTile.addVertex(this.getVertexAt(index)
|
|
105
|
+
.clone()
|
|
106
|
+
.scale(0.1775, this.getVertexAt(index + 2)));
|
|
98
107
|
centerTile.addVertex(innerA.clone());
|
|
99
108
|
this.innerTilePolygons.push(innerTile);
|
|
100
109
|
}
|
|
101
110
|
if (addCenterPolygon)
|
|
102
111
|
this.innerTilePolygons.push(centerTile);
|
|
103
112
|
}
|
|
104
|
-
|
|
105
|
-
_buildOuterPolygons(edgeLength, centerPolygonExists) {
|
|
113
|
+
_buildOuterPolygons(_edgeLength, centerPolygonExists) {
|
|
106
114
|
// Add left and right 'spikes'.
|
|
107
115
|
const indices = [0, 2];
|
|
108
116
|
for (var i = 0; i < indices.length; i++) {
|
|
109
117
|
const outerTile = new Polygon();
|
|
110
118
|
const index = indices[i];
|
|
111
|
-
const left = this.getVertexAt(index)
|
|
112
|
-
|
|
119
|
+
const left = this.getVertexAt(index)
|
|
120
|
+
.clone()
|
|
121
|
+
.scale(0.5, this.getVertexAt(index + 1));
|
|
122
|
+
const right = this.getVertexAt(index + 1)
|
|
123
|
+
.clone()
|
|
124
|
+
.scale(0.5, this.getVertexAt(index + 2));
|
|
113
125
|
// const innerA:Vertex = this.getVertexAt( index+1 ).clone().scale( 0.28, this.position );
|
|
114
|
-
const innerB = this.getVertexAt(index + 1)
|
|
126
|
+
const innerB = this.getVertexAt(index + 1)
|
|
127
|
+
.clone()
|
|
128
|
+
.scale(0.55, this.position);
|
|
115
129
|
outerTile.addVertex(left.clone());
|
|
116
130
|
outerTile.addVertex(this.getVertexAt(index + 1).clone());
|
|
117
131
|
outerTile.addVertex(right.clone());
|
|
@@ -126,16 +140,21 @@ export class GirihPenroseRhombus extends GirihTile {
|
|
|
126
140
|
const outerTile = new Polygon();
|
|
127
141
|
const index = indices[i];
|
|
128
142
|
outerTile.addVertex(this.getVertexAt(index).clone());
|
|
129
|
-
outerTile.addVertex(this.getVertexAt(index)
|
|
143
|
+
outerTile.addVertex(this.getVertexAt(index)
|
|
144
|
+
.clone()
|
|
145
|
+
.scale(0.5, this.getVertexAt(index + 1)));
|
|
130
146
|
outerTile.addVertex(this.innerTilePolygons[i].getVertexAt(1).clone());
|
|
131
|
-
outerTile.addVertex(this.getVertexAt(index)
|
|
147
|
+
outerTile.addVertex(this.getVertexAt(index)
|
|
148
|
+
.clone()
|
|
149
|
+
.scale(0.1775, this.getVertexAt(index + 2)));
|
|
132
150
|
outerTile.addVertex(this.innerTilePolygons[(i + 1) % 2].getVertexAt(1).clone());
|
|
133
|
-
outerTile.addVertex(this.getVertexAt(index - 1)
|
|
151
|
+
outerTile.addVertex(this.getVertexAt(index - 1)
|
|
152
|
+
.clone()
|
|
153
|
+
.scale(0.5, this.getVertexAt(index)));
|
|
134
154
|
this.outerTilePolygons.push(outerTile);
|
|
135
155
|
}
|
|
136
156
|
}
|
|
137
157
|
}
|
|
138
|
-
;
|
|
139
158
|
/**
|
|
140
159
|
* If you want the center polygon not to be drawn the canvas handler needs to
|
|
141
160
|
* know the respective polygon index (inside the this.innerTilePolygons array).
|
|
@@ -144,7 +163,5 @@ export class GirihPenroseRhombus extends GirihTile {
|
|
|
144
163
|
getCenterPolygonIndex() {
|
|
145
164
|
return 2;
|
|
146
165
|
}
|
|
147
|
-
;
|
|
148
166
|
}
|
|
149
|
-
;
|
|
150
167
|
//# sourceMappingURL=GirihPenroseRhombus.js.map
|