SOrientedBoundingBox::SOrientedBoundingBox(SOrientedBoundingBox *other)
{
  size = other->getSize();
  axisX = other->getAxis(0);
  axisY = other->getAxis(1);
  axisZ = other->getAxis(2);
  center = other->getCenter();
  fillp();
}
SOrientedBoundingBox::SOrientedBoundingBox()
{
  center = SVector3();
  size = SVector3();
  axisX = SVector3();
  axisY = SVector3();
  axisZ = SVector3();
  fillp();
}
SOrientedBoundingBox::SOrientedBoundingBox(SVector3 &center_, double sizeX,
                                           double sizeY, double sizeZ,
                                           const SVector3 &axisX_,
                                           const SVector3 &axisY_,
                                           const SVector3 &axisZ_)
{
  center = center_;
  size = SVector3(sizeX, sizeY, sizeZ);
  axisX = axisX_;
  axisX.normalize();
  axisY = axisY_;
  axisY.normalize();
  axisZ = axisZ_;
  axisZ.normalize();
  fillp();
}
Beispiel #4
0
void Mouse(char ch)
{
 if(ch=='o')
  bar(0);
 else if(ch=='n')
      {
       setfillstyle(SOLID_FILL,15);
       hidemouse();
       bar(42,62,598,458);
       mousecall();
       setcolor(c);
       bar(c);
      }
 int cl,x5,y5,tool;
 int x1=604,y1=70,z=616,w=84;
 setfillstyle(cc,c);
 bar(12,290,27,310);       //fillp show bar
 do
 {
  if(ch=='n')
  {
   ch='k';
   if(tool==4)
    fout<<"setfillstyle(SOLID_FILL,"<<c<<");\n";
   else
       if(tool==1)
	fout<<"setfillstyle(SOLID_FILL,15);\n";
       else
	   if(tool==6)
	    fout<<"setfillstyle("<<cc<<','<<c<<");\n";
   fout<<"setcolor("<<c<<");\n";
   fout<<"rectangle(42,62,598,458);\n";
  }
  mousecall();
  x1=604,y1=70,z=616,w=84;
  for(int i=0;i<8;i++,y1+=25,w+=25)
  {
   mousepos(cl,x5,y5);
   if(x5>=x1&&x5<=z&&y5>=y1&&y5<=w)
    if(cl==1)
     {
      static int v=1;
      if(v!=c)
      {
       fout<<"setfillstyle(SOLID_FILL,"<<c<<");\n";
       fout<<"setcolor("<<c<<");\n";
       fout<<"rectangle(42,62,598,458);\n";
       v=c;
      }
      c=i;
      setfillstyle(cc,c);
      bar(12,290,27,310);
      setfillstyle(SOLID_FILL,c);

     }
  }

  x1=621,y1=70,z=633,w=84;
  for( i=8;i<16;i++,y1+=25,w+=25)
  {
   mousepos(cl,x5,y5);
   if(x5>=x1&&x5<=z&&y5>=y1&&y5<=w)
    if(cl==1)
    {
     static int v=0;
     c=i;

       setfillstyle(cc,c);
       bar(12,290,27,310);
       setfillstyle(SOLID_FILL,c);
     if(v!=c)
     {
      fout<<"setfillstyle(SOLID_FILL,"<<c<<");\n";
      fout<<"setcolor("<<c<<");\n";
      fout<<"rectangle(42,62,598,458);\n";
      v=c;
     }
    }
  }

  x1=605,y1=320,z=637,w=457;
  for(i=7;i<11;i++,y1+=25,w+=25)
  {
   mousepos(cl,x5,y5);
   if(x5>=x1&&x5<=z&&y5>=y1&&y5<=w)
    if(cl==1)
     {
      static int v=0;
      cc=i;
      setfillstyle(cc,c);
      bar(12,290,27,310);
      if(v!=cc)
      {
       fout<<"setfillstyle("<<cc<<','<<c<<");\n";
       v=cc;
      }
     }
  }
  x1=5,y1=320,z=37,w=457;
  for(i=2;i<7;i++,y1+=25,w+=25)
  {
   mousepos(cl,x5,y5);
   if(x5>=x1&&x5<=z&&y5>=y1&&y5<=w)
    if(cl==1)
     {
      static int v=0;
      cc=i;
      setfillstyle(cc,c);
      bar(12,290,27,310);
      if(v!=cc)
      {
       fout<<"setfillstyle("<<cc<<','<<c<<");\n";
       v=cc;
      }
     }
  }

  bar(c);
  delay(100);
  mousepos(cl,x5,y5);

  if(x5>=621&&x5<=635&&y5>=3&&y5<=16)     //changes made !!!
  {
   if(cl==1)
   {
    hidemouse();
    break;
   }
  }

  mousepos(cl,x5,y5);
  int gg=0;

  gg=help_bar(gg);

  while(x5>=24&&x5<=36&&y5>=70&&y5<=84)
  {
   mousepos(cl,x5,y5);
   setcolor(0);
   settextstyle(SMALL_FONT,0,4);
   outtextxy(45,464,"RECTANGLE ");
   gg=1;
   if(cl==1)
   {
    tool=0;
   }
  }

  gg=help_bar(gg);
  static int er=1;
  mousepos(cl,x5,y5);
  while(x5>=6&&x5<=18&&y5>=145&&y5<=159)
  {
   mousepos(cl,x5,y5);
   setcolor(0);
   settextstyle(SMALL_FONT,0,4);
   outtextxy(45,464,"ERASER ");
   gg=1;

   if(cl==1 && er==1)
   {
    tool=1;
    bar(15);
    fout<<"setfillstyle(SOLID_FILL,15);\n";
    fout<<"setcolor(15);\n";
    er=2;
   }
  }


  if(tool!=1)
  {
   bar(c);
   er=1;
  }
  gg=help_bar(gg);

  mousepos(cl,x5,y5);

  while(x5>=6&&x5<=18&&y5>=70&&y5<=84)
  {
   mousepos(cl,x5,y5);
   setcolor(0);
   settextstyle(SMALL_FONT,0,4);
   outtextxy(45,464,"LINE");
   gg=1;

   if(cl==1)
   {
    tool=2;
   }
  }

  gg=help_bar(gg);

  mousepos(cl,x5,y5);

  while(x5>=6&&x5<=18&&y5>=90&&y5<=109)
  {
   mousepos(cl,x5,y5);
   setcolor(0);
   settextstyle(SMALL_FONT,0,4);
   outtextxy(45,464,"CIRCLE");
   gg=1;

   if(cl==1)
   {
    tool=3;
   }
  }

  gg=help_bar(gg);

  mousepos(cl,x5,y5);

  while(x5>=24&&x5<=36&&y5>=120&&y5<=134)
  {
   mousepos(cl,x5,y5);
   setcolor(0);
   settextstyle(SMALL_FONT,0,4);
   outtextxy(45,464,"BUCKET");
   gg=1;
   if(cl==1)
   {
    if(cc!=1)
    {
     fout<<"setfillstyle(SOLID_FILL,"<<c<<");\n";
     cc=1;
    }
    tool=4;
   }
  }

  gg=help_bar(gg);

   mousepos(cl,x5,y5);

  while(x5>=24&&x5<=36&&y5>=90&&y5<=109)
  {
   mousepos(cl,x5,y5);
   setcolor(0);
   settextstyle(SMALL_FONT,0,4);
   outtextxy(45,464,"BRUSH ");
   gg=1;
   if(cl==1)
   {
    tool=5;
   }
  }


  gg=help_bar(gg);


  mousepos(cl,x5,y5);

  while(x5>=6&&x5<=18&&y5>=120&&y5<=134)
  {
   mousepos(cl,x5,y5);
   setcolor(0);
   settextstyle(SMALL_FONT,0,4);
   gg=1;
   outtextxy(45,464,"FILLER");
   if(cl==1)
   {
    tool=6;
   }
  }

  gg=help_bar(gg);

  mousepos(cl,x5,y5);
  static int v=0;
  if(x5>39 && x5<78 && y5>=42 && y5<=55)     //save
  {
   if(cl==1)
   {
    char f[20];
    hidemouse();
    SBMP("temp.bmp");
    if(op('b'))
    {
     strcpy(f,s);
     if(!strchr(f,'.'))
      strcat(f,".bmp");
     int check;
     check=rename("temp.bmp",f);
     if(check==-1)
     {
      remove(f);
      rename("temp.bmp",f);
     }
    }

    if(v==0)
    {
     if(op('c'))
     {
      v=1;
      if(!strchr(s,'.'))
       strcat(s,".cpp");
      strcpy(::f,s);
     }
     else if(bmp("temp.bmp",0,0))
	  {}
	  else
	   bmp(f,0,0);

    }
    if(bmp(f,0,0));
    else
     bmp("temp.bmp",0,0);
    mousecall();
   }
  }

   mousepos(cl,x5,y5);

  if(x5>=10 && x5<39 && y5>=42 && y5<=55)          //open
  {
   if(cl==1)
   {
    hidemouse();
    SBMP("temp.bmp");
    if(op('o'))
    {
     if(!strchr(s,'.'))
      strcat(s,".bmp");

     if(bmp(s,0,0))
     {
      settextstyle(2,0,7);
      cleardevice();
      setcolor(RED);
      outtextxy(200,220," SUCH FILE DOES NOT EXIST");
      outtextxy(200,280,"PRESS ENTER TO CONTINUE:");
      getch();
      bmp("temp.bmp",0,0);
     }
     }
    else
     bmp("temp.bmp",0,0);
    mousecall();
   }

  }

    mousepos(cl,x5,y5);
  if(x5>78 && x5<111 && y5>=42 && y5<=55)          //new
  { if(cl==1)
  {
   v=0;
   main('n');
  }
  }


    mousepos(cl,x5,y5);
 if(x5>111 && x5<174 && y5>=42 && y5<=55)          //password change
  { if(cl==1)
   {
    hidemouse();
    SBMP("temp.bmp");
    if(op('p'))
    {
     ofstream fout("pass.txt");
     char t[20];
     for(int m=0;s[m]!='\0';m++)
     {
      t[m]=s[m]-27;
     }
     t[m]='\0';
     fout<<t;
     fout.close();
    }
    bmp("temp.bmp",0,0);
    mousecall();

   }
  }


    mousepos(cl,x5,y5);
 if(x5>174 && x5<217 && y5>=42 && y5<=55)          //help
  { if(cl==1)
   {
    hidemouse();
    SBMP("temp.bmp");
    help();
    bmp("temp.bmp",0,0);
    mousecall();
   }
  }



  while(x5>43 && x5<597 && y5>63  && y5<457)
  {
   mousepos(cl,x5,y5);
   mousecall();
   if(cl==1 && x5>43 && x5<597 && y5>63  && y5<457 )
   {
    double a,b,p,x1,y1,x2,y2;
    static int v1=0,v2=0,v3=0,v4=0;
    double r;
    switch(tool)
    {
     case 0://rectangle

     mousecall();
     x1=x5;
     y1=y5;

     delay(500);
     restrict(43,597,63,457);
     mousepos(cl,x5,y5);

     x2=x5,y2=y5;
     setcolor(c);
     hidemouse();
     rectangle(x1,y1,x2,y2);
     if(v1!=x1 || v2!=x2 || v3!=y1 || v4!=y2)
     {
      fout<<"rectangle("<<x1<<','<<y1<<','<<x2<<','<<y2<<");\n";
      v1=x1,v2=x2,v3=y1,v4=y2;
     }
     mousecall();
     restrict(0,640,0,480);
	  break;
   case 1:eraser();
	  break;
   case 2://line();

   mousecall();
   x1=x5;
   y1=y5;

   delay(500);
   restrict(43,597,63,457);
   mousepos(cl,x5,y5);

   x2=x5,y2=y5;
   setcolor(c);
   hidemouse();
   line(x1,y1,x2,y2);
   if(v1!=x1 || v2!=x2 || v3!=y1 || v4!=y2)
   {
    fout<<"line("<<x1<<','<<y1<<','<<x2<<','<<y2<<");\n";
    v1=x1,v2=x2,v3=y1,v4=y2;
   }
   mousecall();
   restrict(0,640,0,480);
	  break;
   case 3://circle();

   mousecall();
   x1=x5;
   y1=y5;

   delay(500);

   restrict(43,597,63,457);
   mousepos(cl,x5,y5);

   x2=x5,y2=y5;
   a=(x1-x2)*(x1-x2),b=(y1-y2)*(y1-y2);
   p=a+b;
   r=SQRT(p);
   setcolor(c);
   int c1=x1+r,c2=x1-r,c3=y1+r,c4=y1-r;
   hidemouse();
   circle(x1,y1,r);
   if(v1!=x1 || v2!=y1)
   {
    fout<<"circle("<<x1<<','<<y1<<','<<r<<");\n";
    v1=x1,v2=y1;
   }
   if(c1>597 || c2<43 || c3>457 || c4<63)
    SCREEN();
   mousecall();
   restrict(0,640,0,480);
   break;
   case 4:bucket();
	  break;
   case 5:brush(x5,y5);
	  break;
   case 6:fillp();
	  break;
   default:brush(x5,y5);
    }
   }
  }
 }while(1);
}