static void plztx(const char *opt, PLFLT dx, PLFLT dy, PLFLT wx, PLFLT wy1, PLFLT wy2, PLFLT disp, PLFLT pos, PLFLT just, const char *text) { PLINT refx = 0, refy = 0, x = 0, y = 0, vert = 0; PLFLT shift, cc, ss, wy; PLFLT xdv, ydv, xmm, ymm, refxmm, refymm, xform[4], diag; PLFLT dispx, dispy; PLFLT chrdef, chrht; cc = plsc->wmxscl * dx; ss = plsc->wmyscl * dy; diag = sqrt(cc * cc + ss * ss); cc /= diag; ss /= diag; wy = wy1 + pos * (wy2 - wy1); if (plP_stsearch(opt, 'v')) vert = 0; else if (plP_stsearch(opt, 'h')) vert = 1; if (vert) { xform[0] = 0.0; xform[1] = -cc; xform[2] = 1.0; xform[3] = -ss; } else { xform[0] = cc; xform[1] = 0.0; xform[2] = ss; xform[3] = 1.0; } xdv = plP_wcdcx(wx); ydv = plP_wcdcy(wy); dispx = -disp * cc; dispy = -disp * ss; plgchr(&chrdef, &chrht); shift = (just == 0.0) ? 0.0 : plstrl(text) * just; xmm = plP_dcmmx(xdv) + dispx * chrht; ymm = plP_dcmmy(ydv) + dispy * chrht; refxmm = xmm - shift * xform[0]; refymm = ymm - shift * xform[2]; x = plP_mmpcx(xmm); y = plP_mmpcy(ymm); refx = plP_mmpcx(refxmm); refy = plP_mmpcy(refymm); plP_text(0, just, xform, x, y, refx, refy, text); }
void c_plptex(PLFLT wx, PLFLT wy, PLFLT dx, PLFLT dy, PLFLT just, const char *text) { PLINT x, y, refx, refy; PLFLT xdv, ydv, xmm, ymm, refxmm, refymm, shift, cc, ss; PLFLT xform[4], diag; PLFLT chrdef, chrht; PLFLT dispx, dispy; if (plsc->level < 3) { plabort("plptex: Please set up window first"); return; } if (dx == 0.0 && dy == 0.0) { dx = 1.0; dy = 0.0; } cc = plsc->wmxscl * dx; ss = plsc->wmyscl * dy; diag = sqrt(cc * cc + ss * ss); cc /= diag; ss /= diag; xform[0] = cc; xform[1] = -ss; xform[2] = ss; xform[3] = cc; xdv = plP_wcdcx(wx); ydv = plP_wcdcy(wy); dispx = 0.; dispy = 0.; /* Convert to physical units (mm) and compute shifts */ plgchr(&chrdef, &chrht); shift = (just == 0.0) ? 0.0 : plstrl(text) * just; xmm = plP_dcmmx(xdv) + dispx * chrht; ymm = plP_dcmmy(ydv) + dispy * chrht; refxmm = xmm - shift * xform[0]; refymm = ymm - shift * xform[2]; x = plP_mmpcx(xmm); y = plP_mmpcy(ymm); refx = plP_mmpcx(refxmm); refy = plP_mmpcy(refymm); plP_text(0, just, xform, x, y, refx, refy, text); }
static void plxytx(PLFLT wx1, PLFLT wy1, PLFLT wx2, PLFLT wy2, PLFLT disp, PLFLT pos, PLFLT just, const char *text) { PLINT x, y, refx, refy; PLFLT shift, cc, ss, wx, wy; PLFLT xdv, ydv, xmm, ymm, refxmm, refymm, xform[4], diag; PLFLT dispx, dispy; PLFLT chrdef, chrht; cc = plsc->wmxscl * (wx2 - wx1); ss = plsc->wmyscl * (wy2 - wy1); diag = sqrt(cc * cc + ss * ss); cc /= diag; ss /= diag; wx = wx1 + pos * (wx2 - wx1); wy = wy1 + pos * (wy2 - wy1); xform[0] = cc; xform[1] = 0.0; xform[2] = ss; xform[3] = 1.0; xdv = plP_wcdcx(wx); ydv = plP_wcdcy(wy); dispx = 0.; dispy = -disp; plgchr(&chrdef, &chrht); shift = (just == 0.0) ? 0.0 : plstrl(text) * just; xmm = plP_dcmmx(xdv) + dispx * chrht; ymm = plP_dcmmy(ydv) + dispy * chrht; refxmm = xmm - shift * xform[0]; refymm = ymm - shift * xform[2]; x = plP_mmpcx(xmm); y = plP_mmpcy(ymm); refx = plP_mmpcx(refxmm); refy = plP_mmpcy(refymm); plP_text(0, just, xform, x, y, refx, refy, text); }