Beispiel #1
0
Point2D XMLtoVecteur::xmlToPoint(TiXmlElement* p) 
{
	Point2D point;
	
	double x;
	if (p->QueryDoubleAttribute("x",&x) == TIXML_SUCCESS)
	{
		point.setX(x);
	}
	else
	{
		point.setX(0.0);
	}
	
	double y;
	if (p->QueryDoubleAttribute("y",&y) == TIXML_SUCCESS)
	{
		point.setY(y);
	}
	else
	{
		point.setY(0.0);
	}

	
	//cout << p->GetText() << endl;
	point.setNom(p->GetText());

	return point;
}
void testDistanceBetween() {
  Point2D firstPoint;
  firstPoint.setX(3);
  firstPoint.setY(5);

  Point2D secondPoint;
  secondPoint.setX(4);
  secondPoint.setY(1);

  cout << firstPoint.distanceTo(secondPoint) << '\n';
}
Beispiel #3
0
Point2D Point2D::operator - (const Point2D &other) const
{
    Point2D temp;
    temp.setX(this->x - other.x);
    temp.setY(this->y - other.y);
    return temp;
}
Beispiel #4
0
Point2D Point2D::operator * (double num) const
{
    Point2D temp;
    temp.setX(this->x * num);
    temp.setY(this->y * num);
    return temp;
}
void testTranslate() {
  Point2D point;
  point.setX(3);
  point.setY(5);

  point.translate(2, 3);
  point.print();
}
Beispiel #6
0
	void ConfigScene::render( unsigned int ticks )
	{
		Point2D textSize;
		vector<Point3D> vertices;
		vector<Color> colors;
		vector<unsigned int short> indices;
		
		if( ticks - this->lastDrawTicks > 15 )
		{
			Screen::get()->clear();
			
			for( vector<ColoredRectangle *>::iterator it = this->rectangles.begin() ; it != this->rectangles.end() ; it++ )
				(*it)->prepareRendering( vertices, colors, indices );
				
			ColoredRectangle::render( vertices, colors, indices );
			
			unsigned int screenWidth = Screen::get()->getWidth() - this->left - this->right;
			unsigned int screenHeight = Screen::get()->getHeight() - this->top - this->bottom;
			
			// Top
			textSize.moveTo( 0, 0 );
			Font::get("bitmap")->getTextSize( textSize, this->sTop );
			Font::get("bitmap")->write( Point2D( this->left + (screenWidth - textSize.getX()) / 2.0f, this->top + 20 ), this->sTop );
			
			// Left
			textSize.moveTo( 0, 0 );
			Font::get("bitmap")->getTextSize( textSize, this->sLeft );
			Font::get("bitmap")->write( Point2D( this->left + 20, this->top + (screenHeight - textSize.getY()) / 2.0f ), this->sLeft );
			
			// Right
			textSize.moveTo( 0, 0 );
			Font::get("bitmap")->getTextSize( textSize, this->sRight );
			Font::get("bitmap")->write( Point2D( this->left + screenWidth - textSize.getX() - 20, this->top + (screenHeight - textSize.getY()) / 2.0f ), this->sRight );
			
			// Bottom
			textSize.moveTo( 0, 0 );
			Font::get("bitmap")->getTextSize( textSize, this->sBottom );
			Font::get("bitmap")->write( Point2D( this->left + (screenWidth - textSize.getX()) / 2.0f, this->top + screenHeight - textSize.getY() - 20 ), this->sBottom );
			
			// Instructions
			textSize.moveTo( 0, this->top + (screenHeight - Font::get("bitmap")->getTextHeight( this->instructions ) ) / 2.0f );
			
			string line;
			unsigned int index = 0;
			size_t newLineIndex = this->instructions.find( '\n', index );
			
			while( newLineIndex != string::npos )
			{
				line = this->instructions.substr( index, newLineIndex - index );
				textSize.setX( this->left + (screenWidth - Font::get("bitmap")->getTextWidth( line )) / 2.0f );
				
				Font::get("bitmap")->write( textSize, line );
				textSize.moveBy( 0, Font::get("bitmap")->getTextHeight( line ) );
				
				index = newLineIndex + 1;
				newLineIndex = this->instructions.find( '\n', index );
			}
			
			if( index < this->instructions.length() )
			{
				line = this->instructions.substr( index );
				textSize.setX( this->left + (screenWidth - Font::get("bitmap")->getTextWidth( line )) / 2.0f );
				Font::get("bitmap")->write( textSize, line );
			}
			
			Font::get("bitmap")->render();
			
			Screen::get()->render();
			
			this->lastDrawTicks = ticks;
		}
	}
