亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? matrix.cc

?? 一個機器人平臺
?? CC
字號:
/************************************************************************* * RTV * $Id: matrix.cc,v 1.15 2002/09/07 02:05:24 rtv Exp $ ************************************************************************/#include <math.h>#include <iostream>#include <fstream>//#if INCLUDE_ZLIB//#include <zlib.h>//#endif#include "matrix.hh"#include "world.hh"const int BUFFER_ALLOC_SIZE = 1;//#define DEBUG    // construct from width / height CMatrix::CMatrix(int w, int h, int default_buf_size){  width = w; height = h;  assert( data 	= new CEntity**[width*height] );  assert( used_slots = new unsigned char[ width*height ] );  assert( available_slots = new unsigned char[ width*height ] );    for( int p=0; p< width * height; p++ )    {      // create the pointer "strings"      assert( data[p] = new CEntity*[ default_buf_size + 1] );      // zero them out      memset( data[p], 0, (default_buf_size + 1) * sizeof( CEntity* ) );            used_slots[p] = 0;      available_slots[p] = default_buf_size;    }  #ifdef INCLUDE_RTK2  this->fig = NULL;#endif}//destructCMatrix::~CMatrix(void) 	{  // if we allocated the array  if (data)  {    // delete the storage in each cell    for( int p=0; p< width * height; p++ )      if( data[p] )        delete[] data[p];          // delete the main array    delete [] data;  }    if( available_slots )    delete [] available_slots;  if( used_slots )    delete [] used_slots;}// useful debug function allows plotting the world externallyvoid CMatrix::dump( void ){  std::ofstream out( "world.dump" );    for( int y=0; y<height; y++ )  {    for( int x=0; x<width; x++ )    {	        CEntity** ent = get_cell( x,y );	        //while( *ent )      if( *ent )	    {   	      out << x << ' ' << y;	      out << ' ' << (int)*ent << std::endl;	    }    }  }  out.close();  puts( "DUMPED" );}#ifdef INCLUDE_RTK2// useful debug function allows plotting the world externallyvoid CMatrix::render( CWorld* world ){ // Create a figure representing this object  this->fig = rtk_fig_create(world->canvas, NULL, 60);  // Set the color to black  rtk_fig_color_rgb32(this->fig, ::LookupColor(MATRIX_COLOR) );  double pixel_size = 1.0 / world->ppm;  // render every pixel as an unfilled rectangle  for( int y=0; y<height; y++ )    for( int x=0; x<width; x++ )      if( *(get_cell( x, y )) )	rtk_fig_rectangle( fig, x*pixel_size, y*pixel_size, 0, pixel_size, pixel_size, 0 );}// useful debug function allows plotting the world externallyvoid CMatrix::unrender(){  if( this->fig )    {      rtk_fig_destroy( this->fig );      this->fig = NULL;    }}#endif// Draw a rectanglevoid CMatrix::draw_rect( const Rect& t, CEntity* ent, bool add){  draw_line( t.toplx, t.toply, t.toprx, t.topry, ent, add);  draw_line( t.toprx, t.topry, t.botrx, t.botry, ent, add);  draw_line( t.botrx, t.botry, t.botlx, t.botly, ent, add);  draw_line( t.botlx, t.botly, t.toplx, t.toply, ent, add);}// draws (2*PI)/0.1 = 62 little lines to form a circlevoid CMatrix::draw_circle(int x,int y,int r, CEntity* ent, bool add){  double i,cx,cy;  int x1,y1,x2,y2;    x1=x;y1=y+r;	    for (i=0;i<2.0*M_PI;i+=0.1)  {    cx = (double) x + (double (r) * sin(i));    cy = (double) y + (double (r) * cos(i));    x2=(int)cx; y2=(int)cy;    draw_line(x1, y1, x2, y2, ent, add);    x1=x2; y1=y2;  }	    draw_line(x1, y1, x, y+r, ent, add);}// Draw a line from (x1, y1) to (x2, y2) inclusivevoid CMatrix::draw_line(int x1,int y1,int x2,int y2, CEntity* ent, bool add){  int dx, dy;  int x, y;  int incE, incNE;  int t, delta;  int neg_slope = 0;    dx = x2 - x1;  dy = y2 - y1;  // Draw lines with slope < 45 degrees  if (abs(dx) > abs(dy))  {    if (x1 > x2)    {      t = x1; x1 = x2; x2 = t;      t = y1; y1 = y2; y2 = t;      dx = -dx;      dy = -dy;    }    if (y1 > y2)    {      neg_slope = 1;      dy = -dy;    }    delta = 2 * dy - dx;    incE = 2 * dy;    incNE = 2 * (dy - dx);    x = x1;    y = y1;    if (add)      set_cell(x, y, ent);    else      unset_cell(x, y, ent);    while (x < x2)  	{  	  if (delta <= 0)      {        delta = delta + incE;        x++;      }  	  else      {        delta = delta + incNE;        x++;        if (neg_slope)          y--;        else          y++;      }      if (add)        set_cell(x, y, ent);      else        unset_cell(x, y, ent);  	}    x = x2;    y = y2;    if (add)      set_cell(x, y, ent);    else      unset_cell(x, y, ent);  }  // Draw lines with slope > 45 degrees  else  {    if (y1 > y2)    {      t = x1; x1 = x2; x2 = t;      t = y1; y1 = y2; y2 = t;      dx = -dx;      dy = -dy;    }    if (x1 > x2)    {      neg_slope = 1;      dx = -dx;    }    delta = 2 * dx - dy;    incE = 2 * dx;    incNE = 2 * (dx - dy);    x = x1;    y = y1;    if (add)      set_cell(x, y, ent);    else      unset_cell(x, y, ent);    while (y < y2)  	{  	  if (delta <= 0)      {        delta = delta + incE;        y++;      }  	  else      {        delta = delta + incNE;        y++;        if (neg_slope)          x--;        else          x++;      }      if (add)        set_cell(x, y, ent);      else        unset_cell(x, y, ent);  	}    x = x2;    y = y2;    if (add)      set_cell(x, y, ent);    else      unset_cell(x, y, ent);  }}void CMatrix::clear( void ){  memset(this->data,0,width*height*sizeof(CEntity**));  memset(this->used_slots,0,width*height*sizeof(this->used_slots[0])); }inline void CMatrix::set_cell(int x, int y, CEntity* ent ){  if( ent == 0 )    return;  if (x<0 || x>=width || y<0 || y>=height)     return;    int cell = x + y * width;  int used_slots = this->used_slots[cell];    // See it we already have this entity  for (int slot = 0; slot < this->used_slots[cell]; slot++)    if (this->data[cell][slot] == ent)      return;  // Make sure we have room to add the entity  if (used_slots >= this->available_slots[cell])  {    int oldlen = this->available_slots[cell];    int newlen = oldlen + BUFFER_ALLOC_SIZE;    // make the new buffer - has one spare null pointer to mark the end    CEntity** longer = new CEntity*[ newlen + 1 ];    // zero the buffer    // copy the existing data into the new longer buffer    memset( longer, 0, (newlen+1) * sizeof( CEntity* ) );    memcpy( longer, this->data[cell], oldlen * sizeof( CEntity* ) );          //delete the old buffer    delete[] this->data[cell];          // and insert the new buffer    this->data[cell] = longer;          // remember how many slots we have in this buffer    this->available_slots[ cell ] = newlen;  }  // do the insertion  data[cell][used_slots] = ent;  this->used_slots[cell]++;  // Debugging  //CheckCell(cell);  return;}inline void CMatrix::unset_cell(int x, int y, CEntity* ent ){  if( ent == 0 )    return;  if (x<0 || x>=width || y<0 || y>=height)     return;    int cell = x + y * width;  int used_slots = this->used_slots[cell];    for (int slot = 0; slot < used_slots; slot++)  {    if (this->data[cell][slot] == ent)    {      // Move everything down to eliminate this slot.      // Note that this assumes that there is an end-marker,      // so we dont need to zero anything.      memmove(this->data[cell] + slot, this->data[cell] + slot + 1,              (this->available_slots[cell] - slot) * sizeof(CEntity*));      this->used_slots[cell]--;      break;    }  }  // Debugging  //CheckCell(cell);}// Print the cell contentsvoid CMatrix::PrintCell( int cell ){  printf( "data[ %d ] ", cell );  for (int slot = 0; slot < available_slots[cell]; slot++)    printf( " %p", data[cell][slot] );  printf( "\t %d/%d\n", used_slots[cell], available_slots[cell] );    fflush( stdout );}// Sanity check: check that each entity is present exactly oncevoid CMatrix::CheckCell( int cell ){  for (int i = 0; i < available_slots[cell]; i++)  {    if (data[cell][i] == NULL)      continue;    for (int j = i + 1; j < available_slots[cell]; j++)    {      if (data[cell][i] == data[cell][j])      {        printf("sanity check failed : dupilcate entry\n");        PrintCell(cell);      }    }  }  if (data[cell][used_slots[cell]] != NULL)    printf("sanity check failed : no end marker\n");}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产综合久久久蜜臀粉嫩| 蜜桃一区二区三区在线观看| 欧美精品一区二区三区高清aⅴ| 欧美亚洲动漫精品| 懂色av一区二区在线播放| 韩国v欧美v亚洲v日本v| 韩国v欧美v亚洲v日本v| 国产在线精品一区二区不卡了| 精品制服美女丁香| 国产在线视频一区二区三区| 国产精品一线二线三线| 风流少妇一区二区| 9人人澡人人爽人人精品| 9人人澡人人爽人人精品| 91福利小视频| 欧美高清视频在线高清观看mv色露露十八| 欧美日韩午夜在线视频| 欧美一区二区精美| 国产欧美一区在线| 亚洲欧美日韩人成在线播放| 亚洲精品国久久99热| 亚洲制服丝袜在线| 久久99深爱久久99精品| 岛国精品一区二区| 欧美午夜一区二区三区| 日韩亚洲欧美中文三级| 欧美高清在线精品一区| 亚洲精品大片www| 麻豆成人av在线| 99这里只有精品| 欧美一区二区三区免费在线看 | 麻豆精品国产91久久久久久| 国产在线不卡一区| 91丨九色porny丨蝌蚪| 欧美一区二区三区免费大片| 国产欧美精品一区aⅴ影院| 亚洲猫色日本管| 久久99精品国产麻豆婷婷洗澡| 国产福利视频一区二区三区| 欧洲精品在线观看| 久久久av毛片精品| 亚洲h在线观看| 豆国产96在线|亚洲| 91麻豆精品91久久久久同性| 国产精品理伦片| 免费观看30秒视频久久| 91啪亚洲精品| 国产拍揄自揄精品视频麻豆| 大陆成人av片| 日韩视频在线观看一区二区| 樱桃视频在线观看一区| 国产精品一区二区x88av| 欧洲亚洲国产日韩| 日韩一区在线播放| 精久久久久久久久久久| 欧美美女bb生活片| 亚洲精品免费播放| 99精品视频中文字幕| 欧美大白屁股肥臀xxxxxx| 国产精品传媒入口麻豆| 国产成人在线免费观看| 欧美mv和日韩mv的网站| 亚洲成年人网站在线观看| 成人免费视频网站在线观看| xfplay精品久久| 奇米777欧美一区二区| 精品视频一区二区三区免费| 亚洲精选视频在线| 99久久久精品| 亚洲图片你懂的| av不卡免费在线观看| 国产人成一区二区三区影院| 国产一区日韩二区欧美三区| 日韩精品在线看片z| 麻豆视频一区二区| 欧美不卡一区二区三区四区| 美女爽到高潮91| 日韩欧美一二三区| 久久福利视频一区二区| 日韩精品一区二区三区在线播放| 免费的国产精品| 日韩欧美国产一二三区| 美女国产一区二区| 精品国产乱码久久久久久牛牛 | 91麻豆产精品久久久久久| 亚洲欧美自拍偷拍色图| 91国内精品野花午夜精品| 亚洲一区中文日韩| 777精品伊人久久久久大香线蕉| 青青草精品视频| 国产亚洲自拍一区| 成人黄色电影在线 | 国产成人综合在线观看| 日本一区二区免费在线| 国产老妇另类xxxxx| 亚洲一二三四区不卡| 在线观看日韩毛片| 天堂蜜桃一区二区三区| 欧美成人一区二区三区在线观看| 国产一区二区三区免费看| 国产精品美女久久久久aⅴ| 色综合中文字幕国产 | 久久色在线视频| 成人ar影院免费观看视频| 一级日本不卡的影视| 日韩一区二区三区电影在线观看| 国模冰冰炮一区二区| 精品伊人久久久久7777人| 2022国产精品视频| 日本韩国欧美在线| 韩国精品免费视频| 亚洲综合成人在线视频| 精品久久久久久亚洲综合网| 成人v精品蜜桃久久一区| 日韩中文字幕一区二区三区| 国产清纯白嫩初高生在线观看91 | 色悠悠久久综合| 蜜桃一区二区三区在线| 亚洲欧美色一区| 精品国产麻豆免费人成网站| 色视频一区二区| 国产精品一区二区黑丝| 午夜电影一区二区三区| 国产精品成人免费在线| 这里只有精品视频在线观看| 99久久99久久精品免费看蜜桃| 毛片不卡一区二区| 亚洲午夜久久久久| 亚洲人成7777| 国产欧美精品一区aⅴ影院| 宅男在线国产精品| 欧美在线你懂的| 91在线免费视频观看| 国产一区二区按摩在线观看| 日本免费在线视频不卡一不卡二| 中文一区二区在线观看| 精品国产99国产精品| 欧美一区二区在线观看| 欧美日韩一级二级| 欧美中文一区二区三区| 91美女蜜桃在线| av资源网一区| www.在线成人| 成人h动漫精品| 成人精品鲁一区一区二区| 国产成人啪午夜精品网站男同| 热久久一区二区| 蜜臀精品一区二区三区在线观看 | 成人性色生活片| 国产乱人伦偷精品视频不卡| 美女视频网站久久| 奇米四色…亚洲| 久久国产精品72免费观看| 久久99国产精品麻豆| 日日欢夜夜爽一区| 美女脱光内衣内裤视频久久网站| 日本中文字幕一区| 精品一区二区三区久久| 国产剧情在线观看一区二区| 国产精品一区二区在线播放| 成人免费不卡视频| 91视频观看视频| 在线观看av一区| 欧美日韩精品二区第二页| 91精品在线麻豆| 日韩你懂的电影在线观看| 欧美精品一区二区在线观看| 久久久久久久久蜜桃| 国产精品白丝在线| 亚洲综合男人的天堂| 青青草伊人久久| 国产成人亚洲综合a∨婷婷图片| 成人av第一页| 欧美日韩精品一区二区| 欧美大片在线观看| 国产日韩欧美一区二区三区乱码 | 亚洲欧洲成人自拍| 亚洲一区二区三区影院| 麻豆精品新av中文字幕| 成人黄色小视频在线观看| 欧美性受xxxx黑人xyx性爽| 91精品国产91热久久久做人人| 欧美tickling挠脚心丨vk| 国产精品污网站| 午夜精品久久久久久久| 国产伦精品一区二区三区视频青涩| 成人黄色片在线观看| 91精品国产免费久久综合| 久久久久久亚洲综合| 亚洲精品老司机| 国产精品综合在线视频| 欧美天天综合网| 久久蜜臀精品av| 午夜精品一区二区三区电影天堂 | 国产日韩欧美激情| 亚洲一区二区三区四区五区黄| 久久国产日韩欧美精品| 91亚洲午夜精品久久久久久| 日韩欧美另类在线| 亚洲精品精品亚洲|