• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ calculate_delta函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中calculate_delta函数的典型用法代码示例。如果您正苦于以下问题:C++ calculate_delta函数的具体用法?C++ calculate_delta怎么用?C++ calculate_delta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了calculate_delta函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: lcd_move_e

static void lcd_move_e()
{
    if (encoderPosition != 0)
    {
        current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale;
        encoderPosition = 0;
        #ifdef DELTA
        calculate_delta(current_position);
        plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[E_AXIS]/60, active_extruder);
        #else
        plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[E_AXIS]/60, active_extruder);
        #endif
        lcdDrawUpdate = 1;
    }
    if (lcdDrawUpdate)
    {
        lcd_implementation_drawedit(PSTR("Extruder"), ftostr31(current_position[E_AXIS]));
    }
    if (LCD_CLICKED)
    {
        lcd_quick_feedback();
        currentMenu = lcd_move_menu_axis;
        encoderPosition = 0;
    }
}
开发者ID:tianshiz,项目名称:3DPrinterr,代码行数:25,代码来源:ultralcd.cpp


示例2: delta_move_to_top_endstops

void delta_move_to_top_endstops(float feedrate) {
  long up_steps = printer_state.zMaxSteps;
  for (byte i=0; i<3; i++)
    printer_state.currentPositionSteps[i] = 0;
  calculate_delta(printer_state.currentPositionSteps, printer_state.currentDeltaPositionSteps);
  move_steps(0,0,printer_state.zMaxSteps*ENDSTOP_Z_BACK_MOVE,0,feedrate, true, true);
}
开发者ID:johnoly99,项目名称:RepetierMAX,代码行数:7,代码来源:Commands.cpp


示例3: calculate_delta

void FeatureStatistics::set_d1Features(){
	// memory allocation
	m_d1Feature = (SAMPLE**)malloc(m_nCols*sizeof(SAMPLE*));
	for (int i = 0; i < m_nCols; ++i){
		m_d1Feature[i] = (SAMPLE*)malloc(m_nRows*sizeof(SAMPLE));
	}
	m_d1Mean = (SAMPLE**)malloc(m_nStatCols*sizeof(SAMPLE*));
	for (int i = 0; i < m_nStatCols; ++i){
		m_d1Mean[i] = (SAMPLE*)malloc(m_nStatRows*sizeof(SAMPLE));
	}
	m_d1Var = (SAMPLE**)malloc(m_nStatCols*sizeof(SAMPLE*));
	for (int i = 0; i < m_nStatCols; ++i){
		m_d1Var[i] = (SAMPLE*)malloc(m_nStatRows*sizeof(SAMPLE));
	}
	m_d1Std = (SAMPLE**)malloc(m_nStatCols*sizeof(SAMPLE*));
	for (int i = 0; i < m_nStatCols; ++i){
		m_d1Std[i] = (SAMPLE*)malloc(m_nStatRows*sizeof(SAMPLE));
	}

	// calculate d1 feature variables
	SAMPLE** feature = this->get_featureObject()->get_feature()
		m_d1Feature = calculate_delta(feature);
	m_d1Mean = calcualte_mean(m_d1Feature);
	m_d1Var = calculate_var(m_d1Feature, m_d1Mean);
	m_d1Std = calculate_var2std(m_d1Var);
}
开发者ID:binarybruin,项目名称:cfel,代码行数:26,代码来源:cfelStatTest.cpp


示例4: lcd_move_z

static void lcd_move_z()
{
    if (encoderPosition != 0)
    {
        refresh_cmd_timeout();
        current_position[Z_AXIS] += float((int)encoderPosition) * move_menu_scale;
        if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS)
            current_position[Z_AXIS] = Z_MIN_POS;
        if (max_software_endstops && current_position[Z_AXIS] > Z_MAX_POS)
            current_position[Z_AXIS] = Z_MAX_POS;
        encoderPosition = 0;
        #ifdef DELTA
        calculate_delta(current_position);
        plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[Z_AXIS]/60, active_extruder);
        #else
        plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[Z_AXIS]/60, active_extruder);
        #endif
        lcdDrawUpdate = 1;
    }
    if (lcdDrawUpdate)
    {
        lcd_implementation_drawedit(PSTR("Z"), ftostr31(current_position[Z_AXIS]));
    }
    if (LCD_CLICKED)
    {
        lcd_quick_feedback();
        currentMenu = lcd_move_menu_axis;
        encoderPosition = 0;
    }
}
开发者ID:elmarnitsche,项目名称:Firmware-Playground,代码行数:30,代码来源:ultralcd.cpp


