/* TRITIUM-PROVENANCE sha256=7ab3f2fa4f8df8640be261938568a4bd5a768201d8fa662258c66b76d58f2c1d lang=c */ /* TRITIUM-HEIGHT high=0.16 mid=0.62 low=0.23 fns=16 */ #include #include // TRITIUM-PSEUDO fn=fsin //| fn fsin(x): //| return i * x_6 // TRITIUM-HEIGHT fn=fsin high=0.00 mid=0.59 low=0.41 double fsin(double x) { double pi; double two; double i; double x_4; double x_2; double x_5; double x_7; double x_3; double x_6; pi = 3.141592653589793; two = 6.283185307179586; i = x; while (i > pi) { i = (i - two); } while (i <= (-pi)) { i = (i + two); } x_4 = i * i; x_2 = x_4 * 2.7557319223985893e-06; x_5 = -0.0001984126984126984 + x_2; x_7 = 0.008333333333333333 + (x_4 * x_5); x_3 = -0.16666666666666666 + (x_4 * x_7); x_6 = 1.0 + (x_4 * x_3); return i * x_6; } // TRITIUM-PSEUDO fn=fcos //| fn fcos(x): //| return x_6 // TRITIUM-HEIGHT fn=fcos high=0.00 mid=0.59 low=0.41 double fcos(double x) { double pi; double two; double i; double x_5; double x_3; double x_2; double x_7; double x_4; double x_6; pi = 3.141592653589793; two = 6.283185307179586; i = x; while (i > pi) { i = (i - two); } while (i <= (-pi)) { i = (i + two); } x_5 = i * i; x_3 = x_5 * 2.48015873015873e-05; x_2 = -0.001388888888888889 + x_3; x_7 = 0.041666666666666664 + (x_5 * x_2); x_4 = -0.5 + (x_5 * x_7); x_6 = 1.0 + (x_5 * x_4); return x_6; } // TRITIUM-PSEUDO fn=fsqrt //| fn fsqrt(x): //| return 0.0 //| return i_2 // TRITIUM-HEIGHT fn=fsqrt high=0.00 mid=0.69 low=0.31 double fsqrt(double x) { int64_t i; int fcmp4; double i_2; double x_2; fcmp4 = x <= 0.0; if (fcmp4) { return 0.0; } else { i_2 = x; i = 0L; while (i < 8L) { x_2 = 0.5 * (i_2 + (x / i_2)); i_2 = x_2; i = (i + 1L); } return i_2; } } // TRITIUM-PSEUDO fn=haversine_f //| fn haversine_f(lat1, lon1, lat2, lon2): //| fsin(...) //| fcos(...) //| fsqrt(...) //| return x_3 // TRITIUM-HEIGHT fn=haversine_f high=0.71 mid=0.29 low=0.00 double haversine_f(double lat1, double lon1, double lat2, double lon2) { double x_2; double aa; double x; double bb; double h; double x_3; x_2 = (lat2 - lat1) / 2.0; aa = fsin(x_2); x = (lon2 - lon1) / 2.0; bb = fsin(x); h = ((aa * aa) + ((((fcos(lat1)) * (fcos(lat2))) * bb) * bb)); x_3 = 2.0 * (fsqrt(h)); return x_3; } // TRITIUM-PSEUDO fn=haversine_km_f //| fn haversine_km_f(lat1, lon1, lat2, lon2): //| double x //| x = 6371.0 * (haversine_f(lat1, lon1, lat2, lon2)) //| return x // TRITIUM-HEIGHT fn=haversine_km_f high=0.75 mid=0.25 low=0.00 double haversine_km_f(double lat1, double lon1, double lat2, double lon2) { double x; x = 6371.0 * (haversine_f(lat1, lon1, lat2, lon2)); return x; } // TRITIUM-PSEUDO fn=_atan_unit //| fn _atan_unit(a): //| return x_9 // TRITIUM-HEIGHT fn=_atan_unit high=0.00 mid=1.00 low=0.00 role=leaf_charset double _atan_unit(double a) { double t8; int64_t folded; double i; int fcmp9; double x_10; double x_5; double x_8; double x_2; double x_3; double x; double x_11; double x_4; double x_6; double x_9; double x_7; t8 = 0.41421356237309503; folded = 0L; i = a; fcmp9 = i > t8; if (fcmp9) { x_10 = 1.0 - i; x_5 = 1.0 + i; i = (x_10 / x_5); folded = 1L; } x_8 = i * i; x_2 = x_8 * -0.09090909090909091; x_3 = 0.1111111111111111 + x_2; x = -0.14285714285714285 + (x_8 * x_3); x_11 = 0.2 + (x_8 * x); x_4 = -0.3333333333333333 + (x_8 * x_11); x_6 = 1.0 + (x_8 * x_4); x_9 = i * x_6; if (folded == 1L) { x_7 = 0.7853981633974483 - x_9; x_9 = x_7; } return x_9; } // TRITIUM-PSEUDO fn=fatan_poly //| fn fatan_poly(z): //| _atan_unit(...) //| return r // TRITIUM-HEIGHT fn=fatan_poly high=0.10 mid=0.90 low=0.00 role=leaf_charset double fatan_poly(double z) { int64_t neg; int64_t swapped; double i; int fcmp7; double x_4; int fcmp11; double x; double r; double x_2; double x_3; neg = 0L; i = z; fcmp7 = i < 0.0; if (fcmp7) { x_4 = 0.0 - i; i = x_4; neg = 1L; } swapped = 0L; fcmp11 = i > 1.0; if (fcmp11) { x = 1.0 / i; i = x; swapped = 1L; } r = _atan_unit(i); if (swapped == 1L) { x_2 = 1.5707963267948966 - r; r = x_2; } if (neg == 1L) { x_3 = 0.0 - r; r = x_3; } return r; } // TRITIUM-PSEUDO fn=fatan2 //| fn fatan2(y, x): //| fatan_poly(...) //| return 0.0 //| return 0.0 //| return x_2 //| return x_6 //| return x_4 //| return fatan_poly_2 // TRITIUM-HEIGHT fn=fatan2 high=0.13 mid=0.87 low=0.00 role=leaf_charset double fatan2(double y, double x) { double i; int fcmp6; double x_7; double i_2; int fcmp11; double x_3; int fcmp16; int fcmp18; double fatan_poly_2; int fcmp25; double x_5; int fcmp32; int fcmp34; double x_2; double x_6; int fcmp40; double x_4; i = y; fcmp6 = i < 0.0; if (fcmp6) { x_7 = 0.0 - i; i = x_7; } i_2 = x; fcmp11 = i_2 < 0.0; if (fcmp11) { x_3 = 0.0 - i_2; i_2 = x_3; } fcmp16 = i_2 >= i; if (fcmp16) { fcmp18 = i_2 == 0.0; if (fcmp18) { return 0.0; } else { fatan_poly_2 = fatan_poly(i / i_2); } } else { fcmp25 = i == 0.0; if (fcmp25) { return 0.0; } else { x_5 = 1.5707963267948966 - (fatan_poly(i_2 / i)); fatan_poly_2 = x_5; } } fcmp32 = x < 0.0; if (fcmp32) { fcmp34 = y < 0.0; if (fcmp34) { x_2 = fatan_poly_2 - 3.141592653589793; return x_2; } else { x_6 = 3.141592653589793 - fatan_poly_2; return x_6; } } else { fcmp40 = y < 0.0; if (fcmp40) { x_4 = 0.0 - fatan_poly_2; return x_4; } else { return fatan_poly_2; } } } // TRITIUM-PSEUDO fn=bearing_f //| fn bearing_f(lat1, lon1, lat2, lon2): //| fsin(...) //| fcos(...) //| fatan2(...) //| return br // TRITIUM-HEIGHT fn=bearing_f high=0.49 mid=0.51 low=0.00 double bearing_f(double lat1, double lon1, double lat2, double lon2) { double l2; double l1; double dl; double dlon1; double sd; double lat2a; double cl2; double ya; double lat1a; double cl1; double lat2b; double sl2; double t1; double lat1b; double sl1; double lat2c; double cl2b; double dlon2; double cd; double t2a; double t2; double xa; double yy; double xx; double br; l2 = lon2; l1 = lon1; dl = l2 - l1; dlon1 = dl; sd = fsin(dlon1); lat2a = lat2; cl2 = fcos(lat2a); ya = sd * cl2; lat1a = lat1; cl1 = fcos(lat1a); lat2b = lat2; sl2 = fsin(lat2b); t1 = cl1 * sl2; lat1b = lat1; sl1 = fsin(lat1b); lat2c = lat2; cl2b = fcos(lat2c); dlon2 = dl; cd = fcos(dlon2); t2a = sl1 * cl2b; t2 = t2a * cd; xa = t1 - t2; yy = ya; xx = xa; br = fatan2(yy, xx); return br; } // TRITIUM-PSEUDO fn=bearing_deg_f //| fn bearing_deg_f(lat1, lon1, lat2, lon2): //| bearing_f(...) //| return x // TRITIUM-HEIGHT fn=bearing_deg_f high=0.18 mid=0.36 low=0.46 double bearing_deg_f(double lat1, double lon1, double lat2, double lon2) { double br; double x; double x_2; double x_3; br = bearing_f(lat1, lon1, lat2, lon2); x = br * 57.29577951308232; while (x < 0.0) { x_2 = x + 360.0; x = x_2; } while (x >= 360.0) { x_3 = x - 360.0; x = x_3; } return x; } // TRITIUM-PSEUDO fn=interest_radius_f //| fn interest_radius_f(dx, dy, r): //| int fcmp13 //| fcmp13 = ((dx * dx) + (dy * dy)) <= (r * r) //| return (fcmp13) ? 1L : 0L // TRITIUM-HEIGHT fn=interest_radius_f high=0.00 mid=1.00 low=0.00 role=leaf_charset int64_t interest_radius_f(double dx, double dy, double r) { int fcmp13; fcmp13 = ((dx * dx) + (dy * dy)) <= (r * r); return (fcmp13) ? 1L : 0L; } // TRITIUM-PSEUDO fn=mmog_interest_filter //| fn mmog_interest_filter(vals, ys, n, cx, cy, r, out): //| interest_radius_f(...) //| return m // TRITIUM-HEIGHT fn=mmog_interest_filter high=0.14 mid=0.40 low=0.46 int64_t mmog_interest_filter(double* vals, double* ys, int64_t n, double cx, double cy, double r, int64_t* out) { int64_t m; int64_t i; int fcmp27; m = 0L; i = 0L; while (i < n) { fcmp27 = (interest_radius_f((vals[i] - cx), (ys[i] - cy), r)) == (double)(1L); if (fcmp27) { out[m] = i; m = (m + 1L); } i = (i + 1L); } return m; } // TRITIUM-PSEUDO fn=mmog_tick_rate_ok //| fn mmog_tick_rate_ok(last_ms, now_ms, min_dt): //| return ((now_ms - last_ms) >= min_dt) ? 1L : 0L // TRITIUM-HEIGHT fn=mmog_tick_rate_ok high=0.00 mid=1.00 low=0.00 role=leaf_charset int64_t mmog_tick_rate_ok(int64_t last_ms, int64_t now_ms, int64_t min_dt) { return ((now_ms - last_ms) >= min_dt) ? 1L : 0L; } // TRITIUM-PSEUDO fn=transform3d //| fn transform3d(x, y, z, r00, r01, r02, r10, r11, r12, r20, r21, r22, tx, ty, tz, out): //| out[0L] = ((((r00 * x) + (r01 * y)) + (r02 * z)) + tx) //| out[1L] = ((((r10 * x) + (r11 * y)) + (r12 * z)) + ty) //| out[2L] = ((((r20 * x) + (r21 * y)) + (r22 * z)) + tz) //| return 1L // TRITIUM-HEIGHT fn=transform3d high=0.00 mid=0.33 low=0.67 role=leaf_charset int64_t transform3d(double x, double y, double z, double r00, double r01, double r02, double r10, double r11, double r12, double r20, double r21, double r22, double tx, double ty, double tz, double* out) { out[0L] = ((((r00 * x) + (r01 * y)) + (r02 * z)) + tx); out[1L] = ((((r10 * x) + (r11 * y)) + (r12 * z)) + ty); out[2L] = ((((r20 * x) + (r21 * y)) + (r22 * z)) + tz); return 1L; } // TRITIUM-PSEUDO fn=project3d //| fn project3d(x, y, z, f, out): //| return 0L //| return 1L // TRITIUM-HEIGHT fn=project3d high=0.00 mid=0.48 low=0.52 role=leaf_charset int64_t project3d(double x, double y, double z, double f, double* out) { int fcmp6; fcmp6 = z == 0.0; if (fcmp6) { out[0L] = 0.0; out[1L] = 0.0; return 0L; } else { out[0L] = ((f * x) / z); out[1L] = ((f * y) / z); return 1L; } } // TRITIUM-PSEUDO fn=viewport //| fn viewport(u, v, w, h, out): //| return 1L // TRITIUM-HEIGHT fn=viewport high=0.00 mid=0.60 low=0.40 role=leaf_charset int64_t viewport(double u, double v, double w, double h, double* out) { double x_3; double x_4; double x; double x_2; x_3 = u + 1.0; x_4 = x_3 * 0.5; out[0L] = (x_4 * w); x = 1.0 - v; x_2 = x * 0.5; out[1L] = (x_2 * h); return 1L; }