#import #import #import #import #define DIMENSION 300 #define DELTA 1e-8 #define SCRAMBLE 200 typedef struct { double x, y, z; int index; } Vertex, *VPtr; typedef enum { VIS_F_1 = 1, VIS_F_2, VIS_F_3 } VISIBILITY; typedef enum { ROT_X = 0, ROT_Y, ROT_Z } ROT_ACTIVE; @interface Rubik : NSView { id con; Vertex vertices[8]; Vertex indexed[8]; Vertex active[8]; Vertex sorted[8]; double angle; ROT_ACTIVE rprev, rcur; VISIBILITY vis; int visface[3]; int face[6][4]; int adjacent[6][4]; int edge[6][4]; NSColor *colors[8]; int data[6][3][3]; } - initAtPoint:(NSPoint)aPoint controller:(id)theCon; - resetCube; - scramble; - rotate:(Vertex *)vp aboutUnitVector:(ROT_ACTIVE)rv angle:(double)theta; - recomputeGeometry; - angle:(id)sender; - (BOOL)solved; - (void)drawRect:(NSRect)aRect; - (int)visFaceClicked:(NSPoint)loc; - rotateFace:(int)f clockwise:(BOOL)flag; - (void)mouseDown:(NSEvent *)theEvent; - (void)rightMouseDown:(NSEvent *)theEvent; @end