示例#1
0
int main()
{
  initRand();
  const int size=26;
  int a[size], b[size], out[size];
    
  // make up some random permuations
  shuffle(a, size);
  shuffle(b, size);

  for (int i=0; i<200; i++) {
    print((char *)"B", b, size);
    print((char *)"A", a, size);
    pmx(a, b, out, 3, size);
    print((char *)"OUT", out, size);
    printf("\n");
    if (!isPermP(out, size)) {
      printf("ERROR: NOT PERM: ");
      print((char *)"", out, size);
    }
  }
     

  return 0;
}
示例#2
0
文件: Cone.cpp 项目: play113/swer
void CCone::GetGripperPositions(std::list<GripData> *list, bool just_for_endof)
{
	gp_Pnt o = m_pos.Location();
	gp_Pnt px(o.XYZ() + m_pos.XDirection().XYZ() * m_r1);
	gp_Dir z_dir = m_pos.XDirection() ^ m_pos.YDirection();
	gp_Pnt py(o.XYZ() + m_pos.YDirection().XYZ() * m_r1);
	gp_Pnt pyz(o.XYZ() + m_pos.YDirection().XYZ() * m_r2 + z_dir.XYZ() * m_height);
	gp_Pnt pmx(o.XYZ() + m_pos.XDirection().XYZ() * (-m_r1));
	gp_Pnt pz(o.XYZ() + z_dir.XYZ() * m_height);
	gp_Pnt pxz(o.XYZ() + m_pos.XDirection().XYZ() * m_r2 + z_dir.XYZ() * m_height);
	list->push_back(GripData(GripperTypeTranslate,o.X(),o.Y(),o.Z(),NULL));
	list->push_back(GripData(GripperTypeStretch,px.X(),px.Y(),px.Z(),NULL));
	list->push_back(GripData(GripperTypeObjectScaleZ,pz.X(),pz.Y(),pz.Z(),NULL));
	list->push_back(GripData(GripperTypeStretch,pxz.X(),pxz.Y(),pxz.Z(),NULL));
	list->push_back(GripData(GripperTypeRotateObject,py.X(),py.Y(),py.Z(),NULL));
	list->push_back(GripData(GripperTypeRotateObject,pmx.X(),pmx.Y(),pmx.Z(),NULL));
}
示例#3
0
文件: vm.c 项目: davidbalbert/thimble
Pte *
walkpgmap(Pml4e *pgmap, void *va, int alloc)
{
    Pdpe *pdirpt;
    Pde *pgdir;
    Pte *pgtab;

    pdirpt = pgmapget(pgmap, pmx(va), alloc);

    if (pdirpt == nil)
        return nil;

    pgdir = pgmapget(pdirpt, pdpx(va), alloc);

    if (pgdir == nil)
        return nil;

    pgtab = pgmapget(pgdir, pdx(va), alloc);

    if (pgtab == nil)
        return nil;

    return &pgtab[ptx(va)];
}