1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.lineToCubic = void 0;
|
4 | var segment_line_factory_1 = require("../util/segment-line-factory");
|
5 | var mid_point_1 = require("../util/mid-point");
|
6 | function lineToCubic(x1, y1, x2, y2) {
|
7 | var t = 0.5;
|
8 | var p0 = [x1, y1];
|
9 | var p1 = [x2, y2];
|
10 | var p2 = (0, mid_point_1.midPoint)(p0, p1, t);
|
11 | var p3 = (0, mid_point_1.midPoint)(p1, p2, t);
|
12 | var p4 = (0, mid_point_1.midPoint)(p2, p3, t);
|
13 | var p5 = (0, mid_point_1.midPoint)(p3, p4, t);
|
14 | var p6 = (0, mid_point_1.midPoint)(p4, p5, t);
|
15 |
|
16 |
|
17 | var cp1 = (0, segment_line_factory_1.segmentLineFactory)(p0[0], p0[1], p2[0], p2[1], p4[0]).point;
|
18 |
|
19 |
|
20 | var cp2 = (0, segment_line_factory_1.segmentLineFactory)(p6[0], p6[1], p5[0], p5[1], p3[0]).point;
|
21 | return [cp1.x, cp1.y, cp2.x, cp2.y, x2, y2];
|
22 | }
|
23 | exports.lineToCubic = lineToCubic;
|
24 |
|
\ | No newline at end of file |