Esempio n. 1
0
int main()
{
	helloworld();
	helloworld();
	helloworld();
	helloworld();
	return 0;
}
Esempio n. 2
0
//int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, int iCmdshow)
int main(int _argc, char** _argv)
{
	EEDesc desc;
	desc.applicationName = L"Emerald";	//窗口名称
	desc.isFullScreen = false;			//是否全屏
	desc.width = 800;					//窗口宽度
	desc.height = 450;					//窗口高度
	desc.isSSAA = true;					//是开启抗锯齿
	desc.isVsync = false;				//是否垂直同步
	EEInitialize(desc);

	EETexture bgTex(L"Texture\\主界面\\主界面背景.jpg");
	EETexture button2Tex(L"Texture/主界面/模式标签/生涯模式.png");
	EEFont helloworld(FLOAT3(100.0f, 100.0f, 0.0f), EEColor::YELLOW, L"hello world");
	EELineEditer *lineEditer = new EELineEditer(Rect_Float(200.f, 300.f, 300.f, 350.f), bgTex, EEColor::BLACK);
	EELineEditer *lineEditer2 = new EELineEditer(Rect_Float(400.f, 300.f, 500.f, 350.f), bgTex, EEColor::BLACK);

	while (EERun())
	{
		EEBeginScene(EEColor::BLACK);
		EEShowFPSInTitle(L"- -");

		lineEditer->Process();
		lineEditer2->Process();
		helloworld.Process();

		EEEndScene();
	}

	EEShutdown();
	return 0;
}
Esempio n. 3
0
int main() {
	printf(
		"The return code from the helloworld system call is %ld\n",
		helloworld()
	);
	return 0;
}
Esempio n. 4
0
int main()
{
    printf("Hello World!.\n");
    printf("%d\n", helloworld(5));
    printf("%d\n", helloworld2(5));
    return 0;
}
Esempio n. 5
0
int helloworld(int i){
    if(i <= 1){
        return 1;
    }
    
    else{
        return i * helloworld(i -1);
    }
}
Esempio n. 6
0
int
main (
    int argc,
    char **argv)
{
  hello("John");
  hello("Marie");
  hello("Judith");
  helloworld();

  return EXIT_SUCCESS;
}
Esempio n. 7
0
//int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, int iCmdshow)
int main(int _argc, char** _argv)
{
	EEDesc desc;
	desc.applicationName = L"Emerald";	//窗口名称
	desc.isFullScreen = false;			//是否全屏
	desc.width = 800;					//窗口宽度
	desc.height = 450;					//窗口高度
	desc.isSSAA = true;					//是开启抗锯齿
	desc.isVsync = false;				//是否垂直同步
	EEInitialize(desc);

	EEBitmap bitmap1 = EEGetFontBitmap(L'啊');
	EEBitmap bitmap2 = EEGetFontBitmap(L'呀');
	EEBitmap bitmap3 = EEGetFontBitmap(L'?');
	EEBitmap bitmap = EEBitmapCombineHorizontal(bitmap1, bitmap2);
	//bitmap = EEBitmapCombineHorizontal(bitmap, bitmap3);
	//bitmap.Resize(500, 500);
	//std::vector<EEBitmap> bitmaps;
	//EEBitmapDivideVertical(bitmap, 3, bitmaps);
	//EETexture fonttex(bitmaps[1]);
	EEQuad2D quad0(Rect_Float(0, 0, (float)bitmap.GetWidth(), (float)bitmap.GetHeight()), bitmap);
	quad0.SetLocalZOrder(10.0f);

	EEBitmap bitmap11 = EEGetFontBitmap(L"大家好!呀\n呀\'呀呀?");
	EEQuad2D quad1(Rect_Float(0, 200, (float)bitmap11.GetWidth(), (float)bitmap11.GetHeight() + 200), bitmap11);
	quad1.SetLocalZOrder(10.0f);

	EETexture bgTex(L"Texture\\Project Diva Freedom\\01\\选歌条.png");
	EEFont helloworld(FLOAT3(100.0f, 100.0f, 0.0f), EEColor::YELLOW, L"hello world");
	helloworld.AddText(L'1');
	EELineEditor *lineEditor = new EELineEditor(Rect_Float(200.f, 300.f, 300.f, 350.f), bgTex, EEColor::BLACK);
	EELineEditor *lineEditor2 = new EELineEditor(Rect_Float(400.f, 300.f, 500.f, 350.f), bgTex, EEColor::BLACK);
	EETextEditor *textEditor = new EETextEditor(Rect_Float(300.f, 100.f, 400.f, 150.f), bgTex, EEColor::BLACK);

	while (EERun())
	{
		EEBeginScene(EEColor::BLACK);
		EEShowFPSInTitle(L"- -");

		quad0.Process();
		quad1.Process();
		lineEditor->Process();
		lineEditor2->Process();
		helloworld.Process();
		textEditor->Process();

		EEEndScene();
	}

	EEShutdown();
	return 0;
}
Esempio n. 8
0
kpSDK::kpSDK(QObject *parent) :
    QObject(parent)
{
    manager = new QNetworkAccessManager(this);
    eLoop=new QEventLoop;
    mRet=-1;
    mIsAppPath=true;
    mIsToRecyle=true;
    mIsOverWrite=true;
    this->mConsumerKey.clear();
    this->mConsumerSecret.clear();
    connect(this,SIGNAL(helloworld()),this,SLOT(reqTknReplyFinished()));
}
Esempio n. 9
0
//////////////////////
//                  //
//  Main Statement  //
//                  //
//////////////////////
int main(void) {

   /* Declares local vars */
      long int rc;                   /* return code of last function */
      struct exampledll handle;
      
   /* Calls function */
      rc = helloworld();
      printf("\n");

   /* Adds numbers */
      printf("Calling on DLL for addition...\n");
      rc = example_sum(123, 321);
      printf("123 + 321 = %i\n\n", rc);

   /* Creates String */
      printf("Calling on DLL to create string...\n");
      rc = example_stringcreate(&handle);
      if (rc) {
         printf("There was an error creating the string\n");
         return(1);
      };

   /* Prints String */
      printf("My string is: \"%s\"\n\n", handle.message);

   /* Destroys string */
      printf("Calling on DLL to delete string...\n");
      rc = example_stringdestroy(&handle);
      if (rc) {
         printf("There was an error destroying the string\n");
         return(1);
      };

   /* Prints String */
      //rc = (int) message;
      //printf("Memory Address: %i\n", rc);
      printf("My string is: \"%s\"\n\n", handle.message);
      //printf("Backup: \"%s\"\n\n", backup);

   /* Ends function */
      return(rc);

}
Esempio n. 10
0
void mood(void)
{
	static uint8_t command;
	static uint16_t i=0;
	static uint16_t r=MAXPWM,g=MAXPWM/2,b=MAXPWM/42;
	static uint16_t r_dir=R_SPEED, g_dir=G_SPEED, b_dir=B_SPEED;
	static bool loop=true;

	command=' ';	// default command: none

	/* Load the next command byte from the USB to USART transmit buffer */
	if (!(RingBuffer_IsEmpty(&USBtoUSART_Buffer)))
		  command=RingBuffer_Remove(&USBtoUSART_Buffer);
	switch (command) {
		case 'r': if (r >=1000) r-=1000; break;
		case 'R': if (r <= MAXPWM-1000) r+=1000; break;
		case 'g': if (g >=1000) g-=1000; break;
		case 'G': if (g <= MAXPWM-1000) g+=1000; break;
		case 'b': if (b >=1000) b-=1000; break;
		case 'B': if (b <= MAXPWM-1000) b+=1000; break;
		case 'h': loop=true; helloworld(); break;
		case '#': loop=setcmd(&r,&g,&b); break;
		case 'm': loop=true;
		default:
			if (++i > DELAY) {
				if(loop) {
					if (r >= (MAXPWM - R_SPEED)) r_dir = -R_SPEED;
					if (r <= R_SPEED) r_dir = R_SPEED;
					if (g >= (MAXPWM - G_SPEED)) g_dir = -G_SPEED;
					if (g <= G_SPEED) g_dir = G_SPEED;
					if (b >= (MAXPWM - B_SPEED)) b_dir = -B_SPEED;
					if (b <= B_SPEED) b_dir = B_SPEED;
					r += r_dir; g += g_dir; b += b_dir;
				}
				setcolor(r,g,b);
				//if (lowvoltage()) {	// red light and stop
				//	setcolor(MAXPWM,0,0);
				//	for(;;);
				//}
				i=0;
			}
	}
}
Esempio n. 11
0
int main(int argc, char **argv)
{
#if USE_GTK
    Gtk::Main kit(argc, argv);
    Glib::thread_init();

//     CalibrationWindow calwindow;
//     calwindow.show();

    GazeTrackerGtk helloworld(argc, argv);

    helloworld.show();

    Gtk::Main::run(helloworld);
#else 
#warning implement me!!
#endif
    
    return 0;
}
Esempio n. 12
0
int main() {
    helloworld();
    exit(0);
}
Esempio n. 13
0
int main() {
	helloworld(std::cout);
}
Esempio n. 14
0
int main(int argc, char const* argv[]) {
  helloworld();
  return 0;
}
Esempio n. 15
0
int main(void) {
	helloworld();
}
Esempio n. 16
0
void main(int argc,String *argv) {

    randomise();

    ArgParser a=ArgParser(argc,argv);
    String fname=a.argafter("-i","GF lines filename","ls.gf");
    cdclip=a.floatafter("-ed","Maximum end distance of lines",30);
    creepintoline=a.floatafter("-ic","Intersection can creep in this much of the line",0.02);
    dotabove=a.floatafter("-pd","Parallelity: dot product must be above this",0.5);
    minlen=a.floatafter("-ml","Minimum length of a line",20);
    bool displaying=!a.argexists("nod","Don't display");
    String imname=a.argafter("-oi","Original image","none");
    oiscale=a.floatafter("-ois","Scale to original image",2);
    bool overlaylines=a.argexists("-ol","Overlay lines");
    int imwidth=a.intafter("-rqw","width of recovered quad images (pixels)",200);
//  float favourlarge=a.floatafter("-fl","Favour large by",0.8); // old method
    float favourlarge=a.floatafter("-fl","Favour large by",1.2);
    dividebyarea=!a.argexists("-dd","Don't divide V by area");
    oldmethod=a.argexists("-osm","Old stats method (area not sum mags, score reciprocal not -ve)");
    a.done();

    // Specific to my images
    printf("Auto scale? ");
    String tmp=imname;
    if (Sinstrlast(tmp,"/"))
        tmp=Sfrom(tmp,Sinstrlast(tmp,"/")+1);
    if (Sstarts(tmp,"image")) {
        printf("2.5");
        oiscale=2.5;
    }
    if (Sstarts(tmp,"img") || Slen(Sbefore(tmp,"."))==2) {
        printf("2.0");
        oiscale=2.0;
    }
    printf("\n");

    // Read list from file and find quads (looks easy!)
    List<QuadsLine2d> ls=readgfset(fname);
    helloworld();
    printf("Finding quads\n");
    List<Polygon2d> qs=findquads(ls);

    printf("df...");
    JFont coolfont=JFont(0.5);
    printf("fd...\n");

    if (!Seq(imname,"none")) {

        printf("Trying to read original file (%s)...",imname);
        oi=RGBmp::readfile(imname);
        Map2d<float> *gs=oi->getgreyscale();

        jbmp=JBmp(oi->width*0.5,oi->height*0.5);
        jbmp.clear(255);
        for (int i=1; i<=ls.len; i++) {
            QuadsLine2d l=ls.num(i)*oiscale*0.5;
            jbmp.line(l,0);
            //jbmp.thickline(l,1,255);
        }
        jbmp.writefile("lines.bmp");

        // Simple quad map
        Map2d<bool> jb=Map2d<bool>(oi->width*0.5,oi->height*0.5,255);
        for (int i=1; i<=qs.len; i++) {
            // jb.clear();
            Polygon2d p=qs.num(i);
            for (int j=1; j<=p.vs.len; j++) {
                jb.line(p.linefrom(j)*0.5*oiscale,0);
            }
        }
        jb.writefile("quads.bmp");

        // Edge detection
        printf("Doing edge detection\n");
        gs->edgedetection(Map2d<float>::sobel(),&mag,&angs);
        // angs->display();
        // exit(0);

        qs.applycall(&scalepoly); // No need for oiscale after this point

        for (int i=1; i<=qs.len; i++) {
            Polygon2d *quad=qs.p2num(i);
            quad->name=Schr(Sasc("A")+(i-1)%26);
        }

        // Overlay lines on original
        if (overlaylines) {
            RGBmp *linesover=oi->scaledby(0.5);
            for (int i=1; i<=ls.len; i++)
                linesover->thickline(0.5*oiscale*ls.num(i),myRGB(0,0,0),4);
            for (int i=1; i<=ls.len; i++)
                linesover->line(0.5*oiscale*ls.num(i),myRGB(255,255,255));
            linesover->writefile("linesover.bmp");
        }

        // Overlay quads on original
        RGBmp *rgbmp=oi->scaledby(0.5);
        for (int i=1; i<=qs.len; i++) {
            Polygon2d p=qs.num(i);
            for (int j=1; j<=p.vs.len; j++) {
                rgbmp->thickline(0.5*p.linefrom(j),myRGB(0,0,0),4);
            }
        }
        for (int i=1; i<=qs.len; i++) {
            Polygon2d p=qs.num(i);
            for (int j=1; j<=p.vs.len; j++) {
                rgbmp->line(0.5*p.linefrom(j),myRGB(255,255,255));
            }
        }
        rgbmp->writefile("overlay.bmp");

        RGBmp *detailed=new RGBmp(oi->width/2.0,oi->height/2.0,myRGB(255,255,255));//oi->scaledby(1);
        for (int i=1; i<=qs.len; i++) {
            Polygon2d p=qs.num(i);
            for (int j=1; j<=p.vs.len; j++) {
                detailed->line(p.linefrom(j)*0.5,myRGB(0,0,0));
            }
//      V2d t=(p.vs.num(1)+p.vs.num(2)+p.vs.num(3)+p.vs.num(4))/4.0/2.0+V2d::random()*100/2.0;
            V2d t=V2d(myrnd()*detailed->width,myrnd()*detailed->height);
            for (int k=1; k<=4; k++) {
                V2d c=p.vs.num(k)/2.0;
                detailed->line(c,t,myRGB(0,0,0));
            }
            String data=Sformat("%s",p.name);
            coolfont.centerString(data,detailed,t.x,t.y,8,myRGB(0,0,0));
        }
        detailed->writefile("data.bmp");

        List<String> left;
        List<String> right;
        for (int i=1; i<=qs.len; i++) {
            Polygon2d *p=qs.p2num(i);
            String s=Sformat("%s score %.3f, area %.3f",p->name,scorefor(p),p->area());
            if (p->centroid().x<oi->width/2.0)
                left.add(s);
            else
                right.add(s);
        }
        List<String> data;
//    data.add(Sformat("GF %s td=%.2f ti=%.2d tp=%.2f minlen=%.2f Image %s scale=%.2f  widthofrecquad=%.2f favourlarge=%.2f",fname,cdclip,creepintoline,dotabove,minlen,imname,oiscale,favourlarge));
        String tmp="";
        if (dividebyarea)
            tmp=Sconc(tmp,"Dividing V by area.  ");
        data.add(tmp);
        data.add("");
        data.add("-- Left:");
        data.add(left);
        data.add("-- Right:");
        data.add(right);
        writelinestofile(data,"data.txt");

        /* printf("Ordering\n");
           qs=qs.qsort(&offness);
           printf("Done ordering.\n");*/

        printf("Removing overlapping quads (%i) ...\n",qs.len);
        data.add("-- Rejection:");
        // Check all containers first
        for (int i=1; i<=qs.len; i++) {
            Polygon2d *quad=qs.p2num(i);
            bool done=false;
            for (int j=1; j<=qs.len && !done; j++) { // Compare to all others (one-directional)
                printf("Comparing (%i/%i) to %i : ",i,qs.len,j);
                if (i!=j) {

                    Polygon2d *oquad=qs.p2num(j);
                    data.add(Sformat("Comparing %s to %s %i %i",quad->name,oquad->name,i,j));

                    bool overlaps=quad->overlaps(oquad,0.99);
                    if (overlaps==Polygon2d::container) { // quad envelops oquad
                        if (scorefor(quad)>0.8*scorefor(oquad)) {
                            //          data.add(ql(&qs));
                            data.add(Sformat("%s contained %s and rejected it",quad->name,oquad->name));
                            qs.remnum(j);
                            j--;
                            if (i>j) {
                                i--;
                                done=true;
                            }
                            printf("Contained quad rejected");
                            //        data.add(ql(&qs));
                        }
                    }

                }

                printf("\n");
            }
        }
        // Then overlapping in general
        for (int i=1; i<=qs.len; i++) {
            Polygon2d *quad=qs.p2num(i);
            bool done=false;
            for (int j=i+1; j<=qs.len && !done; j++) { // bi-derectional
                printf("Comparing (%i/%i) to %i : ",i,qs.len,j);
                Polygon2d *oquad=qs.p2num(j);

                bool overlaps=quad->overlaps(oquad);
                if (overlaps) {
                    if (scorefor(quad)>scorefor(oquad)) {
                        //      data.add(ql(&qs));
                        data.add(Sformat("%s beat %s.",quad->name,oquad->name));
                        qs.remnum(j);
                        j--;
                        printf("Second quad rejected");
                        //    data.add(ql(&qs));
                    } else {
                        //  data.add(ql(&qs));
                        data.add(Sformat("%s beat %s,",oquad->name,quad->name));
                        qs.remnum(i);
                        i--;
                        done=true;
                        printf("First quad rejected");
                        //data.add(ql(&qs));
                    }
                }

                printf("\n");
            }
        }
        printf("Done: now (%i) quads.\n",qs.len);

        // Overlay again
        RGBmp *rgbmp2=oi->scaledby(0.5);
        for (int i=1; i<=qs.len; i++) {
            Polygon2d p=qs.num(i);
            for (int j=1; j<=p.vs.len; j++) {
                rgbmp2->thickline(0.5*p.linefrom(j),myRGB(0,0,0),4);
            }
        }
        for (int i=1; i<=qs.len; i++) {
            Polygon2d p=qs.num(i);
            for (int j=1; j<=p.vs.len; j++) {
                rgbmp2->line(0.5*p.linefrom(j),myRGB(255,255,255));
            }
            V2d t=0.5*p.centroid();
            // rgbmp2->line(oiscale*p.num(1),t,V3d(1,0,0));
            String data=Sformat("%.3f",scorefor(qs.p2num(i)));
            //coolfont.centerString(data,rgbmp2,t.x,t.y,9,myRGB(255,0,0));
        }
        rgbmp2->writefile("overlay2.bmp");

        // Simple quad map again
        Map2d<bool> jbq=Map2d<bool>(oi->width*0.5,oi->height*0.5,255);
        for (int i=1; i<=qs.len; i++) {
            // jb.clear();
            Polygon2d p=qs.num(i);
            for (int j=1; j<=p.vs.len; j++) {
                jbq.line(p.linefrom(j)*0.5,0);
            }
        }
        jbq.writefile("quads2.bmp");

        // Recover text
        List<RGBmp *> rec;
        // oi->display();
        for (int i=1; i<=qs.len && i<=5; i++) {
            List<V2d> *l=&qs.num(i).vs;
            RGBmp *n=oi->recoverquad(l,1,imwidth);
            n->writefile(getnextfilename("recquad","bmp"));
            rec.add(n);
        }

        if (displaying) {
//      waitforkeypress();
            jbmp.display();
            jb.display();
            for (int i=1; i<=rec.len; i++)
                rec.num(i)->display();
        }

        data.add("-- Final quads:");
        for (int i=1; i<=qs.len; i++) {
            Polygon2d *p=qs.p2num(i);
            String s=Sformat("%s %.3f",p->name,scorefor(p));
            data.add(s);
        }
        writelinestofile(data,"data.txt");

    }

//  allegroexit();
    printf("%i quadrilaterals found\n",qs.len);

}
Esempio n. 17
0
int main() {
  helloworld();
  hellocppworld();
}
Esempio n. 18
0
main(){
  printf("The return from mysyscall is %d\n",helloworld());
}
Esempio n. 19
0
void main(int argc,String *argv) {

  randomise();
  
  ArgParser a=ArgParser(argc,argv);  
  String fname=a.argafter("-i","GF lines filename","ls.gf");
  cdclip=a.floatafter("-ed","Maximum end distance of lines",30);
  creepintoline=a.floatafter("-ic","Intersection can creep in this much of a the line",0.02);
  dotabove=a.floatafter("-pd","Parallelity: dot product must be above this",0.5);
  minlen=a.floatafter("-ml","Minimum length of a line",20);
  bool displaying=!a.argexists("nod","Don't display");
  String imname=a.argafter("-oi","Original image","none");
  oiscale=a.floatafter("-ois","Scale to original image",2);

  // Read list from file and find quads (looks easy!)
  List<QuadsLine2d> ls=readgfset(fname);
  helloworld();
  printf("Finding quads\n");
  jbmp.clear(0);
  for (int i=1;i<=ls.len;i++) {
    QuadsLine2d l=ls.num(i)*1.8;
    jbmp.line(l,255);
    //jbmp.thickline(l,1,255);
  }
  List<Polygon2d> qs=findquads(ls);
  jbmp.writefile("lines.bmp");
  
  // Simple quad map
  Map2d<bool> jb=Map2d<bool>(640,480,15);
  for (int i=1;i<=qs.len && !key[KEY_ESC];i++) {
    // jb.clear();
    Polygon2d p=qs.num(i);
    for (int j=1;j<=p.vs.len;j++) {
      jb.line(p.linefrom(j)*1.8,0);
    }
  }
  jb.writefile("quads.bmp");
  
  if (displaying) {
    jbmp.display();
    jb.display();
    allegroexit();
  }
  
  JFont coolfont=JFont("c:/joey/code/c/gfx2d/jfont/cool.jf",0.5);
  printf("fd...\n");

  if (!Seq(imname,"none")) {
    
    oi=RGBmp::readfile(imname);
    Map2d<float> *gs=oi->getgreyscale();
    
    // Edge detection
    printf("Doing edge detection\n");
    gs->edgedetection(Map2d<float>::sobel(),&mag,&angs);
    // angs->display();
    // exit(0);
    
    qs.applycall(&scalepoly);
    
    // Overlay quads on original
    RGBmp *rgbmp=oi->scaledby(0.5);
    for (int i=1;i<=qs.len && !key[KEY_ESC];i++) {
      Polygon2d p=qs.num(i);
      for (int j=1;j<=p.vs.len;j++) {
        rgbmp->thickline(0.5*p.linefrom(j),myRGB(0,0,0),3);
      }
    }
    for (int i=1;i<=qs.len && !key[KEY_ESC];i++) {
      Polygon2d p=qs.num(i);
      for (int j=1;j<=p.vs.len;j++) {
        rgbmp->line(0.5*p.linefrom(j),myRGB(0,255,255));
      }
    }
    rgbmp->writefile("overlay.bmp");

    RGBmp *detailed=new RGBmp(oi->width/2.0,oi->height/2.0,myRGB(255,255,255));//oi->scaledby(1);
    for (int i=1;i<=qs.len && !key[KEY_ESC];i++) {
      Polygon2d p=qs.num(i);
      for (int j=1;j<=p.vs.len;j++) {
        detailed->thickline(p.linefrom(j)*0.5,myRGB(0,0,0),1);
      }
      if (myrnd()<1.0/4.0) {
      V2d c=p.vs.num(intrnd(1,4));
      V2d t=c+V2d::random()*100;
      //detailed->line(c,t,myRGB(0,0,0));
      String data=Sformat("%.2f",scorefor(qs.p2num(i)));
      coolfont.centerString(data,detailed,t.x,t.y,8,myRGB(0,0,32));
      }
    }
    detailed->writefile("data.bmp");

    List<String> left;
    List<String> right;
    for (int i=1;i<=qs.len;i++) {
      Polygon2d *p=qs.p2num(i);
      String s=Sformat("%.3f",scorefor(p));
      if (p->centroid().x<oi->width/2.0)
        left.add(s);
      else
        right.add(s);
    }
    List<String> data;
    data.add("-- Left:");
    data.add(left);
    data.add("-- Right:");
    data.add(right);
    writelinestofile(data,"data.txt");

    /* printf("Ordering\n");
       qs=qs.qsort(&offness);
       printf("Done ordering.\n");*/
    
    printf("Removing overlapping quads (%i) ...\n",qs.len);
    // Check all containers first
    for (int i=1;i<=qs.len;i++) {
      Polygon2d *quad=qs.p2num(i);
      bool done=false;
      for (int j=1;j<=qs.len && !done;j++) { // Compare to all others (one-directional)
        printf("Comparing (%i/%i) to %i : ",i,qs.len,j);
        if (i!=j) {
          
          Polygon2d *oquad=qs.p2num(j);
          
          bool overlaps=quad->overlaps(oquad,0.99);
          if (overlaps==Polygon2d::container) { // quad envelops oquad
            if (scorefor(quad)>0.8*scorefor(oquad)) {
              qs.remnum(j);
              j--;
              if (i>j)
                i--;
              printf("Contained quad rejected");
            }
          }
          
        }

        printf("\n");
      }
    }
    // Then overlapping in general
    for (int i=1;i<=qs.len;i++) {
      Polygon2d *quad=qs.p2num(i);
      bool done=false;
      for (int j=i+1;j<=qs.len && !done;j++) { // bi-derectional
        printf("Comparing (%i/%i) to %i : ",i,qs.len,j);
        Polygon2d *oquad=qs.p2num(j);
        
        bool overlaps=quad->overlaps(oquad);
        if (overlaps) {
          if (scorefor(quad)>scorefor(oquad)) {
            qs.remnum(j);
            j--;
            printf("Second quad rejected");
          } else {
            qs.remnum(i);
            i--;
            done=true;
            printf("First quad rejected");
          }
        }
        
        printf("\n");
      }
    }
    printf("Done: now (%i) quads.\n",qs.len);
    
    // Overlay again
    RGBmp *rgbmp2=oi->scaledby(0.5);
    for (int i=1;i<=qs.len && !key[KEY_ESC];i++) {
      Polygon2d p=qs.num(i);
      for (int j=1;j<=p.vs.len;j++) {
        rgbmp2->thickline(0.5*p.linefrom(j),myRGB(0,0,0),3);
      }
    }
    for (int i=1;i<=qs.len && !key[KEY_ESC];i++) {
      Polygon2d p=qs.num(i);
      for (int j=1;j<=p.vs.len;j++) {
        rgbmp2->line(0.5*p.linefrom(j),myRGB(0,255,255));
      }
      V2d t=0.5*p.centroid();
      // rgbmp2->line(oiscale*p.num(1),t,V3d(1,0,0));
      String data=Sformat("%.3f",scorefor(qs.p2num(i)));
      //coolfont.centerString(data,rgbmp2,t.x,t.y,9,myRGB(255,0,0));
    }
    rgbmp2->writefile("overlay2.bmp");
    
    // Recover text
    List<RGBmp *> rec;
    // oi->display();
    for (int i=1;i<=qs.len && i<=5;i++) {
      List<V2d> *l=&qs.num(i).vs;
      RGBmp *n=oi->recoverquad(l,1);
      n->writefile(getnextfilename("recquad","bmp"));
      rec.add(n);
    }
    
    if (displaying) {
      waitforkeypress();
      jbmp.display();
      jb.display();
      for (int i=1;i<=rec.len && !key[KEY_ESC];i++)
      rec.num(i)->display();
    }

    data.add("-- Final quads:");
    for (int i=1;i<=qs.len;i++) {
      Polygon2d *p=qs.p2num(i);
      String s=Sformat("%.3f",scorefor(p));
      data.add(s);
    }
    writelinestofile(data,"data.txt");
  
  }

  allegroexit();
  printf("%i quadrilaterals found\n",qs.len);
  
}
void test_hello2(void)
{
helloworld2_ExpectAndReturn(0, 2);
TEST_ASSERT_NOT_EQUAL(7, helloworld(0));
}
Esempio n. 21
0
File: Ex1.cpp Progetto: OHamm/Uni
int main(){
	helloworld();
	bank::account* meh = new bank::account();
	meh->money();
	return 0;
}
void test_hello(void)
{
helloworld2_ExpectAndReturn(5, 7);

TEST_ASSERT_EQUAL_INT(9, helloworld(5));
}