1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
|
/*
** symmetry.h - Nina Amenta, Aug. 1989 *
* main.h for kali by Ed H. Chi (chi@geom.umn.edu) summer 1994
*
* $Id: main.h,v 1.5 1996/10/07 15:40:42 slevy Exp $
* $Log: main.h,v $
* Revision 1.5 1996/10/07 15:40:42 slevy
* Remove QREAD, etc., no longer needed.
*
* Revision 1.4 1996/09/30 21:02:40 slevy
* Declare GXDraw instead of GLDraw.
*
* Revision 1.3 1996/06/04 17:26:08 slevy
* Add DRAWER object -- table of function pointers,
* with drawing routines, and push/pop/translate routines.
* Add macros to call them easily.
* Declare GLDraw, PSDraw, PickDraw instances.
*
* Revision 1.2 1994/09/12 23:14:41 chi
* version 3.0 changes
* header file recreated
*
* Revision 1.1 1994/08/26 16:29:02 chi
* Initial revision
*
* Revision 1.1 1994/08/15 20:05:38 chi
* Initial revision
*
*/
#ifndef MAIN_H
#define MAIN_H
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define NUM_SYM 24
#define P3 0
#define P2 1
#define P1 2
#define PG 3
#define PGG 4
#define PMG 5
#define PM 6
#define CM 7
#define PMM 8
#define CMM 9
#define P31M 10
#define P3M1 11
#define P4 12
#define P4G 13
#define P4M 14
#define P6 15
#define P6M 16
/* Frieze symmetry groups */
#define HOP 17
#define SPINHOP 18
#define JUMP 19
#define SPINJUMP 20
#define SIDLE 21
#define SPINSIDLE 22
#define STEP 23
#define KALISX 0
#define KALISY 1
#define EX 2
#define EY 3
#define GLIDE 1
#define KALIDRAW 1
#define KALICUT 2
#define KALIPICK 3
#define KALITRANSFORM 4
#define KALIMOVE 5
#define KALIZOOM 6
#define KALIANGLE 7
#define KALIRATIO 8
#define KALIROTATE 9
#define KALIDELETE 10
#define NAMESTACKSIZE 50
typedef struct point_t {
float x;
float y;
} POINT;
typedef struct rectangle_t {
float x;
float y;
float width;
float height;
} RECTANGLE;
typedef POINT VECTOR;
typedef struct sym_t SYMMETRY;
typedef struct s_line LINE;
typedef float MATRIX[4];
typedef long WINDOW;
typedef long MENU;
/* Bit flags for dof (degrees of freedom) field of symmetry definition */
#define RAT 1
#define ANG 2
struct sym_t
{
int dof;
int trans;
VECTOR v1;
VECTOR v2;
int refl;
VECTOR reflections[2];
int glide;
int rot;
char *label;
LINE* grid;
};
struct s_line {
MATRIX m;
short id;
short obj_pos;
LINE *next;
};
typedef struct _drawer DRAWER;
struct _drawer {
char *kind;
void (*drawobject)(DRAWER *, LINE *);
void (*pushtfm)(DRAWER *);
void (*translate)(DRAWER *, double x, double y);
void (*poptfm)(DRAWER *);
void (*drawline)(DRAWER *, LINE *);
void (*drawpoints)(DRAWER *, POINT *, int);
void *data;
};
#define TranslateCoordinates(drawer, x, y) \
{ if((drawer)->pushtfm) (*(drawer)->pushtfm)(drawer); \
(*(drawer)->translate)(drawer, x, y); \
}
#define TranslateBack(drawer) \
{ if((drawer)->poptfm) (*(drawer)->poptfm)(drawer); }
#define DrawLine(drawer, line) \
(*(drawer)->drawline)(drawer, line)
#define DrawObject(drawer, lines) \
(*(drawer)->drawobject)(drawer, lines)
#define DrawPoints(drawer, points, count) \
{ if((drawer)->drawpoints) (*(drawer)->drawpoints)(drawer, points, count); }
extern DRAWER GXDraw;
extern DRAWER PSDraw;
extern DRAWER PickDraw;
#define RectIncludesPoint(r,p) \
(((p).x>=(r).x) && \
((p).y>=(r).y) && \
(((p).x<=(r).x+(r).width)) && \
(((p).y<=(r).y+(r).height)))
#define PointRightOfRect(p,r) \
(((p).x>(r).x+(r).width))
#define PointLeftOfRect(p,r) \
(((p).x<(r).x))
#define PointAboveRect(p,r) \
(((p).y>(r).y+(r).height))
#define PointBelowRect(p,r) \
(((p).y<(r).y))
#define bump(src,dest,scale,vec) \
{ (dest)->x=(scale)*(vec)->x+(src)->x; (dest)->y=(scale)*(vec)->y+(src)->y; }
#endif
|