示例5: calculate_delta

void FeatureStatistics::set_d2Features(){

	int nCols = this->get_featureObject()->get_nCols();
	int nRows = this->get_featureObject()->get_nRows();

	// memory allocation
	m_d2Feature = (SAMPLE**)malloc(nCols*sizeof(SAMPLE*));
	for (int i = 0; i < nCols; ++i){
		m_d2Feature[i] = (SAMPLE*)malloc(nRows*sizeof(SAMPLE));
	}
	m_d2Mean = (SAMPLE**)malloc(m_nStatCols*sizeof(SAMPLE*));
	for (int i = 0; i < m_nStatCols; ++i){
		m_d2Mean[i] = (SAMPLE*)malloc(m_nStatRows*sizeof(SAMPLE));
	}
	m_d2Var = (SAMPLE**)malloc(m_nStatCols*sizeof(SAMPLE*));
	for (int i = 0; i < m_nStatCols; ++i){
		m_d2Var[i] = (SAMPLE*)malloc(m_nStatRows*sizeof(SAMPLE));
	}
	m_d2Std = (SAMPLE**)malloc(m_nStatCols*sizeof(SAMPLE*));
	for (int i = 0; i < m_nStatCols; ++i){
		m_d2Std[i] = (SAMPLE*)malloc(m_nStatRows*sizeof(SAMPLE));
	}
	
	// calculate
	SAMPLE** feature = this->get_d1Feature();
	m_d2Feature = calculate_delta(feature);
	m_d2Mean = calculate_mean(m_d2Feature);
	m_d2Var = calculate_var(m_d2Feature, m_d2Mean);
	m_d2Std = calculate_var2std(m_d2Var);
}
开发者ID:binarybruin,项目名称:cfel,代码行数:30,代码来源:FeatureStatistics.cpp


示例6: update_behavior

void update_behavior(vector<float> &k, Creature* c,bool good=true)
{

    if (novelty_function==NF_COGSAMPSQ)
    {
        dVector3& o_com= ((Biped*)c)->orig_com;
        dVector3& c_com= ((Biped*)c)->curr_com;
        dVector3 com;
        dVector3 delta;
        c->CenterOfMass(com);
        calculate_delta(o_com,com,delta);
        calculate_power(delta,2);

        if (good)
        {
            k.push_back(delta[0]);
            k.push_back(delta[1]);
        }
        else
        {
            k.push_back(0.0);
            k.push_back(0.0);
        }
    }
}
开发者ID:henokyen,项目名称:Evolvability-Search,代码行数:25,代码来源:biped_stuff.cpp


示例7: lcd_extrude

static void lcd_extrude(float length, float feedrate) {
	current_position[E_AXIS] += length;
  #ifdef DELTA
  calculate_delta(current_position);
  plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], feedrate, active_extruder);
  #else
  plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate, active_extruder);
  #endif
}
开发者ID:T3P3,项目名称:Marlin-1,代码行数:9,代码来源:ultralcd.cpp


示例8: _lcd_move

static void _lcd_move(const char *name, int axis, int min, int max) {
  if (encoderPosition != 0) {
    refresh_cmd_timeout();
    current_position[axis] += float((int)encoderPosition) * move_menu_scale;
    if (min_software_endstops && current_position[axis] < min) current_position[axis] = min;
    if (max_software_endstops && current_position[axis] > max) current_position[axis] = max;
    encoderPosition = 0;
    #ifdef DELTA
      calculate_delta(current_position);
      plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder);
    #else
      plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder);
    #endif
    lcdDrawUpdate = 1;
  }
  if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis]));
  if (LCD_CLICKED) lcd_goto_menu(lcd_move_menu_axis);
}
开发者ID:ManyeonJung,项目名称:Megamaker,代码行数:18,代码来源:ultralcd.cpp


