Пример #1
0
static void
helix (Display *dpy, Window window, struct state *st)
{
  int xmid = st->width / 2;
  int ymid = st->height / 2;
  int limit = 1 + (360 / gcd (360, st->d_angle));

  if (st->i == 0)
    {
      st->x1 = xmid;
      st->y1 = ymid + st->radius2;
      st->x2 = xmid;
      st->y2 = ymid + st->radius1;
      st->angle = 0;
    }
  
/*  for (st->i = 0; st->i < limit; st->i++)*/
    {
      int tmp;
#define pmod(x,y) (tmp=((x) % (y)), (tmp >= 0 ? tmp : (tmp + (y))))

      st->x1 = xmid + (((double) st->radius1) * st->sins [pmod ((st->angle * st->factor1), 360)]);
      st->y1 = ymid + (((double) st->radius2) * st->coss [pmod ((st->angle * st->factor2), 360)]);
      XDrawLine (dpy, window, st->draw_gc, st->x1, st->y1, st->x2, st->y2);
      st->x2 = xmid + (((double) st->radius2) * st->sins [pmod ((st->angle * st->factor3), 360)]);
      st->y2 = ymid + (((double) st->radius1) * st->coss [pmod ((st->angle * st->factor4), 360)]);
      XDrawLine (dpy, window, st->draw_gc, st->x1, st->y1, st->x2, st->y2);
      st->angle += st->d_angle;
    }
    st->i++;

    if (st->i >= limit)
      st->dstate = LINGER;
}
Пример #2
0
bool insertInstance(RV_FIN_Data *fd, OptionSetKeeper &keeper, World *world)
{
  Mesh *mesh;
  ModList *mlist;
  FIN_Poly_Mod pmod(fd);
  char *usename;
  int nfound;


  nfound=find_file(fd->fname, true, &usename, SUFFIX_PRM_IM, SUFFIX_PRM_STD, NULL);
  if(nfound == 0)
    {
      perror(0, ERROR_FILE_ROPEN, "Cannot open '%s*.%s' or '%s*.%s'",
	     fd->fname, SUFFIX_PRM_IM, fd->fname, SUFFIX_PRM_STD);
      return false;
    };

  if(nfound > 1)
    {
      perror(0, ERROR_AMBIGUOUS_NAME, "Too much possibilities for '%s'",
	     usename);
      free(usename);
      return false;
    };
  
  
  if(filehastype(usename,SUFFIX_PRM_IM))
    mesh=create_ip_mesh(usename);
  else
    mesh=create_prm_mesh(usename);

  if(mesh != NULL)
    lprintf(2,"  insert '%s'\n",usename);
  else
    {
      perror(0, ERROR_FILE_ROPEN, "Cannot open '%s'", usename);
      free(usename);
      return false;
    };

  breakfname(usename);

  modifyMesh(mesh,fd);
  mesh->apply(&pmod);

  mlist=keeper.lookup(usename);
  //  printf("MESH %s\n",usename);
  //  mlist->dump("  ");

  mesh->apply(mlist);

  world->addMesh(mesh);

  return true;
}
Пример #3
0
Файл: PON.cpp Проект: eddrda/cpp
bool test(const unsigned long long& a, const unsigned long long& d, const int& s, const unsigned long long& n) {
  unsigned long long res = pmod(a, d, n);
  if (res == 1 || res == n - 1) {    
    return 1;
  } else {
    for (int r = 1; r < s; ++r) {
      res = mul(res, res, n) % n;
      if (res == n - 1) return 1;
    }
  }
  return 0;
}
Пример #4
0
static void
trig (Display *dpy, Window window, struct state *st)
{
  int xmid = st->width / 2;
  int ymid = st->height / 2;

/*  while (st->d_angle >= -360 && st->d_angle <= 360)*/
    {
      int tmp;
      int angle = st->d_angle + st->d_angle_offset;
      st->x1 = (st->sins [pmod(angle * st->factor1, 360)] * xmid) + xmid;
      st->y1 = (st->coss [pmod(angle * st->factor1, 360)] * ymid) + ymid;
      st->x2 = (st->sins [pmod(angle * st->factor2 + st->offset, 360)] * xmid) + xmid;
      st->y2 = (st->coss [pmod(angle * st->factor2 + st->offset, 360)] * ymid) + ymid;
      XDrawLine(dpy, window, st->draw_gc, st->x1, st->y1, st->x2, st->y2);
      tmp = (int) 360 / (2 * st->density * st->factor1 * st->factor2);
      if (tmp == 0)	/* Do not want it getting stuck... */
	tmp = 1;	/* Would not need if floating point */
      st->d_angle += st->dir * tmp;
    }

  if (st->d_angle < -360 || st->d_angle > 360)
    st->dstate = LINGER;
}
Пример #5
0
const pdstring &mapped_module::fullName() const { 
    return pmod()->fullName(); 
}
Пример #6
0
void mapped_module::dumpMangled(pdstring prefix) const {
    // No reason to have this process specific... it just dumps
    // function names.
    pmod()->dumpMangled(prefix);
}
Пример #7
0
supportedLanguages mapped_module::language() const { 
    return pmod()->language(); 
}
Пример #8
0
bool mapped_module::isNativeCompiler() const {
    // This should probably be per-module info at some point; some
    // .o's might be compiled native, and others not.
    return pmod()->exec()->isNativeCompiler();
}