UNPKG

@data2viz/data2viz

Version:

Data2viz library modules

1,590 lines 108 kB
(function (root, factory) { if (typeof define === 'function' && define.amd) define(['exports', 'kotlin', 'd2v-core-js'], factory); else if (typeof exports === 'object') factory(module.exports, require('kotlin'), require('d2v-core-js')); else { if (typeof kotlin === 'undefined') { throw new Error("Error loading module 'd2v-shape-js'. Its dependency 'kotlin' was not found. Please, check whether 'kotlin' is loaded prior to 'd2v-shape-js'."); } if (typeof this['d2v-core-js'] === 'undefined') { throw new Error("Error loading module 'd2v-shape-js'. Its dependency 'd2v-core-js' was not found. Please, check whether 'd2v-core-js' is loaded prior to 'd2v-shape-js'."); } root['d2v-shape-js'] = factory(typeof this['d2v-shape-js'] === 'undefined' ? {} : this['d2v-shape-js'], kotlin, this['d2v-core-js']); } }(this, function (_, Kotlin, $module$d2v_core_js) { 'use strict'; var ensureNotNull = Kotlin.ensureNotNull; var Kind_CLASS = Kotlin.Kind.CLASS; var Math_0 = Math; var Array_0 = Array; var Kind_INTERFACE = Kotlin.Kind.INTERFACE; var Kind_OBJECT = Kotlin.Kind.OBJECT; var math = Kotlin.kotlin.math; var Enum = Kotlin.kotlin.Enum; var throwISE = Kotlin.throwISE; var IntRange = Kotlin.kotlin.ranges.IntRange; var ArrayList_init = Kotlin.kotlin.collections.ArrayList_init_287e2$; var Path = $module$d2v_core_js.io.data2viz.geom.Path; var isNaN_0 = Kotlin.kotlin.isNaN_yrwdxr$; var until = Kotlin.kotlin.ranges.until_dqglrj$; var downTo = Kotlin.kotlin.ranges.downTo_dqglrj$; var Unit = Kotlin.kotlin.Unit; var getCallableRef = Kotlin.getCallableRef; var checkIndexOverflow = Kotlin.kotlin.collections.checkIndexOverflow_za3lpa$; var copyToArray = Kotlin.kotlin.collections.copyToArray; var sortedWith = Kotlin.kotlin.collections.sortedWith_eknfly$; var wrapFunction = Kotlin.wrapFunction; var Comparator = Kotlin.kotlin.Comparator; var reversed = Kotlin.kotlin.collections.reversed_7wnvza$; var plus = Kotlin.kotlin.collections.plus_mydzjv$; var collectionSizeOrDefault = Kotlin.kotlin.collections.collectionSizeOrDefault_ba2ldo$; var ArrayList_init_0 = Kotlin.kotlin.collections.ArrayList_init_ww73n8$; Symbols.prototype = Object.create(Enum.prototype); Symbols.prototype.constructor = Symbols; MonotoneX.prototype = Object.create(AbstractMonotone.prototype); MonotoneX.prototype.constructor = MonotoneX; MonotoneY.prototype = Object.create(AbstractMonotone.prototype); MonotoneY.prototype.constructor = MonotoneY; RadialLinear.prototype = Object.create(AbstractRadial.prototype); RadialLinear.prototype.constructor = RadialLinear; Radial.prototype = Object.create(AbstractRadial.prototype); Radial.prototype.constructor = Radial; Step.prototype = Object.create(AbstractStep.prototype); Step.prototype.constructor = Step; StepBefore.prototype = Object.create(AbstractStep.prototype); StepBefore.prototype.constructor = StepBefore; StepAfter.prototype = Object.create(AbstractStep.prototype); StepAfter.prototype.constructor = StepAfter; StackOffset.prototype = Object.create(Enum.prototype); StackOffset.prototype.constructor = StackOffset; StackOrder.prototype = Object.create(Enum.prototype); StackOrder.prototype.constructor = StackOrder; function arcBuilder(init) { var $receiver = new ArcBuilder(); init($receiver); return $receiver; } function ArcBuilder() { this.innerRadius = const_0(0.0); this.outerRadius = const_0(100.0); this.cornerRadius = const_0(0.0); this.padRadius = null; this.startAngle = const_0(0.0); this.endAngle = const_0(0.0); this.padAngle = const_0(0.0); } ArcBuilder.prototype.centroid_11rb$ = function (datum) { var r = this.innerRadius(datum) + this.outerRadius(datum) / 2.0; var a = this.startAngle(datum) + this.endAngle(datum) / 2.0 - halfPi; return [Math_0.cos(a) * r, Math_0.sin(a) * r]; }; ArcBuilder.prototype.buildArcForDatum_lr2v95$ = function (datum, path) { var tmp$; var r0 = this.innerRadius(datum); var r1 = this.outerRadius(datum); var a0 = this.startAngle(datum) - halfPi; var a1 = this.endAngle(datum) - halfPi; var x = a1 - a0; var da = Math_0.abs(x); var cw = a1 > a0; if (r1 < r0) { var r = r1; r1 = r0; r0 = r; } if (r1 <= epsilon) path.moveTo_lu1900$(0.0, 0.0); else if (da > tau - epsilon) { path.moveTo_lu1900$(r1 * Math_0.cos(a0), r1 * Math_0.sin(a0)); path.arc_6p3vsx$(0.0, 0.0, r1, a0, a1, !cw); if (r0 > epsilon) { path.moveTo_lu1900$(r0 * Math_0.cos(a1), r0 * Math_0.sin(a1)); path.arc_6p3vsx$(0.0, 0.0, r0, a1, a0, cw); } } else { var a01 = a0; var a11 = a1; var a00 = a0; var a10 = a1; var da0 = da; var da1 = da; var ap = this.padAngle(datum) / 2.0; if (ap <= epsilon) tmp$ = 0.0; else { var tmp$_0; if (this.padRadius != null) tmp$_0 = ensureNotNull(this.padRadius)(datum); else { var x_0 = r0 * r0 + r1 * r1; tmp$_0 = Math_0.sqrt(x_0); } var temp = tmp$_0; tmp$ = temp !== 0.0 ? 1.0 : 0.0; } var rp = tmp$; var x_1 = r1 - r0; var a = Math_0.abs(x_1) / 2; var b = this.cornerRadius(datum); var rc = Math_0.min(a, b); var rc0 = rc; var rc1 = rc; if (rp > epsilon) { var p0 = asin(rp / r0 * ap); var p1 = asin(rp / r1 * ap); da0 -= p0 * 2; if (da0 > epsilon) { p0 *= cw ? 1.0 : -1.0; a00 += p0; a10 -= p0; } else { da0 = 0.0; a10 = (a0 + a1) / 2; a00 = a10; } da1 -= p1 * 2; if (da1 > epsilon) { p1 *= cw ? 1.0 : -1.0; a01 += p1; a11 -= p1; } else { da1 = 0.0; a11 = (a0 + a1) / 2; a01 = a11; } } var tmp$_1 = r1; var x_2 = a01; var x01 = tmp$_1 * Math_0.cos(x_2); var tmp$_2 = r1; var x_3 = a01; var y01 = tmp$_2 * Math_0.sin(x_3); var tmp$_3 = r0; var x_4 = a10; var x10 = tmp$_3 * Math_0.cos(x_4); var tmp$_4 = r0; var x_5 = a10; var y10 = tmp$_4 * Math_0.sin(x_5); var tmp$_5 = r1; var x_6 = a11; var x11 = tmp$_5 * Math_0.cos(x_6); var tmp$_6 = r1; var x_7 = a11; var y11 = tmp$_6 * Math_0.sin(x_7); var tmp$_7 = r0; var x_8 = a00; var x00 = tmp$_7 * Math_0.cos(x_8); var tmp$_8 = r0; var x_9 = a00; var y00 = tmp$_8 * Math_0.sin(x_9); if (rc > epsilon) { if (da < pi) { var oc = da0 > epsilon ? this.intersect_0(x01, y01, x00, y00, x11, y11, x10, y10) : [x10, y10]; var ax = x01 - oc[0]; var ay = y01 - oc[1]; var bx = x11 - oc[0]; var by = y11 - oc[1]; var tmp$_9 = ax * bx + ay * by; var x_10 = ax * ax + ay * ay; var tmp$_10 = Math_0.sqrt(x_10); var x_11 = bx * bx + by * by; var x_12 = acos(tmp$_9 / (tmp$_10 * Math_0.sqrt(x_11))) / 2; var kc = 1 / Math_0.sin(x_12); var x_13 = oc[0] * oc[0] + oc[1] * oc[1]; var lc = Math_0.sqrt(x_13); var b_0 = (r0 - lc) / (kc - 1); rc0 = Math_0.min(rc, b_0); var b_1 = (r1 - lc) / (kc + 1); rc1 = Math_0.min(rc, b_1); } } if (!(da1 > epsilon)) path.moveTo_lu1900$(x01, y01); else if (rc1 > epsilon) { var t0 = this.cornerTangents_0(x00, y00, x01, y01, r1, rc1, cw); var t1 = this.cornerTangents_0(x11, y11, x10, y10, r1, rc1, cw); path.moveTo_lu1900$(t0.cx + t0.x01, t0.cy + t0.y01); if (rc1 < rc) { var tmp$_11 = t0.cx; var tmp$_12 = t0.cy; var tmp$_13 = rc1; var y = t0.y01; var x_14 = t0.x01; var tmp$_14 = Math_0.atan2(y, x_14); var y_0 = t1.y01; var x_15 = t1.x01; path.arc_6p3vsx$(tmp$_11, tmp$_12, tmp$_13, tmp$_14, Math_0.atan2(y_0, x_15), !cw); } else { var tmp$_15 = t0.cx; var tmp$_16 = t0.cy; var tmp$_17 = rc1; var y_1 = t0.y01; var x_16 = t0.x01; var tmp$_18 = Math_0.atan2(y_1, x_16); var y_2 = t0.y11; var x_17 = t0.x11; path.arc_6p3vsx$(tmp$_15, tmp$_16, tmp$_17, tmp$_18, Math_0.atan2(y_2, x_17), !cw); var tmp$_19 = r1; var y_3 = t0.cy + t0.y11; var x_18 = t0.cx + t0.x11; var tmp$_20 = Math_0.atan2(y_3, x_18); var y_4 = t1.cy + t1.y11; var x_19 = t1.cx + t1.x11; path.arc_6p3vsx$(0.0, 0.0, tmp$_19, tmp$_20, Math_0.atan2(y_4, x_19), !cw); var tmp$_21 = t1.cx; var tmp$_22 = t1.cy; var tmp$_23 = rc1; var y_5 = t1.y11; var x_20 = t1.x11; var tmp$_24 = Math_0.atan2(y_5, x_20); var y_6 = t1.y01; var x_21 = t1.x01; path.arc_6p3vsx$(tmp$_21, tmp$_22, tmp$_23, tmp$_24, Math_0.atan2(y_6, x_21), !cw); } } else { path.moveTo_lu1900$(x01, y01); path.arc_6p3vsx$(0.0, 0.0, r1, a01, a11, !cw); } if (!(r0 > epsilon) || !(da0 > epsilon)) path.lineTo_lu1900$(x10, y10); else if (rc0 > epsilon) { var t0_0 = this.cornerTangents_0(x10, y10, x11, y11, r0, -rc0, cw); var t1_0 = this.cornerTangents_0(x01, y01, x00, y00, r0, -rc0, cw); path.lineTo_lu1900$(t0_0.cx + t0_0.x01, t0_0.cy + t0_0.y01); if (rc0 < rc) { var tmp$_25 = t0_0.cx; var tmp$_26 = t0_0.cy; var tmp$_27 = rc0; var y_7 = t0_0.y01; var x_22 = t0_0.x01; var tmp$_28 = Math_0.atan2(y_7, x_22); var y_8 = t1_0.y01; var x_23 = t1_0.x01; path.arc_6p3vsx$(tmp$_25, tmp$_26, tmp$_27, tmp$_28, Math_0.atan2(y_8, x_23), !cw); } else { var tmp$_29 = t0_0.cx; var tmp$_30 = t0_0.cy; var tmp$_31 = rc0; var y_9 = t0_0.y01; var x_24 = t0_0.x01; var tmp$_32 = Math_0.atan2(y_9, x_24); var y_10 = t0_0.y11; var x_25 = t0_0.x11; path.arc_6p3vsx$(tmp$_29, tmp$_30, tmp$_31, tmp$_32, Math_0.atan2(y_10, x_25), !cw); var tmp$_33 = r0; var y_11 = t0_0.cy + t0_0.y11; var x_26 = t0_0.cx + t0_0.x11; var tmp$_34 = Math_0.atan2(y_11, x_26); var y_12 = t1_0.cy + t1_0.y11; var x_27 = t1_0.cx + t1_0.x11; path.arc_6p3vsx$(0.0, 0.0, tmp$_33, tmp$_34, Math_0.atan2(y_12, x_27), cw); var tmp$_35 = t1_0.cx; var tmp$_36 = t1_0.cy; var tmp$_37 = rc0; var y_13 = t1_0.y11; var x_28 = t1_0.x11; var tmp$_38 = Math_0.atan2(y_13, x_28); var y_14 = t1_0.y01; var x_29 = t1_0.x01; path.arc_6p3vsx$(tmp$_35, tmp$_36, tmp$_37, tmp$_38, Math_0.atan2(y_14, x_29), !cw); } } else path.arc_6p3vsx$(0.0, 0.0, r0, a10, a00, cw); } path.closePath(); return path; }; ArcBuilder.prototype.cornerTangents_0 = function (x0, y0, x1, y1, r1, rc, cw) { var x01 = x0 - x1; var y01 = y0 - y1; var tmp$ = cw ? rc : -rc; var x = x01 * x01 + y01 * y01; var lo = tmp$ / Math_0.sqrt(x); var ox = lo * y01; var oy = -lo * x01; var x11 = x0 + ox; var y11 = y0 + oy; var x10 = x1 + ox; var y10 = y1 + oy; var x00 = (x11 + x10) / 2; var y00 = (y11 + y10) / 2; var dx = x10 - x11; var dy = y10 - y11; var d2 = dx * dx + dy * dy; var r = r1 - rc; var D = x11 * y10 - x10 * y11; var tmp$_0 = dy < 0 ? -1.0 : 1.0; var b = r * r * d2 - D * D; var x_0 = Math_0.max(0.0, b); var d = tmp$_0 * Math_0.sqrt(x_0); var cx0 = (D * dy - dx * d) / d2; var cy0 = (-D * dx - dy * d) / d2; var cx1 = (D * dy + dx * d) / d2; var cy1 = (-D * dx + dy * d) / d2; var dx0 = cx0 - x00; var dy0 = cy0 - y00; var dx1 = cx1 - x00; var dy1 = cy1 - y00; if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) { cx0 = cx1; cy0 = cy1; } return new CornerTangentValues(cx0, cy0, -ox, -oy, cx0 * (r1 / r - 1), cy0 * (r1 / r - 1)); }; ArcBuilder.prototype.intersect_0 = function (x0, y0, x1, y1, x2, y2, x3, y3) { var x10 = x1 - x0; var y10 = y1 - y0; var x32 = x3 - x2; var y32 = y3 - y2; var t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / (y32 * x10 - x32 * y10); return [x0 + t * x10, y0 + t * y10]; }; ArcBuilder.$metadata$ = { kind: Kind_CLASS, simpleName: 'ArcBuilder', interfaces: [] }; function ArcParams(startAngle, endAngle, padAngle, value, index, data) { this.startAngle = startAngle; this.endAngle = endAngle; this.padAngle = padAngle; this.value = value; this.index = index; this.data = data; } ArcParams.$metadata$ = { kind: Kind_CLASS, simpleName: 'ArcParams', interfaces: [] }; ArcParams.prototype.component1 = function () { return this.startAngle; }; ArcParams.prototype.component2 = function () { return this.endAngle; }; ArcParams.prototype.component3 = function () { return this.padAngle; }; ArcParams.prototype.component4 = function () { return this.value; }; ArcParams.prototype.component5 = function () { return this.index; }; ArcParams.prototype.component6 = function () { return this.data; }; ArcParams.prototype.copy_2j2mcc$ = function (startAngle, endAngle, padAngle, value, index, data) { return new ArcParams(startAngle === void 0 ? this.startAngle : startAngle, endAngle === void 0 ? this.endAngle : endAngle, padAngle === void 0 ? this.padAngle : padAngle, value === void 0 ? this.value : value, index === void 0 ? this.index : index, data === void 0 ? this.data : data); }; ArcParams.prototype.toString = function () { return 'ArcParams(startAngle=' + Kotlin.toString(this.startAngle) + (', endAngle=' + Kotlin.toString(this.endAngle)) + (', padAngle=' + Kotlin.toString(this.padAngle)) + (', value=' + Kotlin.toString(this.value)) + (', index=' + Kotlin.toString(this.index)) + (', data=' + Kotlin.toString(this.data)) + ')'; }; ArcParams.prototype.hashCode = function () { var result = 0; result = result * 31 + Kotlin.hashCode(this.startAngle) | 0; result = result * 31 + Kotlin.hashCode(this.endAngle) | 0; result = result * 31 + Kotlin.hashCode(this.padAngle) | 0; result = result * 31 + Kotlin.hashCode(this.value) | 0; result = result * 31 + Kotlin.hashCode(this.index) | 0; result = result * 31 + Kotlin.hashCode(this.data) | 0; return result; }; ArcParams.prototype.equals = function (other) { return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.startAngle, other.startAngle) && Kotlin.equals(this.endAngle, other.endAngle) && Kotlin.equals(this.padAngle, other.padAngle) && Kotlin.equals(this.value, other.value) && Kotlin.equals(this.index, other.index) && Kotlin.equals(this.data, other.data))))); }; function CornerTangentValues(cx, cy, x01, y01, x11, y11) { this.cx = cx; this.cy = cy; this.x01 = x01; this.y01 = y01; this.x11 = x11; this.y11 = y11; } CornerTangentValues.$metadata$ = { kind: Kind_CLASS, simpleName: 'CornerTangentValues', interfaces: [] }; CornerTangentValues.prototype.component1 = function () { return this.cx; }; CornerTangentValues.prototype.component2 = function () { return this.cy; }; CornerTangentValues.prototype.component3 = function () { return this.x01; }; CornerTangentValues.prototype.component4 = function () { return this.y01; }; CornerTangentValues.prototype.component5 = function () { return this.x11; }; CornerTangentValues.prototype.component6 = function () { return this.y11; }; CornerTangentValues.prototype.copy_15yvbs$ = function (cx, cy, x01, y01, x11, y11) { return new CornerTangentValues(cx === void 0 ? this.cx : cx, cy === void 0 ? this.cy : cy, x01 === void 0 ? this.x01 : x01, y01 === void 0 ? this.y01 : y01, x11 === void 0 ? this.x11 : x11, y11 === void 0 ? this.y11 : y11); }; CornerTangentValues.prototype.toString = function () { return 'CornerTangentValues(cx=' + Kotlin.toString(this.cx) + (', cy=' + Kotlin.toString(this.cy)) + (', x01=' + Kotlin.toString(this.x01)) + (', y01=' + Kotlin.toString(this.y01)) + (', x11=' + Kotlin.toString(this.x11)) + (', y11=' + Kotlin.toString(this.y11)) + ')'; }; CornerTangentValues.prototype.hashCode = function () { var result = 0; result = result * 31 + Kotlin.hashCode(this.cx) | 0; result = result * 31 + Kotlin.hashCode(this.cy) | 0; result = result * 31 + Kotlin.hashCode(this.x01) | 0; result = result * 31 + Kotlin.hashCode(this.y01) | 0; result = result * 31 + Kotlin.hashCode(this.x11) | 0; result = result * 31 + Kotlin.hashCode(this.y11) | 0; return result; }; CornerTangentValues.prototype.equals = function (other) { return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.cx, other.cx) && Kotlin.equals(this.cy, other.cy) && Kotlin.equals(this.x01, other.x01) && Kotlin.equals(this.y01, other.y01) && Kotlin.equals(this.x11, other.x11) && Kotlin.equals(this.y11, other.y11))))); }; function areaBuilder(init) { var $receiver = new AreaBuilder(); init($receiver); return $receiver; } function AreaBuilder() { this.curve = curves_getInstance().linear; this.xBaseline = const_0(0.0); this.yBaseline = const_0(0.0); this.xTopline = null; this.yTopline = null; this.defined = const_0(true); } AreaBuilder.prototype.render_pzuqs$ = function (data, path) { var tmp$; var n = data.size; var array = Array_0(n); var tmp$_0; tmp$_0 = array.length - 1 | 0; for (var i = 0; i <= tmp$_0; i++) { array[i] = 0.0; } var x0z = array; var array_0 = Array_0(n); var tmp$_1; tmp$_1 = array_0.length - 1 | 0; for (var i_0 = 0; i_0 <= tmp$_1; i_0++) { array_0[i_0] = 0.0; } var y0z = array_0; var j = 0; var defined0 = false; var output = this.curve(path); for (var i_1 = 0; i_1 <= n; i_1++) { var areaNotEnded = i_1 < n; var undefined_0 = !(areaNotEnded && this.defined(data.get_za3lpa$(i_1))); if (undefined_0 === defined0) { defined0 = !defined0; if (defined0) { j = i_1; output.areaStart(); output.lineStart(); } else { output.lineEnd(); output.lineStart(); tmp$ = j; for (var k = i_1 - 1 | 0; k >= tmp$; k--) { output.point_lu1900$(x0z[k], y0z[k]); } output.lineEnd(); output.areaEnd(); } } if (defined0) { var d = data.get_za3lpa$(i_1); x0z[i_1] = this.xBaseline(d); y0z[i_1] = this.yBaseline(d); var outputX = this.xTopline != null ? ensureNotNull(this.xTopline)(d) : x0z[i_1]; var outputY = this.yTopline != null ? ensureNotNull(this.yTopline)(d) : y0z[i_1]; output.point_lu1900$(outputX, outputY); } } return path; }; AreaBuilder.$metadata$ = { kind: Kind_CLASS, simpleName: 'AreaBuilder', interfaces: [] }; function Curve() { } Curve.$metadata$ = { kind: Kind_INTERFACE, simpleName: 'Curve', interfaces: [] }; function curves() { curves_instance = this; this.basis = curves$basis$lambda; this.basisClosed = curves$basisClosed$lambda; this.basisOpen = curves$basisOpen$lambda; this.bundle = curves$bundle$lambda; this.cardinal = curves$cardinal$lambda; this.cardinalClosed = curves$cardinalClosed$lambda; this.cardinalOpen = curves$cardinalOpen$lambda; this.catmullRom = curves$catmullRom$lambda; this.catmullRomClosed = curves$catmullRomClosed$lambda; this.catmullRomOpen = curves$catmullRomOpen$lambda; this.linear = curves$linear$lambda; this.linearClosed = curves$linearClosed$lambda; this.monotoneX = curves$monotoneX$lambda; this.monotoneY = curves$monotoneY$lambda; this.natural = curves$natural$lambda; this.step = curves$step$lambda; this.stepBefore = curves$stepBefore$lambda; this.stepAfter = curves$stepAfter$lambda; } function curves$basis$lambda(path) { return new Basis(path); } function curves$basisClosed$lambda(path) { return new BasisClosed(path); } function curves$basisOpen$lambda(path) { return new BasisOpen(path); } function curves$bundle$lambda(path) { return new Bundle(path); } function curves$cardinal$lambda(path) { return new Cardinal(path); } function curves$cardinalClosed$lambda(path) { return new CardinalClosed(path); } function curves$cardinalOpen$lambda(path) { return new CardinalOpen(path); } function curves$catmullRom$lambda(path) { return new CatmullRom(path); } function curves$catmullRomClosed$lambda(path) { return new CatmullRomClosed(path); } function curves$catmullRomOpen$lambda(path) { return new CatmullRomOpen(path); } function curves$linear$lambda(path) { return new Linear(path); } function curves$linearClosed$lambda(path) { return new LinearClosed(path); } function curves$monotoneX$lambda(path) { return new MonotoneX(path); } function curves$monotoneY$lambda(path) { return new MonotoneY(path); } function curves$natural$lambda(path) { return new Natural(path); } function curves$step$lambda(path) { return new Step(path); } function curves$stepBefore$lambda(path) { return new StepBefore(path); } function curves$stepAfter$lambda(path) { return new StepAfter(path); } curves.$metadata$ = { kind: Kind_OBJECT, simpleName: 'curves', interfaces: [] }; var curves_instance = null; function curves_getInstance() { if (curves_instance === null) { new curves(); } return curves_instance; } function areas() { areas_instance = this; this.default = areas$default$lambda; this.basis = areas$basis$lambda; } function areas$default$lambda(path) { return new Linear(path); } function areas$basis$lambda(path) { return new Basis(path); } areas.$metadata$ = { kind: Kind_OBJECT, simpleName: 'areas', interfaces: [] }; var areas_instance = null; function areas_getInstance() { if (areas_instance === null) { new areas(); } return areas_instance; } function line(init) { var $receiver = new LineBuilder(); init($receiver); return $receiver; } function const$lambda(closure$constantValue) { return function (it) { return closure$constantValue; }; } function const_0(constantValue) { return const$lambda(constantValue); } function LineBuilder() { this.curve = curves_getInstance().linear; this.x = const_0(0.0); this.y = const_0(0.0); this.defined = const_0(true); } LineBuilder.prototype.buildLine_pzuqs$ = function (data, path) { var dataSize = data.size; var defined0 = false; var output = this.curve(path); for (var i = 0; i <= dataSize; i++) { if (!(i < dataSize && this.defined(data.get_za3lpa$(i))) === defined0) { defined0 = !defined0; if (defined0) output.lineStart(); else output.lineEnd(); } if (defined0) { var d = data.get_za3lpa$(i); output.point_lu1900$(this.x(d), this.y(d)); } } return path; }; LineBuilder.$metadata$ = { kind: Kind_CLASS, simpleName: 'LineBuilder', interfaces: [] }; var epsilon; var pi; var halfPi; var tau; function acos(x) { return x > 1.0 ? 0.0 : x < -1 ? pi : Math_0.acos(x); } function asin(x) { return x >= 1.0 ? halfPi : x <= -1.0 ? -halfPi : Math_0.asin(x); } function pie(init) { var $receiver = new PieGenerator(); init($receiver); return $receiver; } function PieGenerator() { this.value = const_0(0.0); this.startAngle = const_0(0.0); this.endAngle = const_0(tau); this.padAngle = const_0(0.0); } PieGenerator.prototype.render_tfr4nt$ = function (data) { var n = data.length; var sum = 0.0; var array = Array_0(n); var tmp$; tmp$ = array.length - 1 | 0; for (var i = 0; i <= tmp$; i++) { array[i] = 0; } var index = array; var array_0 = Array_0(n); var tmp$_0; tmp$_0 = array_0.length - 1 | 0; for (var i_0 = 0; i_0 <= tmp$_0; i_0++) { array_0[i_0] = new ArcParams(0.0, 0.0, 0.0, null, null, null); } var arcs = array_0; var array_1 = Array_0(n); var tmp$_1; tmp$_1 = array_1.length - 1 | 0; for (var i_1 = 0; i_1 <= tmp$_1; i_1++) { array_1[i_1] = 0.0; } var values = array_1; var a0 = this.startAngle(data); var tmp$_2 = tau; var a = -tau; var b = this.endAngle(data) - a0; var b_0 = Math_0.max(a, b); var da = Math_0.min(tmp$_2, b_0); var a_0 = Math_0.abs(da) / n; var b_1 = this.padAngle(data); var p = Math_0.min(a_0, b_1); var pa = da < 0.0 ? -p : p; for (var i_2 = 0; i_2 < n; i_2++) { index[i_2] = i_2; var v = this.value(data[i_2]); values[i_2] = v; if (v > 0) sum += v; } var k = sum > 0.0 ? (da - n * pa) / sum : 0.0; for (var i_3 = 0; i_3 < n; i_3++) { var j = index[i_3]; var v_0 = values[j]; var a1 = a0 + (v_0 > 0.0 ? v_0 * k : 0.0) + pa; arcs[j] = new ArcParams(a0, a1, p, v_0, i_3, data[j]); a0 = a1; } return arcs; }; PieGenerator.$metadata$ = { kind: Kind_CLASS, simpleName: 'PieGenerator', interfaces: [] }; function Symbol() { } Symbol.$metadata$ = { kind: Kind_INTERFACE, simpleName: 'Symbol', interfaces: [] }; function Symbols(name, ordinal) { Enum.call(this); this.name$ = name; this.ordinal$ = ordinal; } function Symbols_initFields() { Symbols_initFields = function () { }; Symbols$Circle_instance = new Symbols('Circle', 0); Symbols$Cross_instance = new Symbols('Cross', 1); Symbols$Diamond_instance = new Symbols('Diamond', 2); Symbols$Square_instance = new Symbols('Square', 3); Symbols$Star_instance = new Symbols('Star', 4); Symbols$Triangle_instance = new Symbols('Triangle', 5); Symbols$Wye_instance = new Symbols('Wye', 6); } var Symbols$Circle_instance; function Symbols$Circle_getInstance() { Symbols_initFields(); return Symbols$Circle_instance; } var Symbols$Cross_instance; function Symbols$Cross_getInstance() { Symbols_initFields(); return Symbols$Cross_instance; } var Symbols$Diamond_instance; function Symbols$Diamond_getInstance() { Symbols_initFields(); return Symbols$Diamond_instance; } var Symbols$Square_instance; function Symbols$Square_getInstance() { Symbols_initFields(); return Symbols$Square_instance; } var Symbols$Star_instance; function Symbols$Star_getInstance() { Symbols_initFields(); return Symbols$Star_instance; } var Symbols$Triangle_instance; function Symbols$Triangle_getInstance() { Symbols_initFields(); return Symbols$Triangle_instance; } var Symbols$Wye_instance; function Symbols$Wye_getInstance() { Symbols_initFields(); return Symbols$Wye_instance; } Symbols.$metadata$ = { kind: Kind_CLASS, simpleName: 'Symbols', interfaces: [Enum] }; function Symbols$values() { return [Symbols$Circle_getInstance(), Symbols$Cross_getInstance(), Symbols$Diamond_getInstance(), Symbols$Square_getInstance(), Symbols$Star_getInstance(), Symbols$Triangle_getInstance(), Symbols$Wye_getInstance()]; } Symbols.values = Symbols$values; function Symbols$valueOf(name) { switch (name) { case 'Circle': return Symbols$Circle_getInstance(); case 'Cross': return Symbols$Cross_getInstance(); case 'Diamond': return Symbols$Diamond_getInstance(); case 'Square': return Symbols$Square_getInstance(); case 'Star': return Symbols$Star_getInstance(); case 'Triangle': return Symbols$Triangle_getInstance(); case 'Wye': return Symbols$Wye_getInstance(); default:throwISE('No enum constant io.data2viz.shape.Symbols.' + name); } } Symbols.valueOf_61zpoe$ = Symbols$valueOf; function get_symbol($receiver) { switch ($receiver.name) { case 'Cross': return new Cross(); case 'Diamond': return new Diamond(); case 'Square': return new Square(); case 'Star': return new Star(); case 'Triangle': return new Triangle(); case 'Wye': return new Wye(); default:return new Circle(); } } function render(init) { var $receiver = new SymbolGenerator(); init($receiver); return $receiver; } function SymbolGenerator() { this.size = const_0(64.0); this.type = SymbolGenerator$type$lambda; } SymbolGenerator.prototype.render_lr2v95$ = function (args, path) { this.type(args).render_lh6mq8$(path, this.size(args)); return path; }; function SymbolGenerator$type$lambda(it) { return new Circle(); } SymbolGenerator.$metadata$ = { kind: Kind_CLASS, simpleName: 'SymbolGenerator', interfaces: [] }; function Basis(path) { this.path_udthta$_0 = path; this.x0_0 = -1.0; this.y0_0 = -1.0; this.x1_0 = -1.0; this.y1_0 = -1.0; this.lineStatus_0 = -1; this.pointStatus_0 = -1; } Object.defineProperty(Basis.prototype, 'path', { get: function () { return this.path_udthta$_0; } }); Basis.prototype.areaStart = function () { this.lineStatus_0 = 0; }; Basis.prototype.areaEnd = function () { this.lineStatus_0 = -1; }; Basis.prototype.lineStart = function () { this.x0_0 = -1.0; this.y0_0 = -1.0; this.x1_0 = -1.0; this.y1_0 = -1.0; this.pointStatus_0 = 0; }; Basis.prototype.lineEnd = function () { if (this.pointStatus_0 === 3) { this.curve_0(this.x1_0, this.y1_0); this.path.lineTo_lu1900$(this.x1_0, this.y1_0); } else if (this.pointStatus_0 === 2) this.path.lineTo_lu1900$(this.x1_0, this.y1_0); if (this.lineStatus_0 > 0 || this.pointStatus_0 === 1) { this.path.closePath(); } if (this.lineStatus_0 > -1) this.lineStatus_0 = 1 - this.lineStatus_0 | 0; }; Basis.prototype.curve_0 = function (x, y) { this.path.bezierCurveTo_15yvbs$((2 * this.x0_0 + this.x1_0) / 3, (2 * this.y0_0 + this.y1_0) / 3, (this.x0_0 + 2 * this.x1_0) / 3, (this.y0_0 + 2 * this.y1_0) / 3, (this.x0_0 + 4 * this.x1_0 + x) / 6, (this.y0_0 + 4 * this.y1_0 + y) / 6); }; Basis.prototype.point_lu1900$ = function (x, y) { if (this.pointStatus_0 === 0) { this.pointStatus_0 = 1; if (this.lineStatus_0 > 0) this.path.lineTo_lu1900$(x, y); else this.path.moveTo_lu1900$(x, y); } else if (this.pointStatus_0 === 1) { this.pointStatus_0 = 2; } else if (this.pointStatus_0 === 2) { this.pointStatus_0 = 3; this.path.lineTo_lu1900$((5 * this.x0_0 + this.x1_0) / 6, (5 * this.y0_0 + this.y1_0) / 6); this.curve_0(x, y); } else { this.curve_0(x, y); } this.x0_0 = this.x1_0; this.x1_0 = x; this.y0_0 = this.y1_0; this.y1_0 = y; }; Basis.$metadata$ = { kind: Kind_CLASS, simpleName: 'Basis', interfaces: [Curve] }; function BasisClosed(path) { this.path_ms4qoy$_0 = path; this.x0_0 = -1.0; this.y0_0 = -1.0; this.x1_0 = -1.0; this.y1_0 = -1.0; this.x2_0 = -1.0; this.y2_0 = -1.0; this.x3_0 = -1.0; this.y3_0 = -1.0; this.x4_0 = -1.0; this.y4_0 = -1.0; this.pointStatus_0 = -1; } Object.defineProperty(BasisClosed.prototype, 'path', { get: function () { return this.path_ms4qoy$_0; } }); BasisClosed.prototype.areaStart = function () { }; BasisClosed.prototype.areaEnd = function () { }; BasisClosed.prototype.lineStart = function () { this.x0_0 = -1.0; this.y0_0 = -1.0; this.x1_0 = -1.0; this.y1_0 = -1.0; this.x2_0 = -1.0; this.y2_0 = -1.0; this.x3_0 = -1.0; this.y3_0 = -1.0; this.x4_0 = -1.0; this.y4_0 = -1.0; this.pointStatus_0 = 0; }; BasisClosed.prototype.lineEnd = function () { switch (this.pointStatus_0) { case 1: this.path.moveTo_lu1900$(this.x2_0, this.y2_0); this.path.closePath(); break; case 2: this.path.moveTo_lu1900$((this.x2_0 + 2 * this.x3_0) / 3, (this.y2_0 + 2 * this.y3_0) / 3); this.path.lineTo_lu1900$((this.x3_0 + 2 * this.x2_0) / 3, (this.y3_0 + 2 * this.y2_0) / 3); this.path.closePath(); break; case 3: this.point_lu1900$(this.x2_0, this.y2_0); this.point_lu1900$(this.x3_0, this.y3_0); this.point_lu1900$(this.x4_0, this.y4_0); break; } }; BasisClosed.prototype.curve_0 = function (x, y) { this.path.bezierCurveTo_15yvbs$((2 * this.x0_0 + this.x1_0) / 3, (2 * this.y0_0 + this.y1_0) / 3, (this.x0_0 + 2 * this.x1_0) / 3, (this.y0_0 + 2 * this.y1_0) / 3, (this.x0_0 + 4 * this.x1_0 + x) / 6, (this.y0_0 + 4 * this.y1_0 + y) / 6); }; BasisClosed.prototype.point_lu1900$ = function (x, y) { switch (this.pointStatus_0) { case 0: this.pointStatus_0 = 1; this.x2_0 = x; this.y2_0 = y; break; case 1: this.pointStatus_0 = 2; this.x3_0 = x; this.y3_0 = y; break; case 2: this.pointStatus_0 = 3; this.x4_0 = x; this.y4_0 = y; this.path.moveTo_lu1900$((this.x0_0 + 4 * this.x1_0 + x) / 6, (this.y0_0 + 4 * this.y1_0 + y) / 6); break; default:this.curve_0(x, y); break; } this.x0_0 = this.x1_0; this.x1_0 = x; this.y0_0 = this.y1_0; this.y1_0 = y; }; BasisClosed.$metadata$ = { kind: Kind_CLASS, simpleName: 'BasisClosed', interfaces: [Curve] }; function BasisOpen(path) { this.path_eap3p8$_0 = path; this.x0_0 = -1.0; this.y0_0 = -1.0; this.x1_0 = -1.0; this.y1_0 = -1.0; this.lineStatus_0 = -1; this.pointStatus_0 = -1; } Object.defineProperty(BasisOpen.prototype, 'path', { get: function () { return this.path_eap3p8$_0; } }); BasisOpen.prototype.areaStart = function () { this.lineStatus_0 = 0; }; BasisOpen.prototype.areaEnd = function () { this.lineStatus_0 = -1; }; BasisOpen.prototype.lineStart = function () { this.x0_0 = -1.0; this.y0_0 = -1.0; this.x1_0 = -1.0; this.y1_0 = -1.0; this.pointStatus_0 = 0; }; BasisOpen.prototype.lineEnd = function () { if (this.lineStatus_0 > -1) { if (this.lineStatus_0 > 0) { this.path.closePath(); } this.lineStatus_0 = 1 - this.lineStatus_0 | 0; } }; BasisOpen.prototype.curve_0 = function (x, y) { this.path.bezierCurveTo_15yvbs$((2 * this.x0_0 + this.x1_0) / 3, (2 * this.y0_0 + this.y1_0) / 3, (this.x0_0 + 2 * this.x1_0) / 3, (this.y0_0 + 2 * this.y1_0) / 3, (this.x0_0 + 4 * this.x1_0 + x) / 6, (this.y0_0 + 4 * this.y1_0 + y) / 6); }; BasisOpen.prototype.point_lu1900$ = function (x, y) { switch (this.pointStatus_0) { case 0: this.pointStatus_0 = 1; break; case 1: this.pointStatus_0 = 2; break; case 2: this.pointStatus_0 = 3; var _x = (this.x0_0 + 4 * this.x1_0 + x) / 6; var _y = (this.y0_0 + 4 * this.y1_0 + y) / 6; if (this.lineStatus_0 > 0) this.path.lineTo_lu1900$(_x, _y); else this.path.moveTo_lu1900$(_x, _y); break; case 3: this.pointStatus_0 = 4; this.curve_0(x, y); break; default:this.curve_0(x, y); break; } this.x0_0 = this.x1_0; this.x1_0 = x; this.y0_0 = this.y1_0; this.y1_0 = y; }; BasisOpen.$metadata$ = { kind: Kind_CLASS, simpleName: 'BasisOpen', interfaces: [Curve] }; function Bundle(path, beta) { if (beta === void 0) beta = 0.85; this.path_eqdkf8$_0 = path; this.beta = beta; this.basis_0 = new Basis(this.path); this.x_0 = ArrayList_init(); this.y_0 = ArrayList_init(); } Object.defineProperty(Bundle.prototype, 'path', { get: function () { return this.path_eqdkf8$_0; } }); Bundle.prototype.areaStart = function () { }; Bundle.prototype.areaEnd = function () { }; Bundle.prototype.lineStart = function () { this.x_0.clear(); this.y_0.clear(); this.basis_0.lineStart(); }; Bundle.prototype.lineEnd = function () { var j = this.x_0.size - 1 | 0; if (j > 0) { var x0 = this.x_0.get_za3lpa$(0); var y0 = this.y_0.get_za3lpa$(0); var dx = this.x_0.get_za3lpa$(j) - x0; var dy = this.y_0.get_za3lpa$(j) - y0; var tmp$; tmp$ = (new IntRange(0, j)).iterator(); while (tmp$.hasNext()) { var element = tmp$.next(); var t = element / j | 0; this.basis_0.point_lu1900$(this.beta * this.x_0.get_za3lpa$(element) + (1 - this.beta) * (x0 + t * dx), this.beta * this.y_0.get_za3lpa$(element) + (1 - this.beta) * (y0 + t * dy)); } } this.basis_0.lineEnd(); }; Bundle.prototype.point_lu1900$ = function (x, y) { this.x_0.add_11rb$(x); this.y_0.add_11rb$(y); }; Bundle.$metadata$ = { kind: Kind_CLASS, simpleName: 'Bundle', interfaces: [Curve] }; function Cardinal(path, tension) { if (tension === void 0) tension = 0.0; this.path_5hws3q$_0 = path; this.x0_0 = -1.0; this.y0_0 = -1.0; this.x1_0 = -1.0; this.y1_0 = -1.0; this.x2_0 = -1.0; this.y2_0 = -1.0; this.lineStatus_0 = -1; this.pointStatus_0 = -1; this.k_0 = (1.0 - tension) / 6.0; } Object.defineProperty(Cardinal.prototype, 'path', { get: function () { return this.path_5hws3q$_0; } }); Cardinal.prototype.areaStart = function () { this.lineStatus_0 = 0; }; Cardinal.prototype.areaEnd = function () { this.lineStatus_0 = -1; }; Cardinal.prototype.lineStart = function () { this.x0_0 = -1.0; this.y0_0 = -1.0; this.x1_0 = -1.0; this.y1_0 = -1.0; this.x2_0 = -1.0; this.y2_0 = -1.0; this.pointStatus_0 = 0; }; Cardinal.prototype.lineEnd = function () { switch (this.pointStatus_0) { case 2: this.path.lineTo_lu1900$(this.x2_0, this.y2_0); break; case 3: this.curve_0(this.x1_0, this.y1_0); break; } if (this.lineStatus_0 > -1) { if (this.lineStatus_0 > 0) { this.path.closePath(); } this.lineStatus_0 = 1 - this.lineStatus_0 | 0; } }; Cardinal.prototype.curve_0 = function (x, y) { this.path.bezierCurveTo_15yvbs$(this.x1_0 + this.k_0 * (this.x2_0 - this.x0_0), this.y1_0 + this.k_0 * (this.y2_0 - this.y0_0), this.x2_0 + this.k_0 * (this.x1_0 - x), this.y2_0 + this.k_0 * (this.y1_0 - y), this.x2_0, this.y2_0); }; Cardinal.prototype.point_lu1900$ = function (x, y) { switch (this.pointStatus_0) { case 0: this.pointStatus_0 = 1; if (this.lineStatus_0 > 0) this.path.lineTo_lu1900$(x, y); else this.path.moveTo_lu1900$(x, y); break; case 1: this.pointStatus_0 = 2; this.x1_0 = x; this.y1_0 = y; break; case 2: this.pointStatus_0 = 3; this.curve_0(x, y); break; default:this.curve_0(x, y); break; } this.x0_0 = this.x1_0; this.x1_0 = this.x2_0; this.x2_0 = x; this.y0_0 = this.y1_0; this.y1_0 = this.y2_0; this.y2_0 = y; }; Cardinal.$metadata$ = { kind: Kind_CLASS, simpleName: 'Cardinal', interfaces: [Curve] }; function CardinalClosed(path, tension) { if (tension === void 0) tension = 0.0; this.path_r9vshy$_0 = path; this.x0_0 = -1.0; this.y0_0 = -1.0; this.x1_0 = -1.0; this.y1_0 = -1.0; this.x2_0 = -1.0; this.y2_0 = -1.0; this.x3_0 = -1.0; this.y3_0 = -1.0; this.x4_0 = -1.0; this.y4_0 = -1.0; this.x5_0 = -1.0; this.y5_0 = -1.0; this.lineStatus_0 = -1; this.pointStatus_0 = -1; this.k_0 = (1.0 - tension) / 6.0; } Object.defineProperty(CardinalClosed.prototype, 'path', { get: function () { return this.path_r9vshy$_0; } }); CardinalClosed.prototype.areaStart = function () { }; CardinalClosed.prototype.areaEnd = function () { }; CardinalClosed.prototype.lineStart = function () { this.x0_0 = -1.0; this.y0_0 = -1.0; this.x1_0 = -1.0; this.y1_0 = -1.0; this.x2_0 = -1.0; this.y2_0 = -1.0; this.x3_0 = -1.0; this.y3_0 = -1.0; this.x4_0 = -1.0; this.y4_0 = -1.0; this.x5_0 = -1.0; this.y5_0 = -1.0; this.pointStatus_0 = 0; }; CardinalClosed.prototype.lineEnd = function () { switch (this.pointStatus_0) { case 1: this.path.moveTo_lu1900$(this.x3_0, this.y3_0); this.path.closePath(); break; case 2: this.path.lineTo_lu1900$(this.x3_0, this.y3_0); this.path.closePath(); break; case 3: this.point_lu1900$(this.x3_0, this.y3_0); this.point_lu1900$(this.x4_0, this.y4_0); this.point_lu1900$(this.x5_0, this.y5_0); break; } if (this.lineStatus_0 > 0) this.path.closePath(); this.lineStatus_0 = 1 - this.lineStatus_0 | 0; }; CardinalClosed.prototype.curve_0 = function (x, y) { this.path.bezierCurveTo_15yvbs$(this.x1_0 + this.k_0 * (this.x2_0 - this.x0_0), this.y1_0 + this.k_0 * (this.y2_0 - this.y0_0), this.x2_0 + this.k_0 * (this.x1_0 - x), this.y2_0 + this.k_0 * (this.y1_0 - y), this.x2_0, this.y2_0); }; CardinalClosed.prototype.point_lu1900$ = function (x, y) { switch (this.pointStatus_0) { case 0: this.pointStatus_0 = 1; this.x3_0 = x; this.y3_0 = y; break; case 1: this.pointStatus_0 = 2; this.x4_0 = x; this.y4_0 = y; this.path.moveTo_lu1900$(this.x4_0, this.y4_0); break; case 2: this.pointStatus_0 = 3; this.x5_0 = x; this.y5_0 = y; break; default:this.curve_0(x, y); break; } this.x0_0 = this.x1_0; this.x1_0 = this.x2_0; this.x2_0 = x; this.y0_0 = this.y1_0; this.y1_0 = this.y2_0; this.y2_0 = y; }; CardinalClosed.$metadata$ = { kind: Kind_CLASS, simpleName: 'CardinalClosed', interfaces: [Curve] }; function CardinalOpen(path, tension) { if (tension === void 0) tension = 0.0; this.path_uvw258$_0 = path; this.x0_0 = -1.0; this.y0_0 = -1.0; this.x1_0 = -1.0; this.y1_0 = -1.0; this.x2_0 = -1.0; this.y2_0 = -1.0; this.lineStatus_0 = -1; this.pointStatus_0 = -1; this.k_0 = (1.0 - tension) / 6.0; } Object.defineProperty(CardinalOpen.prototype, 'path', { get: function () { return this.path_uvw258$_0; } }); CardinalOpen.prototype.areaStart = function () { this.lineStatus_0 = 0; }; CardinalOpen.prototype.areaEnd = function () { this.lineStatus_0 = -1; }; CardinalOpen.prototype.lineStart = function () { this.x0_0 = -1.0; this.y0_0 = -1.0; this.x1_0 = -1.0; this.y1_0 = -1.0; this.x2_0 = -1.0; this.y2_0 = -1.0; this.pointStatus_0 = 0; }; CardinalOpen.prototype.lineEnd = function () { if (this.lineStatus_0 > -1) { if (this.lineStatus_0 > 0) { this.path.closePath(); } this.lineStatus_0 = 1 - this.lineStatus_0 | 0; } }; CardinalOpen.prototype.curve_0 = function (x, y) { this.path.bezierCurveTo_15yvbs$(this.x1_0 + this.k_0 * (this.x2_0 - this.x0_0), this.y1_0 + this.k_0 * (this.y2_0 - this.y0_0), this.x2_0 + this.k_0 * (this.x1_0 - x), this.y2_0 + this.k_0 * (this.y1_0 - y), this.x2_0, this.y2_0); }; CardinalOpen.prototype.point_lu1900$ = function (x, y) { switch (this.pointStatus_0) { case 0: this.pointStatus_0 = 1; break; case 1: this.pointStatus_0 = 2; break; case 2: this.pointStatus_0 = 3; if (this.lineStatus_0 > 0) this.path.lineTo_lu1900$(this.x2_0, this.y2_0); else this.path.moveTo_lu1900$(this.x2_0, this.y2_0); break; case 3: this.pointStatus_0 = 4; this.curve_0(x, y); break; default:this.curve_0(x, y); break; } this.x0_0 = this.x1_0; this.x1_0 = this.x2_0; this.x2_0 = x; this.y0_0 = this.y1_0; this.y1_0 = this.y2_0; this.y2_0 = y; }; CardinalOpen.$metadata$ = { kind: Kind_CLASS, simpleName: 'CardinalOpen', interfaces: [Curve] }; function CatmullRom(path, alpha) { if (alpha === void 0) alpha = 0.5; this.path_cl9sj8$_0 = path; this.alpha = alpha; this.x0_0 = -1.0; this.y0_0 = -1.0; this.x1_0 = -1.0; this.y1_0 = -1.0; this.x2_0 = -1.0; this.y2_0 = -1.0; this._l01_a_0 = 0.0; this._l12_a_0 = 0.0; this._l23_a_0 = 0.0; this._l01_2a_0 = 0.0; this._l12_2a_0 = 0.0; this._l23_2a_0 = 0.0; this.lineStatus_0 = -1; this.pointStatus_0 = -1; } Object.defineProperty(CatmullRom.prototype, 'path', { get: function () { return this.path_cl9sj8$_0; } }); CatmullRom.prototype.areaStart = function () { this.lineStatus_0 = 0; }; CatmullRom.prototype.areaEnd = function () { this.lineStatus_0 = -1; }; CatmullRom.prototype.lineStart = function () { this.x0_0 = -1.0; this.y0_0 = -1.0; this.x1_0 = -1.0; this.y1_0 = -1.0; this.x2_0 = -1.0; this.y2_0 = -1.0; this._l01_a_0 = 0.0; this._l12_a_0 = 0.0; this._l23_a_0 = 0.0; this._l01_2a_0 = 0.0; this._l12_2a_0 = 0.0; this._l23_2a_0 = 0.0; this.pointStatus_0 = 0; }; CatmullRom.prototype.lineEnd = function () { switch (this.pointStatus_0) { case 2: this.path.lineTo_lu1900$(this.x2_0, this.y2_0); break; case 3: this.point_lu1900$(this.x2_0, this.y2_0); break; } if (this.lineStatus_0 > -1) { if (this.lineStatus_0 > 0) { this.path.closePath(); } this.lineStatus_0 = 1 - this.lineStatus_0 | 0; } }; CatmullRom.prototype.curve_0 = function (x, y) { var _x1 = this.x1_0; var _y1 = this.y1_0; var _x2 = this.x2_0; var _y2 = this.y2_0; if (this._l01_a_0 > epsilon) { var a = 2 * this._l01_2a_0 + 3 * this._l01_a_0 * this._l12_a_0 + this._l12_2a_0; var n = 3 * this._l01_a_0 * (this._l01_a_0 + this._l12_a_0); _x1 = (this.x1_0 * a - this.x0_0 * this._l12_2a_0 + this.x2_0 * this._l01_2a_0) / n; _y1 = (this.y1_0 * a - this.y0_0 * this._l12_2a_0 + this.y2_0 * this._l01_2a_0) / n; } if (this._l23_a_0 > epsilon) { var b = 2 * this._l23_2a_0 + 3 * this._l23_a_0 * this._l12_a_0 + this._l12_2a_0; var m = 3 * this._l23_a_0 * (this._l23_a_0 + this._l12_a_0); _x2 = (this.x2_0 * b + this.x1_0 * this._l23_2a_0 - x * this._l12_2a_0) / m; _y2 = (this.y2_0 * b + this.y1_0 * this._l23_2a_0 - y * this._l12_2a_0) / m; } this.path.bezierCurveTo_15yvbs$(_x1, _y1, _x2, _y2, this.x2_0, this.y2_0); }; CatmullRom.prototype.point_lu1900$ = function (x, y) { if (this.pointStatus_0 > 0) { var x23 = this.x2_0 - x; var y23 = this.y2_0 - y; var $receiver = x23 * x23 + y23 * y23; var x_0 = this.alpha; this._l23_2a_0 = Math_0.pow($receiver, x_0); var x_1 = this._l23_2a_0; this._l23_a_0 = Math_0.sqrt(x_1); } switch (this.pointStatus_0) { case 0: this.pointStatus_0 = 1; if (this.lineStatus_0 > 0) this.path.lineTo_lu1900$(x, y); else this.path.moveTo_lu1900$(x, y); break; case 1: this.pointStatus_0 = 2; break; case 2: this.pointStatus_0 = 3; this.curve_0(x, y); break; default:this.curve_0(x, y); break; } this._l01_a_0 = this._l12_a_0; this._l12_a_0 = this._l23_a_0; this._l01_2a_0 = this._l12_2a_0; this._l12_2a_0 = this._l23_2a_0; this.x0_0 = this.x1_0; this.x1_0 = this.x2_0; this.x2_0 = x; this.y0_0 = this.y1_0; this.y1_0 = this.y2_0; this.y2_0 = y; }; CatmullRom.$metadata$ = { kind: Kind_CLASS, simpleName: 'CatmullRom', interfaces: [Curve] }; function CatmullRomClosed(path, alpha) { if (alpha === void 0) alpha = 0.5; this.path_k2b4t4$_0 = path; this.alpha = alpha; this.x0_0 = -1.0; this.y0_0 = -1.0; this.x1_0 = -1.0; this.y1_0 = -1.0; this.x2_0 = -1.0; this.y2_0 = -1.0; this.x3_0 = -1.0; this.y3_0 = -1.0; this.x4_0 = -1.0; this.y4_0 = -1.0; this.x5_0 = -1.0; this.y5_0 = -1.0; this._l01_a_0 = 0.0; this._l12_a_0 = 0.0; this._l23_a_0 = 0.0; this._l01_2a_0 = 0.0; this._l12_2a_0 = 0.0; this._l23_2a_0 = 0.0; this.pointStatus_0 = -1; } Object.defineProperty(CatmullRomClosed.prototype, 'path', { get: function () { return this.path_k2b4t4$_0; } }); CatmullRomClosed.prototype.areaStart = function () { }; CatmullRomClosed.prototype.areaEnd