1 /*- 2 # X-BASED RUBIK'S CUBE(tm) 3 # 4 # Rubik3dP.h 5 # 6 ### 7 # 8 # Copyright (c) 1994 - 99 David Albert Bagley, bagleyd@tux.org 9 # 10 # All Rights Reserved 11 # 12 # Permission to use, copy, modify, and distribute this software and 13 # its documentation for any purpose and without fee is hereby granted, 14 # provided that the above copyright notice appear in all copies and 15 # that both that copyright notice and this permission notice appear in 16 # supporting documentation, and that the name of the author not be 17 # used in advertising or publicity pertaining to distribution of the 18 # software without specific, written prior permission. 19 # 20 # This program is distributed in the hope that it will be "playable", 21 # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 23 # 24 */ 25 26 /* Private header file for Rubik3d */ 27 28 #ifndef _Rubik3dP_h 29 #define _Rubik3dP_h 30 31 #include "Rubik3d.h" 32 33 #define TR 8 34 #define BR 9 35 #define BL 10 36 #define TL 11 37 #define SAME 0 38 #define OPPOSITE 1 39 #define DOWN 0 40 #define UP 1 41 #define COORD3D 12 42 #define MAXVIEWS 2 43 #define MAXORIENT 4 44 45 #define SQRT_3 1.732050808 46 #define MULTIPLY(a) ((int)((double)a*SQRT_3/2.0)) 47 #define DIVIDE(a) ((int)((double)a*2.0/SQRT_3)) 48 49 typedef struct _Rubik3DPart { 50 Position faceDiagonal; 51 Position cubeDiagonalx, cubeDiagonaly, cubeDiagonalz; 52 XPoint cubeSizex, cubeSizey, cubeSizez; 53 XPoint faceSize, viewSize; 54 XPoint viewMiddle; 55 } Rubik3DPart; 56 57 typedef struct _Rubik3DRec { 58 CorePart core; 59 RubikPart rubik; 60 Rubik3DPart rubik3d; 61 } Rubik3DRec; 62 63 /* This gets around C's inability to do inheritance */ 64 typedef struct _Rubik3DClassPart { 65 int ignore; 66 } Rubik3DClassPart; 67 68 typedef struct _Rubik3DClassRec { 69 CoreClassPart core_class; 70 RubikClassPart rubik_class; 71 Rubik3DClassPart rubik3d_class; 72 } Rubik3DClassRec; 73 74 extern Rubik3DClassRec rubik3dClassRec; 75 76 extern Boolean SelectPolyhedrons3D(Rubik3DWidget w, int x, int y, int *face, int *position); 77 extern Boolean NarrowSelection3D(Rubik3DWidget w, int *face, int *position, int *direction); 78 extern void DrawSquare3D(Rubik3DWidget w, int face, int position, int offset); 79 80 #endif /* _Rubik3dP_h */ 81