Пример #1
0
/* maniuplate the coordinata points of a path */
void T1_ManipulatePath( T1_OUTLINE *path,
			void (*manipulate)(fractpel *x,fractpel *y,int type))
{

  struct segment *ipath;
  
  
  /* Step through the path list */
  ipath=(struct segment *)path;

  do {
    if (ipath->type==LINETYPE){
      manipulate( &(ipath->dest.x), &ipath->dest.y, LINETYPE);
#ifdef PRINT_PATHS_TO_STDOUT      
      printf("Line-Segment: -> (%f,%f)\n",
	     (ipath->dest.x)/(double)(0xFFFF),
	     -(ipath->dest.y)/(double)(0xFFFF));
#endif
    }
    if (ipath->type==MOVETYPE){
      manipulate( &(ipath->dest.x), &ipath->dest.y, MOVETYPE);
#ifdef PRINT_PATHS_TO_STDOUT      
      printf("Move-Segment: -> (%f,%f)\n",
	     (ipath->dest.x)/(double)(0xFFFF),
	     -(ipath->dest.y)/(double)(0xFFFF));
#endif
    }
    if (ipath->type==BEZIERTYPE){
      manipulate( &((struct beziersegment *)ipath)->B.x,
		  &((struct beziersegment *)ipath)->B.y,
		  BEZIERTYPE);
      manipulate( &((struct beziersegment *)ipath)->C.x,
		  &((struct beziersegment *)ipath)->C.y,
		  BEZIERTYPE);
      manipulate( &((struct beziersegment *)ipath)->dest.x,
		  &((struct beziersegment *)ipath)->dest.y,
		  BEZIERTYPE);
#ifdef PRINT_PATHS_TO_STDOUT      
      printf("Bezier-Segment: ... (%f,%f) ... (%f,%f) -> (%f,%f)\n",
	     (((struct beziersegment *)ipath)->B.x)/(double)(0xFFFF),
	     -(((struct beziersegment *)ipath)->B.y)/(double)(0xFFFF),
	     (((struct beziersegment *)ipath)->C.x)/(double)(0xFFFF),
	     -(((struct beziersegment *)ipath)->C.y)/(double)(0xFFFF),
	     (((struct beziersegment *)ipath)->dest.x)/(double)(0xFFFF),
	     -(((struct beziersegment *)ipath)->dest.y)/(double)(0xFFFF));
#endif
    }
    ipath=ipath->link;
  } while (ipath!=NULL);
  
}
Пример #2
0
main()
{
    int array[5];
    *array=manipulate(array);
    system("pause");
    return (0);

}
Пример #3
0
int main(void)
{
//	u8 t;
//	u8 len;	
//	u16 times=0;
//	float num;
	start_configration();
	
	//2016-07-25 增加内部校准  启动时的按键检测
	SoftKeyValue = OnceSoftKey();//无消抖的获取按键值  ScanKey();//
	if(SoftKeyValue==KEY_VALUE_5)//启动检测到func按键 置位校准标志位
	{
		SoftKeyValue = KEY_NULL;
		Is_Cal_Mode = 1;
		BUZZER_Open(0);delay_ms(1000);
		BUZZER_Open(0);delay_ms(1000);
		BUZZER_Open(0);delay_ms(1000);
		BUZZER_Open(0);delay_ms(1000);
	}
	
	//旋转开关位置预检测
	EXTI->IMR &= ~Keyboard_EXTI_Line;//屏蔽来自线上的中断请求,防止在定时器扫描矩阵键盘时进入此中断
	TIM_Cmd(TIM3, ENABLE);//打开定时器3,在定时器作用下开始扫描矩阵键盘
	
	//WriteEeprom();
	//Self_Calibration();//在电阻档自检线路和放大器

	
//	//液晶全亮
//	Send(SetAddr,0x3B,0x00,0x8B);//设置LCD地址
//	CheckReceive(SetAddr);//等待60ms,DTA从接收到发送完需要时间
//	for(t=0;t<8;t++)
//	{
//		Send(WriteFwd,0xFF,0xFF+WriteFwd);
//		CheckReceive(WriteFwd);
//	}
	
	while(1)
	{
		if(timer_1s_flag_for_Standby==1)//用于休眠计时
		{
			timer_1s_flag_for_Standby=0;
			count_for_Standby++;//休眠计时+1s;
			if(count_for_Standby==5400)//5min-300,10min-600,15min-900,20min-1200,25min-1500,30min-1800
			{
				lcd_clr();
				StandbyMode_Measure();//进入休眠
//				Power_Off_VDD();
			}
		}
		if((RotaryKeyChanged_flag == 1) || (SoftKeyChanged_flag == 1))//有按键
		{
			count_for_Standby=0;//休眠计时清零
			manipulate();
		}
		
		DataProcessing();//根据相应功能档配置DTA0660,并做当前档位的数据处理。  
		display();//液晶显示
		
		Communication_Service();//蓝牙串口服务函数
	}
	return 0;
}
Пример #4
0
void CollisionActor::setValues(float d_t) {
  manipulate(d_t);
  moveConstraintMin = Ogre::Vector2::ZERO;
  moveConstraintMax = Ogre::Vector2::ZERO;
}
Пример #5
0
static unsigned long
t3d_draw (Display *d, Window w, void *closure)
{
  struct state *st = (struct state *) closure;
  double dtime;
  double vnorm;

	
  /*--------------- Zeichenteil --------------*/

  vektorprodukt(st->x,st->y,st->v);
	
  vnorm=sqrt(st->v[0]*st->v[0]+st->v[1]*st->v[1]+st->v[2]*st->v[2]);
  st->v[0]=st->v[0]*norm/vnorm;
  st->v[1]=st->v[1]*norm/vnorm;
  st->v[2]=st->v[2]*norm/vnorm;
  vnorm=sqrt(st->x[0]*st->x[0]+st->x[1]*st->x[1]+st->x[2]*st->x[2]);
  st->x[0]=st->x[0]*norm/vnorm;
  st->x[1]=st->x[1]*norm/vnorm;
  st->x[2]=st->x[2]*norm/vnorm;
  vnorm=sqrt(st->y[0]*st->y[0]+st->y[1]*st->y[1]+st->y[2]*st->y[2]);
  st->y[0]=st->y[0]*norm/vnorm;
  st->y[1]=st->y[1]*norm/vnorm;
  st->y[2]=st->y[2]*norm/vnorm;
	
  projektion(st);
  t3d_sort (st,0,st->maxk-1);
	
  dtime=gettime(st);
	
  if(st->cycl)
    {
      st->draw_color=(int)(64.0*(dtime/60-floor(dtime/60)))-32;
	    
      if(st->draw_color<0)
        st->draw_color=-st->draw_color;
	    
      setink(st->colors[st->draw_color/3].pixel);
    }
  else
    setink(BlackPixelOfScreen (st->xgwa.screen));
	
  XFillRectangle(st->dpy,st->buffer,st->gc,0,0,st->scrnWidth,st->scrnHeight);
	
  {
    int i;
	  
    manipulate(st,dtime);
	  
    for (i=0;i<st->maxk;i++)
      {
        if (st->kugeln[i].d>0.0)
          fill_kugel(st,i,st->buffer,1);
      }
  }

  /* manipulate(gettime());
     var+=PI/500;
     if (var>=TWOPI) var=PI/500; */
	
  if(st->hsvcycl!=0.0)
    {
      dtime=st->hsvcycl*dtime/10.0+st->hue/360.0;
      dtime=360*(dtime-floor(dtime));
	    
      hsv2rgb(dtime,st->sat,st->val,&st->r,&st->g,&st->b);
      changeColor(st,st->r,st->g,st->b);
    }

  XCopyArea (st->dpy, st->buffer, st->window, st->gc, 0, 0, st->scrnWidth, st->scrnHeight, 0, 0);
	
	
  /*-------------------------------------------------*/
	
  XQueryPointer (st->dpy, st->window, &st->junk_win, &st->in_win, &st->junk, &st->junk,
                        &st->px, &st->py, &st->kb);
	
  if ((st->px>0)&&(st->px<st->scrnWidth)&&(st->py>0)&&(st->py<st->scrnHeight) )		
    {
      if ((st->px !=st->startx)&&(st->kb&Button2Mask))
        {
          /* printf("y=(%f,%f,%f)",y[0],y[1],y[2]);*/
          turn(st->y,st->x,((double)(st->px-st->startx))/(8000*st->mag));
          /* printf("->(%f,%f,%f)\n",y[0],y[1],y[2]);*/
        }
      if ((st->py !=st->starty)&&(st->kb&Button2Mask)) 
        {
          /* printf("x=(%f,%f,%f)",x[0],x[1],x[2]);*/
          turn(st->x,st->y,((double)(st->py-st->starty))/(-8000*st->mag));
          /* printf("->(%f,%f,%f)\n",x[0],x[1],x[2]);*/
        }
      if ((st->kb&Button1Mask)) 
        {
          if (st->vturn==0.0) st->vturn=.005; else if (st->vturn<2)  st->vturn+=.01;
          turn(st->x,st->v,.002*st->vturn);
          turn(st->y,st->v,.002*st->vturn); 
        }
      if ((st->kb&Button3Mask)) 
        {
          if (st->vturn==0.0) st->vturn=.005; else if (st->vturn<2) st->vturn+=.01;
          turn(st->x,st->v,-.002*st->vturn);
          turn(st->y,st->v,-.002*st->vturn);
        }
    }
  if (!(st->kb&Button1Mask)&&!(st->kb&Button3Mask)) 
    st->vturn=0;
	
  st->speed=st->speed+st->speed*st->vspeed;
  if ((st->speed<0.0000001) &&(st->vspeed>0.000001)) st->speed=0.000001;
  st->vspeed=.1*st->vspeed;
  if (st->speed>0.01) st->speed=.01;
  st->a[0]=st->a[0]+st->speed*st->v[0];
  st->a[1]=st->a[1]+st->speed*st->v[1];
  st->a[2]=st->a[2]+st->speed*st->v[2];

  return st->timewait;
}