bool Monster::checkBoxes(std::vector<CollisionBox>* boxes, float p_x, float p_y){
	CollisionBox box;

	Point2D A = Point2D(this->getX(), this->getY());
	Point2D B;
	for (int i = 0; i < boxes->size(); i++){
		box = boxes->at(i);


		if (box.getRight() < this->getBox().getLeft())
			B.setX(box.getRight());
		else if (box.getLeft() > this->getBox().getRight())
			B.setX(box.getLeft());
		else
			B.setX(this->getX());

		if (box.getTop() < this->getBox().getBottom())
			B.setY(box.getTop());
		else if (box.getBottom() > this->getBox().getTop())
			B.setY(box.getBottom());
		else
			B.setY(this->getY());


		float difx = (B.getX() - A.getX()) * (B.getX() - A.getX());
		float dify = (B.getY() - A.getY()) * (B.getY() - A.getY());

		float dist = difx + dify;
		if (dist <= this->getRadius() * this->getRadius()){


			if ((this->getBox().getBottom() > box.getTop() ||
				this->getBox().getTop() < box.getBottom())
				){
				if (this->getBox().getBottom() > box.getTop()){
					if (p_x == this->getX()){
						this->angle = 0;
					}

					else if (p_x > this->getX()){

						if (this->getY() < p_y)
							this->angle = 8;
						else
							this->angle = 0;

					}
					else {

						if (this->getY() < p_y)
							this->angle = 172;
						else
							this->angle = 180;
					}

				}
				else if (this->getBox().getTop() < box.getBottom()){
					if (p_x == this->getX()){
						this->angle = 0;
					}

					else if (p_x > this->getX()){
						if (this->getY() > p_y)
							this->angle = 352;
						else
							this->angle = 0;

					}
					else{
						if (this->getY() > p_y)
							this->angle = 188;
						else
							this->angle = 180;
					}
				}

			}
			else if ((this->getBox().getRight() < box.getLeft() || this->getBox().getLeft() > box.getRight())
				){

				float up = box.getTop() - this->getY();
				float down = this->getY() - box.getBottom();

				if (this->getBox().getRight() < box.getLeft()){
					if (p_y == this->getY()){
						this->angle = 90;
					}
					else if (p_y > this->getY()){
						if (this->getX() > p_x)
							this->turn(this->getX() - 16, box.getTop() + 32);
						else
							this->turn(this->getX(), box.getTop() + 32);
					}
					else{
						if (this->getX() > p_x)
							this->turn(this->getX() - 16, box.getBottom() - 32);
						else
							this->turn(this->getX(), box.getBottom() - 32);
					}

				}
				else if (this->getBox().getLeft() > box.getRight()){

					if (p_y == this->getY()){
						this->angle = 90;
					}
					else if (p_y > this->getY()){
						if (this->getX() < p_x)
							this->turn(this->getX() + 16, box.getTop() + 32);
						else
							this->turn(this->getX(), box.getTop() + 32);
					}
					else{
						if (this->getX() < p_x)
							this->turn(this->getX() + 16, box.getBottom() - 32);
						else
							this->turn(this->getX(), box.getBottom() - 32);
					}
				}
			}
			return true;
		}
		else
			continue;
	}
	return false;
}
Beispiel #8
0
//Computes the Fresnel integrals S(x) and C(x) for all real x
Point2D<double> EulerSpiral::get_fresnel_integral(double x)
{
    bool odd;
    int k,n;
    double a,ax,fact,pix2,sign,sum,sumc,sums,term,test;

    std::complex<double> b,cc,d,h,del,cs;
    Point2D<double> result;

    ax=fabs(x);
    if (ax < sqrt(FPMIN))
    {
        //Special case: avoid failure of convergence test because of undeflow.
        result.setY(0.0);
        result.setX(ax);
    }
    else {
        if (ax <= XMIN)
        {
            // Evaluate both series simultaneously.
            sum=sums=0.0;
            sumc=ax;
            sign=1.0;
            fact=(M_PI/2.0)*ax*ax;
            odd=true;
            term=ax;
            n=3;

            for (k=1; k<=MAXIT; k++)
            {
                term *= fact/k;
                sum  += sign*term/n;
                test=fabs(sum)*EPS;
                if (odd)
                {
                    sign = -sign;
                    sums=sum;
                    sum=sumc;
                }
                else {
                    sumc=sum;
                    sum=sums;
                }

                if (term < test) break;
                odd=!odd;
                n +=2;
            }

            if (k > MAXIT)
                std::cout << "series failed in fresnel" << std::endl;

            result.setY(sums);
            result.setX(sumc);
        }
        else {
            // Evaluate continued fraction by modified Lentz's method
            pix2=M_PI*ax*ax;
            b   = std::complex<double>(1.0,-pix2);
            cc  = std::complex<double>(1.0/FPMIN,0.0);
            d=h = std::complex<double>(1.0,0.0)/b;
            n = -1;

            for (k=2; k<=MAXIT; k++)
            {
                n +=2;
                a = -n*(n+1);
                b= b+std::complex<double>(4.0,0.0);
                d=(std::complex<double>(1.0,0.0)/((a*d)+b));

                //Denominators cannot be zero
                cc=(b+(std::complex<double>(a,0.0)/cc));

                del=(cc*d);
                h=h*del;
                if ((fabs(del.real()-1.0)+fabs(del.imag())) < EPS)
                    break;
            }
            if (k > MAXIT)
                std::cout << "cf failed in frenel" << std::endl;

            h=std::complex<double>(ax,-ax)*h;
            cs=std::complex<double>(0.5,0.5)*(std::complex<double>(1.0,0.0) - std::complex<double>(cos(0.5*pix2),sin(0.5*pix2))*h );

            result.setX(cs.real());
            result.setY(cs.imag());
        }
    }

    if (x<0) { //use antisymmetry
        result = -1*result;
    }

    return result;
}
bool StudentLocalization::stepFindExactEyes(const IntensityImage &image, FeatureMap &features) const {

   int temp = 0;
	ImageIO::saveIntensityImage(image, ImageIO::getDebugFileName("input.png"));

	IntensityImageStudent copy(image);

	double** d_kern = new double*[3];
	for (int y = 0; y < 3; y++) {
		d_kern[y] = new double[3];
	}
	d_kern[0][0] = 0; 
	d_kern[0][1] = 1;
	d_kern[0][2] = 0;
	d_kern[1][0] = 1;
	d_kern[1][1] = 0;
	d_kern[1][2] = 1;
	d_kern[2][0] = 0;
	d_kern[2][1] = 1;
	d_kern[2][2] = 0;

	StudentKernel dilation = StudentKernel(d_kern, 3, 3, 0);

   Feature top = features.getFeature(Feature::FEATURE_HEAD_TOP);
   Feature bottom = features.getFeature(Feature::FEATURE_CHIN);
	Feature nose_bottom = features.getFeature(Feature::FEATURE_NOSE_BOTTOM);
	Feature headsideleft = features.getFeature(Feature::FEATURE_HEAD_LEFT_SIDE);
	Feature headsideright = features.getFeature(Feature::FEATURE_HEAD_RIGHT_SIDE);

   const int nose_to_top = nose_bottom.getY() - top.getY();

#if UNNECESSARY_CODE
#endif
	Point2D<double> headsidelp = headsideleft.getPoints()[0];
	headsidelp.setY(top.getY() + (nose_to_top*3/5));
	headsidelp.setX((headsidelp.getX()));


	Point2D<double> headsiderp = headsideright.getPoints()[0];
   headsiderp.setY(nose_bottom.getY() - (nose_to_top*1/5));
	headsiderp.setX((headsiderp.getX() + 3));


   IntensityImageStudent eyes = ImageUtils::subimage(&image, headsidelp, headsiderp);
	IntensityImageStudent eyes_dilated = dilation.dilate(&eyes);

   StudentHistogram histo{eyes_dilated.getWidth()};
   int zero_points[2] = { 0, histo.get_length() * 1 / 7 };
   int lowest_found[2] = { eyes_dilated.getHeight(), eyes_dilated.getHeight() };

   int left_out = 0, left_out_x = 0,
       right_out = 0, right_out_x = 0,
       left_in = 0, left_in_x = 0,
       right_in = 0, right_in_x = 0;

   for (int x = 0; x < histo.get_length(); x++){
       temp = 0;
       for (int y = 0; y < eyes_dilated.getHeight(); y++){
           temp += eyes_dilated.getPixel(x, y) > 127 ? 0 : 1;
       }
       histo.set_value(x, temp);
       if (x < histo.get_length() * 3 / 10 && temp <= lowest_found[0]){
           lowest_found[0] = temp;
           zero_points[0] = x;
       }
       if (x > histo.get_length() * 7 / 10 && temp < lowest_found[1]){
           lowest_found[1] = temp;
           zero_points[1] = x;
       }
   }

   headsidelp.setX(headsidelp.getX() + zero_points[0]);
   headsiderp.setX(headsiderp.getX() - (histo.get_length() - zero_points[1]));

   headsidelp.setY(top.getY() + (nose_to_top * 2/ 5));
   headsiderp.setY(nose_bottom.getY());

   IntensityImageStudent eyes2(ImageUtils::subimage(&image, headsidelp, headsiderp));
   IntensityImageStudent eyes_copy2(dilation.dilate(&eyes2));

   histo.cut_to_size(zero_points[0], zero_points[1]);
   for (int x = 0; x < histo.get_length(); x++){
       if (x < histo.get_length() * 2 / 9){
           left_out_x = histo.get_value(x) > left_out ? x : left_out_x;
           left_out = histo.get_value(x) > left_out ? histo.get_value(x) : left_out;
       }
       else if (x < histo.get_length() * 4 / 9 && x > histo.get_length() * 2 / 9){
           left_in_x = histo.get_value(x) > left_in ? x : left_in_x;
           left_in = histo.get_value(x) > left_in ? histo.get_value(x) : left_in;
       }
       else if (x > histo.get_length() * 7 / 9){
           right_out_x = histo.get_value(x) > right_out ? x : right_out_x;
           right_out = histo.get_value(x) > right_out ? histo.get_value(x) : right_out;
       }
       else if (x > histo.get_length() * 5 / 9){
           right_in_x = histo.get_value(x) > right_in ? x : right_in_x;
           right_in = histo.get_value(x) > right_in ? histo.get_value(x) : right_in;
       }
   }

   int forehead_val = 10, forehead_y = 0;
   StudentHistogram histo2{eyes_copy2.getHeight()};
   for (int y = 0; y < histo2.get_length(); y++){
       temp = 0;
       for (int x = 0; x < eyes_copy2.getWidth(); x++){
           temp += eyes_copy2.getPixel(x, y) > 127 ? 0 : 1;
       }
       histo2.set_value(y, temp);
   }
   for (int y = 0; y < histo2.get_length(); y++){
       if (histo2.get_value(y) <= forehead_val){
           forehead_val = histo2.get_value(y);
           forehead_y = y;
       }
       else if (histo2.get_value(y) > 35 && forehead_val != 10) break;
   }

   headsidelp.setY(top.getY() + (nose_to_top * 2 / 5) + forehead_y);
   forehead_val = 15, forehead_y = histo2.get_length() -1;

   for (int y = histo2.get_length() -1; y > 0; --y){
       if (histo2.get_value(y) <= forehead_val){
           forehead_val = histo2.get_value(y);
           forehead_y = y;
       }
       else if (histo2.get_value(y) > 40 && forehead_val != 15) break;
   }

   headsiderp.setY(nose_bottom.getY() - (histo2.get_length() - forehead_y + 4));

   Point2D<double> precise_ref{headsidelp};
   IntensityImageStudent eyes3(ImageUtils::subimage(&image, headsidelp, headsiderp));
   IntensityImageStudent eyes_copy3(dilation.dilate(&eyes3));

#ifdef DEBUG
   ImageIO::saveIntensityImage(eyes2, ImageIO::getDebugFileName("first eye cut.png"));
   ImageIO::saveIntensityImage(eyes_copy3, ImageIO::getDebugFileName("subimage_test3.png"));
#endif // DEBUG

   StudentHistogram histo4{ eyes_copy3.getHeight() };
   for (int y = 0; y < histo4.get_length(); y++){
       temp = 0;
       for (int x = 0; x < eyes_copy3.getWidth(); x++){
           temp += eyes_copy3.getPixel(x, y) > 127 ? 0 : 1;
       }
       histo4.set_value(y, temp);
   }

#ifdef DEBUG
   ImageIO::saveIntensityImage(*histo2.get_debug_image(), ImageIO::getDebugFileName("histo2.png"));
#endif // DEBUG

   int step = 0, bottom_eye_y = headsiderp.getY(), top_eye_y = headsidelp.getY() +10;
   for (int y = histo4.get_length(); y > 0; --y){
       if (step == 0 && histo4.get_value(y) > 30){ bottom_eye_y = y; step++; }
       if (step == 1 && histo4.get_value(y) < histo4.get_value(bottom_eye_y)){
           top_eye_y = y;
           break;
       }
   }

   IntensityImageStudent eyes_precise{eyes3};
   for (int x = 0; x < eyes_precise.getWidth(); x++){ eyes_precise.setPixel(x, top_eye_y, 127); eyes_precise.setPixel(x, bottom_eye_y + 2, 127); }
   for (int y = 0; y < eyes_precise.getHeight(); y++){
       eyes_precise.setPixel(left_in_x, y, 127);
       eyes_precise.setPixel(right_in_x, y, 127);
       eyes_precise.setPixel(left_out_x, y, 127);
       eyes_precise.setPixel(right_out_x, y, 127);
   }
   bottom_eye_y += 2;
   IntensityImageStudent eyes_precise2 = ImageUtils::subimage( &eyes_precise, Point2D<double>{0.0, (double)(top_eye_y)}, Point2D<double>{(double)eyes_precise.getWidth(), (double)bottom_eye_y} );

#ifdef DEBUG
   ImageIO::saveIntensityImage(eyes_precise2, ImageIO::getDebugFileName("eyes_precise.png"));
   ImageIO::saveIntensityImage(*histo.get_debug_image(), ImageIO::getDebugFileName("histo.png"));

#endif // DEBUG

   StudentHistogram histoTopBottom{eyes_precise2.getWidth()};
   for (int i = 0; i < histoTopBottom.get_length(); i++){
       temp = 0;
       for (int j = 0; j < eyes_precise2.getHeight(); j++){
           temp += eyes_precise2.getPixel(i, j) > 127? 0: 1;
       }
       histoTopBottom.set_value(i, temp);
   }

#ifdef DEBUG
   ImageIO::saveIntensityImage(*histoTopBottom.get_debug_image(), ImageIO::getDebugFileName("histo.png"));
#endif // DEBUG

   int outsideLeftX = 0, insideLeftX = 0, insideRightX = 0, outsideRightX = histoTopBottom.get_length()-1;
   for (int i = 0; i < histoTopBottom.get_length(); i++){
       if (histoTopBottom.get_value(i) > eyes_precise2.getHeight() / 2 && i < histoTopBottom.get_length()*1/4){
           outsideLeftX = i;
           i = histoTopBottom.get_length() * 1 / 4;
       }
       else if (histoTopBottom.get_value(i) < eyes_precise2.getHeight() / 3 && i < histoTopBottom.get_length() / 2 && i > histoTopBottom.get_length() * 1 / 4){
           insideLeftX = i;
           i = histoTopBottom.get_length() / 2;
       }
       else if (histoTopBottom.get_value(i) > eyes_precise2.getHeight() / 2 && i < histoTopBottom.get_length() * 3 / 4 && i > histoTopBottom.get_length() / 2){
           insideRightX = i;
           i = histoTopBottom.get_length() * 3 / 4;
       }
       else if (histoTopBottom.get_value(i) < eyes_precise2.getHeight() / 3 && i > histoTopBottom.get_length() * 3 / 4){
           outsideRightX = i;
           break;
       }
   }

#ifdef DEBUG
   IntensityImageStudent eyes_precise21 = ImageUtils::subimage(&eyes_precise, Point2D<double>{(double)outsideLeftX, (double)(top_eye_y)}, Point2D<double>{(double)insideLeftX, (double)bottom_eye_y});
   ImageIO::saveIntensityImage(eyes_precise21, ImageIO::getDebugFileName("left_eye.png"));


   IntensityImageStudent eyes_precise22 = ImageUtils::subimage(&eyes_precise, Point2D<double>{(double)insideRightX, (double)(top_eye_y)}, Point2D<double>{(double)outsideRightX, (double)bottom_eye_y});
   ImageIO::saveIntensityImage(eyes_precise22, ImageIO::getDebugFileName("right_eye.png"));
#endif

   Feature left = Feature(Feature::FEATURE_EYE_LEFT_RECT);
   Feature right = Feature(Feature::FEATURE_EYE_RIGHT_RECT);

   left.addPoint(precise_ref + Point2D<double>{(double)outsideLeftX, (double)(top_eye_y)});
   left.addPoint(precise_ref + Point2D<double>{(double)insideLeftX, (double)bottom_eye_y});

   right.addPoint(precise_ref + Point2D<double>{(double)insideRightX, (double)(top_eye_y)});
   right.addPoint(precise_ref + Point2D<double>{(double)outsideRightX, (double)bottom_eye_y});

	features.putFeature(right);
	features.putFeature(left);


	for (int y = 0; y < 3; y++) {
		delete[] d_kern[y];
	}
	delete[] d_kern;

	return true;
}
int main(int argc, char* argv[])
{
	CS325Graphics window(argc, argv);

	float delta = 0.1;

	Point2D p1(CS325Graphics::X_MIN, CS325Graphics::Y_MAX / 4.5);
	Point2D p2(CS325Graphics::X_MAX, CS325Graphics::Y_MAX / 4.5);
	Point2D p3(CS325Graphics::X_MIN, CS325Graphics::Y_MIN);
	Point2D p4(CS325Graphics::X_MAX, CS325Graphics::Y_MAX);

	//Points 41, 42, 45, 46 control the sandbox. DON"T MESS WITH THEM!

	Point3D p30(0.5,  0.5,-3.5);
	Point3D p31(0.5, -0.5,-3.5);
	Point3D p32(-0.5,-0.5,-3.5);
	Point3D p33(-0.5, 0.5,-3.5);
	Point3D p34(0.5,  0.5,-1.5);
	Point3D p35(0.5, -0.5,-1.5);
	Point3D p36(-0.5,-0.5,-1.5);
	Point3D p37(-0.5, 0.5,-1.5);

	Point3D p40( -70.8, 28.8, -50.8);
	Point3D p41( 50.8,-2.8,  50.8);
	Point3D p42(-50.8,-2.8,  50.8);
	Point3D p43(-58.8, 25.8,  50.8);
	Point3D p44( 50.8, 50.8, -50.8);
	Point3D p45( 50.8,-2.8, -50.8);
	Point3D p46(-50.8,-2.8, -50.8);
	Point3D p47(-84.8,-2.8, -50.8);
	Point3D p49(-8.5,22.0, 50.8);
	Point3D p48(70,20,50.8);

	Point3D p50(3.5,  0.5,-3.5);
	Point3D p51(3.5, -0.5,-3.5);
	Point3D p52(2.5,-0.5,-3.5);
	Point3D p53(2.5, 0.5,-3.5);
	Point3D p54(3.5,  0.5,-1.5);
	Point3D p55(3.5, -0.5,-1.5);
	Point3D p56(2.5,-0.5,-1.5);
	Point3D p57(2.5, 0.5,-1.5);

	Point3D p60(3.5,  0.5, 13.5);
	Point3D p61(3.5, -0.5, 13.5);
	Point3D p62(2.5,-0.5,  13.5);
	Point3D p63(2.5, 0.5,  13.5);
	Point3D p64(3.5,  0.5, 16.5);
	Point3D p65(3.5, -0.5, 16.5);
	Point3D p66(2.5,-0.5,  16.5);
	Point3D p67(2.5, 0.5,  16.5);

	

	Point2D viewPos;
	Vector2D viewDir;
	Vector3D deltaV;
	viewDir.setAngle(0);


	// move view position

	for(int i = 0; i < MOVE_TEST; i){
		/*window.DrawLineOnScreen(p1, p2);*/
		//window.DrawLineOnScreen(p4, p3);

		window.DrawLineInSpace(p30, p31);
		window.DrawLineInSpace(p31, p32);
		window.DrawLineInSpace(p32, p33);
		window.DrawLineInSpace(p33, p30);
		window.DrawLineInSpace(p34, p35);
		window.DrawLineInSpace(p35, p36);
		window.DrawLineInSpace(p36, p37);
		window.DrawLineInSpace(p37, p34);
		window.DrawLineInSpace(p30, p34);
		window.DrawLineInSpace(p31, p35);
		window.DrawLineInSpace(p32, p36);
		window.DrawLineInSpace(p33, p37);

		window.DrawLineInSpace(p50, p51);
		window.DrawLineInSpace(p51, p52);
		window.DrawLineInSpace(p52, p53);
		window.DrawLineInSpace(p53, p50);
		window.DrawLineInSpace(p54, p55);
		window.DrawLineInSpace(p55, p56);
		window.DrawLineInSpace(p56, p57);
		window.DrawLineInSpace(p57, p54);
		window.DrawLineInSpace(p50, p54);
		window.DrawLineInSpace(p51, p55);
		window.DrawLineInSpace(p52, p56);
		window.DrawLineInSpace(p53, p57);

		window.DrawLineInSpace(p60, p61);
		window.DrawLineInSpace(p61, p62);
		window.DrawLineInSpace(p62, p63);
		window.DrawLineInSpace(p63, p60);
		window.DrawLineInSpace(p64, p65);
		window.DrawLineInSpace(p65, p66);
		window.DrawLineInSpace(p66, p67);
		window.DrawLineInSpace(p67, p64);
		window.DrawLineInSpace(p60, p64);
		window.DrawLineInSpace(p61, p65);
		window.DrawLineInSpace(p62, p66);
		window.DrawLineInSpace(p63, p67);


		//window.DrawLineInSpace(p40, p41);
		window.DrawLineInSpace(p41, p42);
		window.DrawLineInSpace(p42, p43);
		//window.DrawLineInSpace(p43, p40);
		//window.DrawLineInSpace(p44, p45);
		window.DrawLineInSpace(p45, p46);
		//window.DrawLineInSpace(p46, p47);
		//window.DrawLineInSpace(p47, p44);
		window.DrawLineInSpace(p40, p45);
		window.DrawLineInSpace(p41, p45);
		window.DrawLineInSpace(p42, p46);
		window.DrawLineInSpace(p43, p47);
		window.DrawLineInSpace(p40, p47);
		window.DrawLineInSpace(p41, p49);
		window.DrawLineInSpace(p42, p49);
		window.DrawLineInSpace(p41, p48);
		window.DrawLineInSpace(p45, p48);


				if(GetAsyncKeyState(VK_DOWN)) // the DOWN arrow was pressed, let's do something
		{
		delta = -.1;
		viewPos.setY(viewPos.getY() + cos(-viewDir.getAngle())*delta);
		viewPos.setX(viewPos.getX() + sin(-viewDir.getAngle())*delta);
		window.SetViewPosition(viewPos);
		cout << "view pos: " << viewPos.toString() << endl;

		window.DisplayNow();
		Sleep(50);
				}

			if(GetAsyncKeyState(VK_UP)) // the UP arrow was pressed, let's do something
		{
		delta = .1;
		viewPos.setY(viewPos.getY() + cos(-viewDir.getAngle())*delta);
		viewPos.setX(viewPos.getX() + sin(-viewDir.getAngle())*delta);
		window.SetViewPosition(viewPos);
		cout << "view pos: " << viewPos.toString() << endl;

		window.DisplayNow();
		Sleep(50);
				}
				if(GetAsyncKeyState(VK_RIGHT)) // the RIGHT arrow was pressed, let's do something
		{
	
		delta = .1;

		viewDir.setAngle(viewDir.getAngle()+delta);
		window.SetViewDirection(viewDir);
		cout << "view dir: " << viewDir.getAngle() << endl;

		window.DisplayNow();
		Sleep(50);	
			}
			
			if(GetAsyncKeyState(VK_LEFT)) // the LEFT arrow was pressed, let's do something
		{
	
		delta = -.1;

		viewDir.setAngle(viewDir.getAngle()+delta);
		window.SetViewDirection(viewDir);
		cout << "view dir: " << viewDir.getAngle() << endl;

		window.DisplayNow();
		Sleep(50);	
			}

		if(GetAsyncKeyState(VK_ESCAPE))
		{
			return 1;
		}
	}


		
	
}