1 /* Copyright (C) 1992-1998 The Geometry Center 2 * Copyright (C) 1998-2000 Stuart Levy, Tamara Munzner, Mark Phillips 3 * 4 * This file is part of Geomview. 5 * 6 * Geomview is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU Lesser General Public License as published 8 * by the Free Software Foundation; either version 2, or (at your option) 9 * any later version. 10 * 11 * Geomview is distributed in the hope that it will be useful, but 12 * WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with Geomview; see the file COPYING. If not, write 18 * to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, 19 * USA, or visit http://www.gnu.org. 20 */ 21 22 23 /* Authors: Charlie Gunn, Stuart Levy, Tamara Munzner, Mark Phillips */ 24 25 #ifndef DISCGRPPDEF 26 #define DISCGRPPDEF 27 28 #include "geomclass.h" 29 #include "discgrp.h" 30 #include "3d.h" 31 #include "wa.h" 32 #include "winged_edge.h" 33 34 /* attributes */ 35 #define DG_KEYWORDSIZE 32 36 #define DG_NAMESIZE 128 37 #define DG_LABELSIZE 256 38 #define DG_WORDLENGTH 32 39 #define DG_MAXGENS 128 /* MAXGENS appears in fsa.h */ 40 41 42 struct DiscGrpEl { 43 int attributes; /* type? fixed points, etc? */ 44 char word[DG_WORDLENGTH]; /* the 'string' in the generators? */ 45 Transform tform; 46 ColorA color; 47 struct DiscGrpEl *inverse; 48 }; 49 50 typedef struct DiscGrpEl DiscGrpEl; 51 52 typedef struct keytokenpair { 53 char key[32]; 54 int token; 55 } keytokenpair; 56 57 typedef struct { 58 int attributes; /* special, orthogonal, projective, etc */ 59 /* plus entry type ... */ 60 int dimn; /* dimension of matrix */ 61 int sig; /* signature of group */ 62 } matrixgroup; 63 64 typedef struct { 65 int num_el; 66 matrixgroup mgroup; 67 DiscGrpEl *el_list; 68 } DiscGrpElList; 69 70 typedef struct { 71 72 #define FRUS_LEFT 0 73 #define FRUS_RIGHT 1 74 #define FRUS_TOP 2 75 #define FRUS_BOTOM 3 76 HPoint3 frustrum[4]; /* planes for culling against view frustum */ 77 78 79 Transform m2w, w2m, c2w, w2c, c2m, m2c; 80 } dgviewinfo; 81 82 83 84 struct DiscGrp { 85 GEOMFIELDS; 86 char *name; 87 char *comment; 88 unsigned flag; /* graphics flags */ 89 int attributes; /* group attributes */ 90 int dimn; 91 float (*c2m)[4]; /* record the transform taking cam->model*/ 92 wa *fsa; /* word acceptor */ 93 DiscGrpElList *gens; /* generators */ 94 DiscGrpElList *nhbr_list; /* dirdom neighbors */ 95 DiscGrpElList *big_list; /* some arbitrary list of group el's */ 96 HPoint3 cpoint; /* center point for dirichlet domain */ 97 Geom *camgeom; /* camera geom: moves w/ camera */ 98 Handle *camgeomhandle; 99 Geom *ddgeom; /* special geom*/ 100 Handle *ddgeomhandle; 101 Geom *geom; /* geometry for one fund domain */ 102 Handle *geomhandle; 103 float scale; /* shrink dirdom before drawing... */ 104 int enumdepth; /* max word length for big_list */ 105 float enumdist; /* max distance grp el moves cpoint */ 106 float drawdist; /* max distance grp el moves cpoint for drawing purposes (generally less than enumdist)_ */ 107 void (*predraw)(); 108 dgviewinfo viewinfo; /* camera position, etc */ 109 } ; 110 111 extern HPoint3 DGorigin; 112 113 extern GeomClass *DiscGrpClass; 114 115 /* private methods */ 116 extern void DiscGrpSetupDirdom( DiscGrp *discgrp); 117 extern DiscGrpEl *DiscGrpClosestGroupEl( DiscGrp *discgrp, HPoint3 *poi); 118 extern DiscGrpElList *DiscGrpExtractNhbrs( WEpolyhedron *wepoly ); 119 extern Geom *DiscGrpDirDom( DiscGrp *dg); 120 extern Geom *WEPolyhedronToBeams( WEpolyhedron *poly, float alpha); 121 extern WEpolyhedron *DiscGrpMakeDirdom( DiscGrp *dg, HPoint3 *pt0, int slice); 122 extern DiscGrpElList *DiscGrpEnum( DiscGrp *dg, int (*constraintfn)()); 123 extern void DiscGrpInitStandardConstraint( int depth, float d0, float d1); 124 extern int DiscGrpStandardConstraint( DiscGrpEl *dgel); 125 extern DiscGrpElList *DiscGrpElListDelete (DiscGrpElList *exist); 126 extern void DiscGrpAddInverses(DiscGrp *discgrp); 127 128 void DHPt3PerpBisect(/*point4 p0, point4 p1, point4 result, int metric*/); 129 130 extern int needstuneup(); 131 extern void tuneup(); 132 extern int is_new(); 133 extern int insert_or_match_mat(); 134 extern int push_new_stack(); 135 extern int enumpush(); 136 extern void init_stack(); 137 extern void make_new_old(); 138 extern int init_out_stack(); 139 extern void delete_list(); 140 extern int enumgetsize(); 141 142 #endif /* ! DISCGRPPDEF */ 143