예제 #1
0
void
wheelArrow(wheelPS *wps, double x0, double y0, double x1, double y1,
           double alen, double awidth) {
    double len, dir[2], perp[2];

    dir[0] = x0 - x1;
    dir[1] = y0 - y1;
    ELL_2V_NORM(dir, dir, len);
    ELL_2V_SET(perp, -dir[1], dir[0]);
    fprintf(wps->file, "%g %g M\n", WPS_X(x0), WPS_Y(y0));
    fprintf(wps->file, "%g %g L S\n",
            WPS_X(x1 + alen*dir[0]/2),
            WPS_Y(y1 + alen*dir[1]/2));
    if (alen && awidth) {
        if (len < alen) {
            awidth *= len/alen;
            alen = len;
        }
        fprintf(wps->file, "%g %g M\n",
                WPS_X(x1 + alen*dir[0] + awidth*perp[0]),
                WPS_Y(y1 + alen*dir[1] + awidth*perp[1]));
        fprintf(wps->file, "%g %g L\n", WPS_X(x1), WPS_Y(y1));
        fprintf(wps->file, "%g %g L CP F\n",
                WPS_X(x1 + alen*dir[0] - awidth*perp[0]),
                WPS_Y(y1 + alen*dir[1] - awidth*perp[1]));
    }
    return;
}
예제 #2
0
파일: eigen.c 프로젝트: BRAINSia/teem
void
ell_2m_1d_nullspace_d(double ans[2], const double _n[4]) {
  double n[4], dot, len, span[2];
  /* static const char me[]="ell_2m_1d_nullspace_d"; */

  ELL_2M_TRANSPOSE(n, _n);
  dot = ELL_2V_DOT(n + 2*0, n + 2*1);
  /*
  fprintf(stderr, "!%s: n = {{%g,%g},{%g,%g}}\n", me,
          n[0], n[1], n[2], n[3]);
  fprintf(stderr, "!%s: dot = %g\n", me, dot);
  */
  if (dot > 0) {
    ELL_2V_ADD2(span, n + 2*0, n + 2*1);
  } else {
    ELL_2V_SUB(span, n + 2*0, n + 2*1);
  }
  /* have found good description of column span;
     now need the (perpendicular) nullspace */
  ans[0] = span[1];
  ans[1] = -span[0];
  ELL_2V_NORM(ans, ans, len);
  /*
  if (!(AIR_EXISTS(ans[0]) && AIR_EXISTS(ans[1]))) {
    fprintf(stderr, "!%s: bad! %g %g\n", me, ans[0], ans[1]);
  }
  */
  return;
}
예제 #3
0
파일: eigen.c 프로젝트: BRAINSia/teem
void
_ell_22v_enforce_orthogonality(double uu[2], double _vv[2]) {
  double dot, vv[2], len;

  dot = ELL_2V_DOT(uu, _vv);
  ELL_2V_SCALE_ADD2(vv, 1, _vv, -dot, uu);
  ELL_2V_NORM(_vv, vv, len);
  return;
}