예제 #1
0
void Draw2D::drawCube(SDL_Surface *screen,Point3D _pt1, Point3D _pt2, Point3D _pt3, Point3D _pt4)
{
    //   4----6
    //  /|   /|
    //  7----8|
    //  |1---|2
    //  |/   |/
    //  3----5

    // with the 4 points we can find the 4 others
    Point3D pt5 = _pt2+_pt3-_pt1;
    Point3D pt6 = _pt2+_pt4-_pt1;
    Point3D pt7 = _pt3+_pt4-_pt1;
    Point3D pt8 = pt5+_pt4-_pt1;

    // construct all segments
    Segment3D seg1(_pt1,_pt2);
    Segment3D seg2(_pt1,_pt3);
    Segment3D seg3(_pt1,_pt4);
    Segment3D seg4(_pt3,pt5);
    Segment3D seg5(pt5,pt8);
    Segment3D seg6(pt5,_pt2);
    Segment3D seg7(_pt3,pt7);
    Segment3D seg8(_pt2,pt6);
    Segment3D seg9(pt7,_pt4);
    Segment3D seg10(_pt4,pt6);
    Segment3D seg11(pt6,pt8);
    Segment3D seg12(pt7,pt8);

    // draw all segments
    drawSegment(screen,seg1);
    drawSegment(screen,seg2);
    drawSegment(screen,seg3);
    drawSegment(screen,seg4);
    drawSegment(screen,seg5);
    drawSegment(screen,seg6);
    drawSegment(screen,seg7);
    drawSegment(screen,seg8);
    drawSegment(screen,seg9);
    drawSegment(screen,seg10);
    drawSegment(screen,seg11);
    drawSegment(screen,seg12);
}
예제 #2
0
파일: digit.cpp 프로젝트: poyu1990/Clock
void DIGIT::displayMonth(int month)
{
     bool display[8]; 
     switch (month)
     {
            case 1:      seg0(true); 
                         seg1(true);
                         seg2(true);
                         seg3(true);
                         x += 9;
                         seg0(true);
                         seg1(true);
                         seg2(true);
                         seg4(true);
                         seg5(true);
                         seg6(true);
                         seg7(true); 
                         x += 9;
                         seg1(true);
                         seg2(true);
                         seg4(true);
                         seg5(true);
                         seg8(true);
                         seg13(true);
                         break; 
                 
            case 2:      seg0(true);
                         seg4(true);
                         seg5(true);
                         seg6(true); 
                         x += 9;
                         seg0(true);
                         seg3(true); 
                         seg4(true);
                         seg5(true);
                         seg6(true);
                         x += 9; 
                         for(int i=0; i<8; i++)
                             (this->*ptr[i])(true);
                         break; 
                             
            case 3:      seg1(true);
                         seg2(true);
                         seg4(true);
                         seg5(true);
                         seg8(true);
                         seg9(true);
                         x += 9;
                         seg0(true);
                         seg1(true);
                         seg2(true);
                         seg4(true);
                         seg5(true);
                         seg6(true);
                         seg7(true); 
                         x += 9;
                         seg0(true);
                         seg1(true);
                         seg4(true);
                         seg5(true);
                         seg6(true);
                         seg7(true);
                         seg13(true);
                         break;   
                          
            case 4:      seg0(true);
                         seg1(true);
                         seg2(true);
                         seg4(true);
                         seg5(true);
                         seg6(true);
                         seg7(true); 
                         x += 9;
                         seg0(true);
                         seg1(true);
                         seg4(true);
                         seg5(true);
                         seg6(true);
                         seg7(true);
                         seg13(true);
                         x += 9;
                         seg0(true);
                         seg1(true);
                         seg4(true);
                         seg5(true);
                         seg6(true);
                         seg7(true);
                         seg13(true);
                         break; 
                         
            case 5:      seg1(true);
                         seg2(true);
                         seg4(true);
                         seg5(true);
                         seg8(true);
                         seg9(true);
                         x += 9;
                         seg0(true);
                         seg1(true);
                         seg2(true);
                         seg4(true);
                         seg5(true);
                         seg6(true);
                         seg7(true); 
                         x += 9;
                         seg8(true);
                         seg10(true);
                         seg12(true);
                         break; 
                          
            case 6:      seg0(true); 
                         seg1(true);
                         seg2(true);
                         seg3(true);
                         x += 9;
                         seg1(true);
                         seg2(true);
                         seg3(true);
                         seg4(true);
                         seg5(true);
                         x += 9;
                         seg1(true);
                         seg2(true);
                         seg4(true);
                         seg5(true);
                         seg8(true);
                         seg13(true);
                         break;
                         
            case 7:      seg0(true); 
                         seg1(true);
                         seg2(true);
                         seg3(true);
                         x += 9;
                         seg1(true);
                         seg2(true);
                         seg3(true);
                         seg4(true);
                         seg5(true);
                         x += 9;
                         seg1(true);
                         seg2(true);
                         break;
                          
            case 8:      seg0(true);
                         seg1(true);
                         seg2(true);
                         seg4(true);
                         seg5(true);
                         seg6(true);
                         seg7(true);
                         x += 9;
                         seg1(true);
                         seg2(true);
                         seg3(true);
                         seg4(true);
                         seg5(true);
                         x += 9;
                         seg0(true); 
                         seg3(true);
                         seg4(true);
                         seg5(true);
                         seg6(true);
                         break;
                          
            case 9:      lookup(5, display);
                         for(int i=0; i<8; i++)
                             (this->*ptr[i])(display[i]);
                         x += 9;
                         seg0(true);
                         seg3(true); 
                         seg4(true);
                         seg5(true);
                         seg6(true);
                         x += 9;
                         seg0(true);
                         seg1(true);
                         seg4(true);
                         seg5(true);
                         seg6(true);
                         seg7(true);
                         seg13(true);
                         break;
                          
            case 10:     lookup(0, display);
                         for(int i=0; i<8; i++)
                             (this->*ptr[i])(display[i]);
                         x += 9;
                         seg0(true);
                         seg3(true);
                         seg4(true);
                         seg5(true);
                         x += 9;
                         seg0(true);
                         seg9(true);
                         seg12(true);
                         break; 
                          
            case 11:     seg1(true);
                         seg2(true);
                         seg4(true);
                         seg5(true);
                         seg8(true);
                         seg13(true);
                         x += 9;
                         lookup(0, display);
                         for(int i=0; i<8; i++)
                             (this->*ptr[i])(display[i]);
                         x += 9;
                         seg1(true);
                         seg2(true);
                         seg8(true);
                         seg13(true);
                         break; 
                         
            case 12:     lookup(0, display);
                         for(int i=0; i<8; i++)
                             (this->*ptr[i])(display[i]);
                         x += 9;
                         seg0(true);
                         seg3(true); 
                         seg4(true);
                         seg5(true);
                         seg6(true);
                         x += 9; 
                         seg0(true);
                         seg3(true);
                         seg4(true);
                         seg5(true);
                         break; 
                       
            }                     

}
예제 #3
0
std::vector<std::string> StrainMeasures::getSixteenSegmentStrains(std::string fieldName, double wall_xi) {

#ifdef printcoord
	std::cout << "Linear 3D " << fieldName << "\t" << wall_xi << std::endl;
#endif
	std::vector<WallSegment> segments;

	//APLAX 10 22 34 46 46 40 28 16 4
	//      13  9  5  1  1  3  7 11 15
	//Base
	WallSegment seg1(13, 9);
	seg1.setXIA(0, 1, wall_xi);
	seg1.setXIB(0, 1, wall_xi);

	WallSegment seg2(9, 5);
	seg2.setXIA(0, 1, wall_xi);
	seg2.setXIB(0, 1, wall_xi);

	//Mid
	WallSegment seg3(5, 1);
	seg3.setXIA(0, 1, wall_xi);
	seg3.setXIB(0, 1, wall_xi);

	WallSegment seg4(1, 1);
	seg4.setXIA(0, 1, wall_xi);
	seg4.setXIB(0, 0, wall_xi);

	//Apex

	WallSegment seg5(1, 3);
	seg5.setXIA(0, 0, wall_xi);
	seg5.setXIB(0, 1, wall_xi);

	WallSegment seg6(3, 7);
	seg6.setXIA(0, 1, wall_xi);
	seg6.setXIB(0, 1, wall_xi);

	WallSegment seg7(7, 11);
	seg7.setXIA(0, 1, wall_xi);
	seg7.setXIB(0, 1, wall_xi);

	WallSegment seg8(11, 15);
	seg8.setXIA(0, 1, wall_xi);
	seg8.setXIB(0, 1, wall_xi);

	//TCH 12 24 36 48 48 42 30 18 6
	//    45 41 37 33 33 35 39 43 47
	//Base
	WallSegment tseg1(45, 41);
	tseg1.setXIA(0, 1, wall_xi);
	tseg1.setXIB(0, 1, wall_xi);

	WallSegment tseg2(41, 37);
	tseg2.setXIA(0, 1, wall_xi);
	tseg2.setXIB(0, 1, wall_xi);

	//Mid
	WallSegment tseg3(37, 33);
	tseg3.setXIA(0, 1, wall_xi);
	tseg3.setXIB(0, 1, wall_xi);

	WallSegment tseg4(33, 33);
	tseg4.setXIA(0, 1, wall_xi);
	tseg4.setXIB(0, 0, wall_xi);

	//Apex

	WallSegment tseg5(33, 35);
	tseg5.setXIA(0, 0, wall_xi);
	tseg5.setXIB(0, 1, wall_xi);

	WallSegment tseg6(35, 39);
	tseg6.setXIA(0, 1, wall_xi);
	tseg6.setXIB(0, 1, wall_xi);

	WallSegment tseg7(39, 43);
	tseg7.setXIA(0, 1, wall_xi);
	tseg7.setXIB(0, 1, wall_xi);

	WallSegment tseg8(43, 47);
	tseg8.setXIA(0, 1, wall_xi);
	tseg8.setXIB(0, 1, wall_xi);

	//FCH 2 14 26 38 38 44 32 20 8
	//   32 28 24 20 20 18 22 26 30
	//Base
	WallSegment fseg1(32, 28);
	fseg1.setXIA(0, 1, wall_xi);
	fseg1.setXIB(0, 1, wall_xi);

	WallSegment fseg2(28, 24);
	fseg2.setXIA(0, 1, wall_xi);
	fseg2.setXIB(0, 1, wall_xi);

	//Mid
	WallSegment fseg3(24, 20);
	fseg3.setXIA(0, 1, wall_xi);
	fseg3.setXIB(0, 1, wall_xi);

	WallSegment fseg4(20, 20);
	fseg4.setXIA(0, 1, wall_xi);
	fseg4.setXIB(0, 0, wall_xi);

	//Apex

	WallSegment fseg5(20, 18);
	fseg5.setXIA(0, 0, wall_xi);
	fseg5.setXIB(0, 1, wall_xi);

	WallSegment fseg6(18, 22);
	fseg6.setXIA(0, 1, wall_xi);
	fseg6.setXIB(0, 1, wall_xi);

	WallSegment fseg7(22, 26);
	fseg7.setXIA(0, 1, wall_xi);
	fseg7.setXIB(0, 1, wall_xi);

	WallSegment fseg8(26, 30);
	fseg8.setXIA(0, 1, wall_xi);
	fseg8.setXIB(0, 1, wall_xi);

	segments.clear();

	segments.push_back(seg1);
	segments.push_back(seg2);
	segments.push_back(seg3);
	segments.push_back(seg4);
	segments.push_back(seg5);
	segments.push_back(seg6);
	segments.push_back(seg7);
	segments.push_back(seg8);

	segments.push_back(tseg1);
	segments.push_back(tseg2);
	segments.push_back(tseg3);
	segments.push_back(tseg4);
	segments.push_back(tseg5);
	segments.push_back(tseg6);
	segments.push_back(tseg7);
	segments.push_back(tseg8);
	segments.push_back(fseg1);
	segments.push_back(fseg2);
	segments.push_back(fseg3);
	segments.push_back(fseg4);
	segments.push_back(fseg5);
	segments.push_back(fseg6);
	segments.push_back(fseg7);
	segments.push_back(fseg8);

	mySegments = &segments;
	return getSegmentStrains(fieldName);
}