コード例 #1
0
ファイル: main.c プロジェクト: BackupTheBerlios/mpm
static void genshapes(void) {
    int s, r;

    for (s=0; s<=2; s++) {
        copyshape(shapes[s*4], basicshapes[s]);
        for (r=1; r<=3; r++)
            rotateshape(shapes[s*4+r],shapes[s*4+r-1]);
    }
    for (s=3; s<=5; s++) {
        copyshape  (shapes[s*4],   basicshapes[s]);
        rotateshape(shapes[s*4+1], shapes[s*4]);
        copyshape  (shapes[s*4+2], shapes[s*4]);
        copyshape  (shapes[s*4+3], shapes[s*4+1]);
    }
    copyshape(shapes[6*4],   basicshapes[6]);
    copyshape(shapes[6*4+1], basicshapes[6]);
    copyshape(shapes[6*4+2], basicshapes[6]);
    copyshape(shapes[6*4+3], basicshapes[6]);
}
コード例 #2
0
ファイル: shape.cpp プロジェクト: dparakh/playpen
	void rotateshape(shape & s, double rotation, point2d centre)
    {
        //an offset, which will put the center at origin.
        point2d foroffset (-centre.x(), -centre.y());
        
        //fist we offset it so that the center would be at origin
        moveshape (s, foroffset);

        //do a simple rotation
        rotateshape (s, rotation);

        //offset it back!
        moveshape (s, centre);
        
    }