|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
908 bytes
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.default = void 0;
|
|---|
| 7 | var _math = require("../math.js");
|
|---|
| 8 | const c = -0.5;
|
|---|
| 9 | const s = (0, _math.sqrt)(3) / 2;
|
|---|
| 10 | const k = 1 / (0, _math.sqrt)(12);
|
|---|
| 11 | const a = (k / 2 + 1) * 3;
|
|---|
| 12 | var _default = exports.default = {
|
|---|
| 13 | draw(context, size) {
|
|---|
| 14 | const r = (0, _math.sqrt)(size / a);
|
|---|
| 15 | const x0 = r / 2,
|
|---|
| 16 | y0 = r * k;
|
|---|
| 17 | const x1 = x0,
|
|---|
| 18 | y1 = r * k + r;
|
|---|
| 19 | const x2 = -x1,
|
|---|
| 20 | y2 = y1;
|
|---|
| 21 | context.moveTo(x0, y0);
|
|---|
| 22 | context.lineTo(x1, y1);
|
|---|
| 23 | context.lineTo(x2, y2);
|
|---|
| 24 | context.lineTo(c * x0 - s * y0, s * x0 + c * y0);
|
|---|
| 25 | context.lineTo(c * x1 - s * y1, s * x1 + c * y1);
|
|---|
| 26 | context.lineTo(c * x2 - s * y2, s * x2 + c * y2);
|
|---|
| 27 | context.lineTo(c * x0 + s * y0, c * y0 - s * x0);
|
|---|
| 28 | context.lineTo(c * x1 + s * y1, c * y1 - s * x1);
|
|---|
| 29 | context.lineTo(c * x2 + s * y2, c * y2 - s * x2);
|
|---|
| 30 | context.closePath();
|
|---|
| 31 | }
|
|---|
| 32 | }; |
|---|
Note:
See
TracBrowser
for help on using the repository browser.