示例9: home_axis

void home_axis(bool xaxis,bool yaxis,bool zaxis) {
  long steps;
  bool homeallaxis = (xaxis && yaxis && zaxis) || (!xaxis && !yaxis && !zaxis);
  if (X_MAX_PIN > -1 && Y_MAX_PIN > -1 && Z_MAX_PIN > -1 && MAX_HARDWARE_ENDSTOP_X & MAX_HARDWARE_ENDSTOP_Y && MAX_HARDWARE_ENDSTOP_Z) {
    UI_STATUS_UPD(UI_TEXT_HOME_DELTA);
    // Homing Z axis means that you must home X and Y
    if (homeallaxis || zaxis) {
      delta_move_to_top_endstops(homing_feedrate[0]);	
      move_steps(0,0,axis_steps_per_unit[0]*-ENDSTOP_Z_BACK_MOVE,0,homing_feedrate[0]/ENDSTOP_X_RETEST_REDUCTION_FACTOR, true, false);
      delta_move_to_top_endstops(homing_feedrate[0]/ENDSTOP_X_RETEST_REDUCTION_FACTOR);	
      printer_state.currentPositionSteps[0] = 0;
      printer_state.currentPositionSteps[1] = 0;
      printer_state.currentPositionSteps[2] = printer_state.zMaxSteps;
      calculate_delta(printer_state.currentPositionSteps, printer_state.currentDeltaPositionSteps);
      printer_state.maxDeltaPositionSteps = printer_state.currentDeltaPositionSteps[0];
    } else {
      if (xaxis) printer_state.destinationSteps[0] = 0;
      if (yaxis) printer_state.destinationSteps[1] = 0;
      split_delta_move(true,false,false);
    }
    printer_state.countZSteps = 0;
    UI_CLEAR_STATUS 
  }
开发者ID:johnoly99,项目名称:RepetierMAX,代码行数:23,代码来源:Commands.cpp


示例10: lcd_fc

static void lcd_fc()
{
if (fil_temp == 200)
{
setTargetHotend0(plaPreheatHotendTemp);
}
if (fil_temp == 230)
{
setTargetHotend0(absPreheatHotendTemp);
}
setWatch(); // heater sanity check timer
if (!isHeatingHotend(0)&&(filament_seq == 0))
{
filament_seq = 1;
}
if ((filament_seq == 0)&&(pausa_display == 0))
{
pausa_display = 1;
}
if (filament_seq == 1)
{   
if (st_message == 0)  
    {
	lcdDrawUpdate = 2;  
	lcd_implementation_message0(PSTR("Introducir el nuevo"));
    lcd_implementation_message1(PSTR("filamento y girar el  "));
	lcd_implementation_message2(PSTR("boton hasta que"));
	lcd_implementation_message3(PSTR("salga el filamento"));
	if (encoder_zero == 0)
	{
	encoderPosition = 0;
	encoder_zero = 1;
	}
	}
    if (encoderPosition != 0)
    {
	    move_menu_scale = 1.0;
        current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale;
        encoderPosition = 0;
		 #ifdef DELTA
        calculate_delta(current_position);
        plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[E_AXIS]/60, active_extruder);
        #else
        plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[E_AXIS]/60, active_extruder);
        #endif
        lcdDrawUpdate = 2;
		st_message = 1;
    }
	
    if ((lcdDrawUpdate) && (st_message == 1))
    {
	lcd_implementation_drawedit(PSTR("Extruder"), ftostr31(current_position[E_AXIS]));
    }

}
else
    {
    lcd_implementation_message4(PSTR(" Calentando..."));
    _draw_heater_status(6, 0);
	lcdDrawUpdate = 1;
	u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT, (blink % 2) && fanSpeed ? status_screen0_bmp : status_screen1_bmp);
	
	}
	
if ((LCD_CLICKED) || (degTargetHotend(0) == 0)  || (currentMenu == lcd_status_screen))
	{
 	filament_seq = 0;
	st_message = 0;
	pausa_display = 0;
	encoder_zero = 0;
	setTargetHotend0(0);
	lcd_return_to_status();
    }
}
开发者ID:Trideo,项目名称:PrintBox-Max,代码行数:74,代码来源:ultralcd.cpp


