1 /*-
2 # X-BASED DINOSAUR CUBE
3 #
4 #  Dino3dP.h
5 #
6 ###
7 #
8 #  Copyright (c) 1995 - 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 Dino3d */
27 
28 #ifndef _Dino3dP_h
29 #define _Dino3dP_h
30 
31 #include "Dino3d.h"
32 
33 #define SAME 0
34 #define OPPOSITE 1
35 #define DOWN 0
36 #define UP 1
37 #define COORD3D 12
38 #define MAXVIEWS 2
39 #define MAXORIENT 4
40 
41 #define SQRT_3 1.732050808
42 #define MULTIPLY(a) ((int)((double)a*SQRT_3/2.0))
43 #define DIVIDE(a) ((int)((double)a*2.0/SQRT_3))
44 
45 typedef struct _Dino3DPart {
46 	Position    cubeDiagonal, cubeDiag, diamondDiagonal, faceDiagonal;
47 	XPoint      cubeSize, diamondSize, faceSize, viewSize;
48 	XPoint      viewMiddle;
49 } Dino3DPart;
50 
51 typedef struct _Dino3DRec {
52 	CorePart    core;
53 	DinoPart    dino;
54 	Dino3DPart  dino3d;
55 } Dino3DRec;
56 
57 /* This gets around C's inability to do inheritance */
58 typedef struct _Dino3DClassPart {
59 	int         ignore;
60 } Dino3DClassPart;
61 
62 typedef struct _Dino3DClassRec {
63 	CoreClassPart coreClass;
64 	DinoClassPart dinoClass;
65 	Dino3DClassPart dino3dClass;
66 } Dino3DClassRec;
67 
68 extern Dino3DClassRec dino3dClassRec;
69 
70 extern Boolean SelectPolyhedrons3D(Dino3DWidget w, int x, int y, int *face, int *position);
71 extern Boolean NarrowSelection3D(Dino3DWidget w, int *face, int *direction);
72 extern void DrawTriangle3D(Dino3DWidget w, int face, int position, int offset);
73 
74 #endif /* _Dino3dP_h */
75