/* * SMP optimization is possible. * But, not yet. * If there is performance issue at 'cutout', this optimization can introduced. */ void wsheet_cutout_lines(struct wsheet* wsh, int32_t l, int32_t t, int32_t r, int32_t b) { int32_t i, j; /* list of node which value is 'struct curve' */ struct list_link lrm, ladd; /* * "NULL == wsh->ucmd" means this is NOT USER Command! */ wassert(!wsh->ucmd || UCMD_CUT == wsh->ucmd->ty); list_init_link(&lrm); list_init_link(&ladd); for (i = 0; i < wsh->rowN; i++) { for (j = 0; j < wsh->colN; j++) { if (rect_is_overlap(_divL(wsh, j), _divT(wsh, i), _divR(wsh, j), _divB(wsh, i), l, t, r, b)) { /* * division affected by cutout rectangle. */ div_cutout(&wsh->divs[i][j], &lrm, &ladd, l, t, r, b); } } } ucmd_cut_data(wsh->ucmd, &lrm, &ladd); }
void wsheet_add_curve(struct wsheet* wsh, const int32_t* pts, uint16_t nrpts, uint8_t thick, uint16_t color) { void _add_pointnd_last(struct list_link* hd, int32_t x, int32_t y) { if (hd) pointnd_add_last(hd, x, y); } void __add_curve(struct div* div, struct list_link* hd) { if (hd && list_size(hd) > 0) { struct curve* crv = _create_curve_pointnd_list(hd); crv->color = color; crv->thick = thick; div_add_curve(div, crv); if (wsh->ucmd) ucmd_crv_data(wsh->ucmd, crv); /* free memory for new start */ pointnd_free_list(hd); } } int32_t x0, y0, x1, y1, itx, ity; int32_t ri, ci; /* row/column index */ const int32_t *pt, *ptend; struct list_link hd, *phd; if (nrpts < 2) { wwarn(); return; } /* * "NULL == wsh->ucmd" means this is NOT USER Command! */ wassert(!wsh->ucmd || UCMD_CURVE == wsh->ucmd->ty); list_init_link(&hd); pt = pts; ptend = pts + (nrpts * 2); /* * initial setting */ x0 = *pt++; y0 = *pt++; x1 = *pt++; y1 = *pt++; /* wlogd("ADD : %d, %d, %d, %d", x0, y0, x1, y1); */ #define __update_division_info(x, y) \ do { \ ci = _divI(x, wsh->divW); \ ri = _divI(y, wsh->divH); \ phd = (_is_valid_div_index(wsh, ri, ci))? &hd: NULL; \ } while (0) __update_division_info(x0, y0); while (pt <= ptend) { _add_pointnd_last(phd, x0, y0); if (_add_line(phd, _divL(wsh, ci), _divT(wsh, ri), _divR(wsh, ci), _divB(wsh, ri), x0, y0, x1, y1, &itx, &ity)) { /* * add intersection point * this is last point of this curve. */ _add_pointnd_last(phd, itx, ity); __add_curve(&wsh->divs[ri][ci], phd); /* * division is changed!! * update division */ x0 = itx; y0 = ity; __update_division_info(x0, y0); } else { x0 = x1; y0 = y1; x1 = *pt++; y1 = *pt++; } } /* add last point */ _add_pointnd_last(phd, x0, y0); __add_curve(&wsh->divs[ri][ci], phd); #undef __update_division_info }
void _STLP_CALL complex<double>::_div(const double& __z1_r, const double& __z2_r, const double& __z2_i, double& __res_r, double& __res_i) { _divT(__z1_r, __z2_r, __z2_i, __res_r, __res_i); }
void _STLP_CALL complex<long double>::_div(const long double& __z1_r, const long double& __z2_r, const long double& __z2_i, long double& __res_r, long double& __res_i) { _divT(__z1_r, __z2_r, __z2_i, __res_r, __res_i); }
void _STLP_CALL complex<float>::_div(const float& __z1_r, const float& __z2_r, const float& __z2_i, float& __res_r, float& __res_i) { _divT(__z1_r, __z2_r, __z2_i, __res_r, __res_i); }