示例11: start_server

int start_server(const char *url, const char *rtspport)
{
  int mediafd = -1, listenfd, tempfd, maxfd;
  int videofd;
  struct addrinfo *info;
  struct sockaddr_storage remoteaddr;
  socklen_t addrlen = sizeof remoteaddr;
  fd_set readfds, masterfds;
  struct timeval *timeout, *timeind = NULL, timenow;
  int nready, i;
  int videosize, videoleft;
  int recvd, sent;
  char urlhost[URLSIZE], urlpath[URLSIZE], tempstr[URLSIZE];
  unsigned char msgbuf[BUFSIZE], sendbuf[BUFSIZE];
  char *temp;
  unsigned char *sps = NULL, *pps = NULL;
  size_t spslen, ppslen;
  RTSPMsg rtspmsg;
  Client streamclient;
  pthread_t threadid;
  ThreadInfo *tinfo = NULL;

  uint16_t rtpseqno_video = (rand() % 1000000);
  uint16_t rtpseqno_audio = (rand() % 1000000);

  TimeoutEvent *event;

  /* The current state of the protocol */
  int mediastate = IDLE;
  int quit = 0;

  int media_downloaded = 0;

  timeout = (struct timeval *)malloc(sizeof(struct timeval));
  init_client(&streamclient);
  

  /* Open the a file where the video is to be stored */
  if ((videofd = open("videotemp.mp4", O_RDWR | O_CREAT | O_TRUNC, S_IRWXU)) < 0) {
    fatal_error("Error opening the temporary videofile");
  }

  /* Create the RTSP listening socket */
  resolve_host(NULL, rtspport, SOCK_STREAM, AI_PASSIVE, &info);
  listenfd = server_socket(info);
  maxfd = listenfd;


  FD_ZERO(&readfds);
  FD_ZERO(&masterfds);
  FD_SET(listenfd, &masterfds);

  while (!quit) {

    readfds = masterfds;

    if ((nready = Select(maxfd + 1, &readfds, timeind)) == -1) {
      printf("Select interrupted by a signal\n");
    } 

    /* Timeout handling, used for packet pacing and other timeouts */
    else if (nready == 0) {
      timeind = NULL;
      lock_mutex(&queuelock);
      if ((event = pull_event(&queue)) != NULL) {

        switch (event->type) {

	case ENDOFSTREAM:
	  printf("MEDIA FINISHED\n");
	  break;

	case FRAME:
	  /* Video frame */
	  if (event->frame->frametype == VIDEO_FRAME) {
	    rtpseqno_video += send_video_frame(sendbuf, event->frame, streamclient.videofds[0], rtpseqno_video);
	  }

	  /* Audio frame */
	  else {
            rtpseqno_audio += send_audio_frame(sendbuf, event->frame, streamclient.audiofds[0], rtpseqno_audio);
	  }

          free(event->frame->data);
          free(event->frame);
          break;

	case CHECKMEDIASTATE:
	  oma_debug_print("Checking media ready for streaming...\n");
	  if (mediastate != STREAM) {
	    printf("Sending dummy RTP\n");
	    send_dummy_rtp(sendbuf, streamclient.videofds[0], &rtpseqno_video);
	    push_timeout(&queue, 1000, CHECKMEDIASTATE);
	  }
          break;

	default:
	  oma_debug_print("ERRORENOUS EVENT TYPE!\n");
          break;
        }
//.........这里部分代码省略.........
开发者ID:gitorup,项目名称:HTTP2RTSP,代码行数:101,代码来源:server.c


示例12: timecmp

int timecmp(struct timeval first, struct timeval second)
{
  struct timeval delta = calculate_delta(&first, &second);
  return (delta.tv_sec != 0)?delta.tv_sec:delta.tv_usec;
}
开发者ID:gitorup,项目名称:HTTP2RTSP,代码行数:5,代码来源:server.c



注:本文中的calculate_delta函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ calculate_output函数代码示例发布时间:2022-05-30
下一篇:
C++ calculateTransforms函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap