[Brlcad-commits] CVS: brlcad/src/conv/comgeom .cvsignore,NONE,1.1 3d.h,NONE,1.1 Makefile.am,NONE,1.1
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: Sean M. <br...@us...> - 2005-10-27 03:36:19
|
Update of /cvsroot/brlcad/brlcad/src/conv/comgeom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13556/src/conv/comgeom Added Files: .cvsignore 3d.h Makefile.am comgeom-g.1 cvt.c f2a.c ged_types.h mat.c read.c region.c solid.c tools.c try.sh Log Message: moved all the geometry converter directories from src/. to src/conv/. --- NEW FILE: .cvsignore --- comgeom-g --- NEW FILE: 3d.h --- /* 3 D . H * BRL-CAD * * Copyright (C) 1989-2005 United States Government as represented by * the U.S. Army Research Laboratory. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this file; see the file named COPYING for more * information. * */ /** @file 3d.h * * This header file describes the object file structure, * and some commonly used 3D vector math macros. * * Authors - * Michael John Muuss * Earl P Weaver * * Ballistic Research Laboratory * U. S. Army * March, 1980 * * * R E V I S I O N H I S T O R Y * * March 81 CAS Added ARS 'A' and 'B' record information * * 09/22/81 MJM Changed m_ record to use matrix transformation */ #define NAMESIZE 16 #define NAMEMOVE(from,to) strncpy(to,from,NAMESIZE) extern char *strncpy(); /* * OBJECT FILE FORMAT * * All records are 128 bytes long, and are composed of one of 5 formats: * A SOLID description * A COMBINATION description (1 header, 1 member) * A COMBINATION extention (2 members) * An ARS 'A' (header) record * An ARS 'B' (data) record */ union record { char u_id; /* To differentiate SOLID vs COMB */ char u_size[128]; /* Total record size */ struct solids { char s_id; char s_type; char s_name[16]; short s_num; /* COMGEOM solid # temporary */ float s_values[24]; } s; struct combination { char c_id; char c_flags; char c_name[16]; short c_regionid; short c_aircode; short c_length; /* in 128 byte granules */ short c_num; /* region #, from COMGEOM */ short c_material; /* material code */ short c_los; /* line of sight percentage */ char c_pad[128-30]; } c; struct members { char m_id; char m_relation; /* OR, UNION, DIFF */ char m_brname[16]; /* Name of this branch */ char m_instname[16]; /* Name of refered-to obj */ short m_pad1; mat_t m_mat; /* Homogeneous Xform Matrix */ short m_num; /* solid # ref, from COMGEOM */ short m_pad2; } M; struct ars_rec { char a_id; /* A */ char a_type; char a_name[16]; short a_m; /* # curves */ short a_n; /* # points per curve */ short a_curlen; /* # granules per curve */ short a_totlen; /* # granules per solid */ short a_pad; float a_xmax; /* max x coordinate */ float a_xmin; /* min x coordinate */ float a_ymax; /* max y coordinate */ float a_ymin; /* min y coordinate */ float a_zmax; /* max z coordinate */ float a_zmin; /* min z coordinate */ } a; struct ars_ext { char b_id; /* B */ char b_type; short b_n; /* 1.1 1.2 1.3 2.1 2.2 2.3 */ short b_ngranule; short b_pad; float b_values[8*3]; } b; }; /* * Record id types */ #define SOLID 'S' #define COMB 'C' #define MEMB 'M' #define ARS_A 'A' #define ARS_B 'B' /* * for the m_relation fields */ #define UNION 'u' #define SUBTRACT '-' #define INTERSECT '+' /* * SOLID TYPES */ #define RPP 1 #define BOX 2 #define RAW 3 #define ARB4 4 #define ARB5 5 #define ARB6 6 #define ARB7 7 #define ARB8 8 #define ELL 9 #define ELL1 10 #define SPH 11 #define RCC 12 #define REC 13 #define TRC 14 #define TEC 15 #define TOR 16 #define TGC 17 #define GENTGC 18 /* Supergeneralized TGC; internal form */ #define GENELL 19 /* Ready for drawing ELL: V,A,B,C */ #define GENARB8 20 /* Generalized ARB8: V, and 7 other vectors */ #define ARS 21 /* arbitrary triangular surfaced polyhedron */ #define ARSCONT 22 /* extention record type for ARS solid */ /* * V E C T O R M A T H */ /* Set a vector pointer 'a' to have x,y,z elements b,c,d */ #define VSET(a,b,c,d) *(a) = (b);\ *((a)+1) = (c);\ *((a)+2) = (d) /* Transfer x,y,z from vector pointed at by 'b' to that pointed by 'a' */ #define VMOVE(a,b) *(a) = *(b);\ *((a)+1) = *((b)+1);\ *((a)+2) = *((b)+2) /* Add x,y,z in vectors 'b' and 'c', store in 'a' */ #define VADD2(a,b,c) *(a) = *(b) + *(c);\ *((a)+1) = *((b)+1) + *((c)+1);\ *((a)+2) = *((b)+2) + *((c)+2) /* Subtract x,y,z in vector 'c' from 'b', store in 'a' */ #define VSUB2(a,b,c) *(a) = *(b) - *(c);\ *((a)+1) = *((b)+1) - *((c)+1);\ *((a)+2) = *((b)+2) - *((c)+2) #define VADD3(a,b,c,d) *(a) = *(b) + *(c) + *(d);\ *((a)+1) = *((b)+1) + *((c)+1) + *((d)+1);\ *((a)+2) = *((b)+2) + *((c)+2) + *((d)+2) #define VADD4(a,b,c,d,e) *(a) = *(b) + *(c) + *(d) + *(e);\ *((a)+1) = *((b)+1) + *((c)+1) + *((d)+1) + *((e)+1);\ *((a)+2) = *((b)+2) + *((c)+2) + *((d)+2) + *((e)+2) /* Scale all elements in 'b' by multiplication by scalar 'c', store in 'a' */ #define VSCALE(a,b,c) *(a) = *(b) * (c);\ *((a)+1) = *((b)+1) * (c);\ *((a)+2) = *((b)+2) * (c) /* Compose vector 'a' of: * Vector 'b' plus * scalar 'c' times vector 'd' plus * scalar 'e' times vector 'f' */ #define VCOMPOSE(a,b,c,d,e,f) \ *(a+0) = *(b+0) + c * (*(d+0)) + e * (*(f+0));\ *(a+1) = *(b+1) + c * (*(d+1)) + e * (*(f+1));\ *(a+2) = *(b+2) + c * (*(d+2)) + e * (*(f+2)) /* Return scalar magnitude of vector pointed at by 'a' */ #define MAGNITUDE(a) sqrt( MAGSQ( (a) )) #define MAGSQ(a) ( *(a)*(*(a)) + *((a)+1)*(*((a)+1)) + *((a)+2)*(*((a)+2)) ) /* * Cross product: * 12-21, 20-02, 01-10 * b1*c2-b2*c1, b2c0-b0c2, b0c1-b1c0 */ #define VCROSS( a, b, c) \ *(a+0) = *(b+1) * *(c+2) - *(b+2) * *(c+1);\ *(a+1) = *(b+2) * *(c+0) - *(b+0) * *(c+2);\ *(a+2) = *(b+0) * *(c+1) - *(b+1) * *(c+0) #define VPRINT( a, b ) printf("%s (%f, %f, %f)\n", a, (b)[0], (b)[1], (b)[2] ) /* * Local Variables: * mode: C * tab-width: 8 * c-basic-offset: 4 * indent-tabs-mode: t * End: * ex: shiftwidth=4 tabstop=8 */ --- NEW FILE: Makefile.am --- # $Id: Makefile.am,v 1.1 2005/10/27 03:36:04 brlcad Exp $ bin_PROGRAMS = comgeom-g comgeom_g_SOURCES = \ cvt.c \ f2a.c \ mat.c \ read.c \ region.c \ solid.c \ tools.c noinst_HEADERS = 3d.h ged_types.h comgeom_g_LDADD = ${LIBRT} ${WDB} man_MANS = comgeom-g.1 EXTRA_DIST = \ $(man_MANS) \ try.sh MAINTAINERCLEANFILES = Makefile.in include $(top_srcdir)/misc/Makefile.defs FAST_OBJECTS = \ $(comgeom_g_OBJECTS) \ $(bin_PROGRAMS) --- NEW FILE: comgeom-g.1 --- .TH COMGEOM-G 1 BRL-CAD ./" C O M G E O M - G . 1 ./" BRL-CAD ./" ./" Copyright (c) 2005 United States Government as represented by ./" the U.S. Army Research Laboratory. ./" ./" This document is made available under the terms of the GNU Free ./" Documentation License or, at your option, under the terms of the ./" GNU General Public License as published by the Free Software ./" Foundation. Permission is granted to copy, distribute and/or ./" modify this document under the terms of the GNU Free Documentation ./" License, Version 1.2 or any later version published by the Free ./" Software Foundation; with no Invariant Sections, no Front-Cover ./" Texts, and no Back-Cover Texts. Permission is also granted to ./" redistribute this document under the terms of the GNU General ./" Public License; either version 2 of the License, or (at your ./" option) any later version. ./" ./" You should have received a copy of the GNU Free Documentation ./" License and/or the GNU General Public License along with this ./" document; see the file named COPYING for more information. ./" ./"./"./" .SH NAME comgeom-g \- convert GIFT COMGEOM model into MGED database .SH SYNOPSIS .B comgeom-g .RB [ \-d\ debug_lvl] .RB [ \-v\ version_num] .RB [ \-s\ name_suffix] file.cg file.g .br .SH DESCRIPTION Read a COMGEOM version 4 or version 5 format model from a GIFT-style input file, convert the geometry into the internal form used by the BRL-CAD package, and write an MGED-style binary database. .PP Each solid is given the name ``s###'', retaining the COMGEOM solid number. Each region is given the name ``r###'', retaining the COMGEOM region number. Regions are grouped together into various groups ``g###'' based on the region-id numbers. Group ``g00'' gets all regions with region-id of zero, ``g0'' gets ids one through 99, ``g1'' gets ids 100 through 199, etc. .PP The default input is COMGEOM version 5. Version 4 can be converted by specifying the .B \-v4 flag. For the time being, the DoE MORSE/RAFFLE format (believed to be the original MAGIC format) can be converted by specifying the .B \-v1 flag. .PP By default, the program .I comgeom-g operates silently. Because the program may require a minute or two to convert a large database, some users prefer to have various status reports that indicate the progress of the conversion. This can be selected by specifying the .B \-d1 flag (debug level 1). .PP The units used in a COMGEOM file are specified on a header record. The units of an MGED database are always milimeters. .I comgeom-g performs automatic units conversion using the built-in units conversion feature of \fIlibwdb\fR(3). .SH EXAMPLE .I comgeom-g < file.cg > file.g .SH DIAGNOSTICS The diagnostics are intended to be self-explanatory. Familiarity with GIFT COMGEOM terminology will be helpful. .SH BUGS It is expected that the input file should be a valid COMGEOM model. While quite a bit of input checking is performed, wildly incorrect input may produce amusing results. .SH SEE ALSO brlcad(1), mged(1), libwdb(3) .SH AUTHOR Michael John Muuss .SH SOURCE SECAD/VLD Computing Consortium, Bldg 394 .br The U. S. Army Ballistic Research Laboratory .br Aberdeen Proving Ground, Maryland 21005 .SH BUG REPORTS Reports of bugs or problems should be submitted via electronic mail to <de...@br...>. --- NEW FILE: cvt.c --- /* C V T . C * BRL-CAD * * Copyright (C) 1989-2005 United States Government as represented by * the U.S. Army Research Laboratory. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this file; see the file named COPYING for more * information. * */ /** @file cvt.c * * This is the mainline for converting COM-GEOM * cards to a GED style database. * * Author - * Michael John Muuss * * Original Version - * February, 1980 * * Source - * SECAD/VLD Computing Consortium, Bldg 394 * The U. S. Army Ballistic Research Laboratory * Aberdeen Proving Ground, Maryland 21005-5066 * */ #ifndef lint static const char RCSid[] = "@(#)$Header: /cvsroot/brlcad/brlcad/src/conv/comgeom/cvt.c,v 1.1 2005/10/27 03:36:04 brlcad Exp $ (BRL)"; #endif #include "common.h" #ifdef HAVE_UNISTD_H # include <unistd.h> #endif #include <stdio.h> #include <ctype.h> #ifdef HAVE_STRING_H # include <string.h> #else # include <strings.h> #endif #include <math.h> #include "machine.h" #include "vmath.h" #include "raytrace.h" #include "wdb.h" /* defined in region.c */ extern void group_init(void); extern int getregion(void); extern void region_register(int reg_num, int id, int air, int mat, int los); extern void group_write(void); /* defined in read.c */ extern int get_line(register char *cp, int buflen, char *title); /* defined in solid.c */ extern void trim_trail_spaces(register char *cp); extern int getsolid(void); struct wmember *wmp; /* array indexed by region number */ int version = 5; /* v4 or v5 ? */ int verbose = 0; /* verbose = print a message on every item read */ char name_it[16]; /* stores argv if it exists and appends it to each name generated.*/ int cur_col = 0; FILE *infp; struct rt_wdb *outfp; /* Output file descriptor */ int sol_total, sol_work; /* total num solids, num solids processed */ int reg_total; extern void getid(void); void col_pr(char *str); static char usage[] = "\ Usage: comgeom-g [options] input_file output_file\n\ Options:\n\ -v input_vers# default is 5 (cg5)\n\ -d debug_lvl\n\ -s name_suffix\n\ "; int get_args(int argc, register char **argv) { register int c; char *file_name; while ( (c = getopt( argc, argv, "d:v:s:" )) != EOF ) { switch( c ) { case 'd': verbose = atoi(optarg); break; case 's': strncpy( name_it, optarg, sizeof(name_it) ); break; case 'v': version = atoi(optarg); break; default: /* '?' */ return(0); } } if( optind+2 > argc ) return(0); /* FAIL */ /* Input File */ if( optind >= argc ) { return(0); /* FAIL */ } else { file_name = argv[optind++]; if( (infp = fopen(file_name, "r")) == NULL ) { perror(file_name); return(0); } } /* Output File */ if( optind >= argc ) { return(0); /* FAIL */ } else { file_name = argv[optind++]; if( (outfp = wdb_fopen(file_name)) == NULL ) { perror(file_name); return(0); } } if ( argc > ++optind ) (void)fprintf( stderr, "comgeom-g: excess argument(s) ignored\n" ); return(1); /* OK */ } /* * M A I N */ int main(int argc, char **argv) { register int i; char ctitle[132]; char *title; char units[16]; if ( !get_args( argc, argv ) ) { (void)fputs(usage, stderr); exit( 1 ); } if( version != 1 && version != 4 && version != 5 ) { fprintf(stderr,"version %d not supported\n", version ); (void)fputs(usage, stderr); exit( 1 ); } printf("Reading version %d COMGEOM file\n", version ); if( verbose ) { printf("COMGEOM input file must have this format:\n"); switch(version) { case 1: printf(" 1. title card\n"); printf(" 2. solid table\n"); printf(" 3. END\n"); printf(" 4. region table\n"); printf(" 5. END\n"); break; case 4: printf(" 1. units & title card\n"); printf(" 2. solid & region count card\n"); printf(" 3. solid table\n"); printf(" 4. region table\n"); printf(" 5. -1\n"); printf(" 6. blank\n"); printf(" 7. region ident table\n\n"); break; case 5: printf(" 1. units & title card\n"); printf(" 2. solid & region count card\n"); printf(" 3. solid table\n"); printf(" 4. region table\n"); printf(" 5. -1\n"); printf(" 6. region ident table\n\n"); break; } } group_init(); /* * Read title card */ if( get_line( ctitle, sizeof(ctitle), "title card" ) == EOF ) { printf("Empty input file: no title record\n"); exit(10); } title = NULL; switch( version ) { case 1: title = ctitle; strcpy( units, "in" ); break; case 4: case 5: /* First 2 chars are units */ units[0] = ctitle[0]; units[1] = ctitle[1]; units[2] = '\0'; title = ctitle+3; break; } /* Drop leading blanks in title */ while( isspace( *title ) ) title++; trim_trail_spaces( title ); trim_trail_spaces( units ); /* Convert units to lower case */ { register char *cp = units; while( *cp ) { if( isupper(*cp) ) *cp = tolower(*cp); cp++; } } printf("Title: %s\n", title); printf("Units: %s\n", units); /* Before converting any geometry, establish the units conversion * factor which all mk_* routines will apply. */ if( mk_conversion( units ) < 0 ) { printf("WARNING: unknown units '%s', using inches\n", units); strcpy( units, "in" ); (void)mk_conversion( units ); } /* Output the MGED database header */ if( mk_id_units( outfp, title, units ) < 0 ) { printf("Unable to write database ID, units='%s'\n", units); exit(1); } /* * Read control card, if present */ sol_total = reg_total = 0; switch( version ) { case 1: sol_total = reg_total = 9999; /* Reads until 'END' rec */ break; case 4: if( get_line( ctitle, sizeof(ctitle), "control card" ) == EOF ) { printf("No control card .... STOP\n"); exit(10); } sscanf( ctitle, "%20d%10d", &sol_total, ®_total ); break; case 5: if( get_line( ctitle, sizeof(ctitle), "control card" ) == EOF ) { printf("No control card .... STOP\n"); exit(10); } sscanf( ctitle, "%5d%5d", &sol_total, ®_total ); break; } if(verbose) printf("Expecting %d solids, %d regions\n", sol_total, reg_total); /* * SOLID TABLE */ if(verbose) printf("Primitive table\n"); sol_work = 0; while( sol_work < sol_total ) { i = getsolid(); if( i < 0 ) { printf("error converting primitive %d\n", sol_work); /* Should we abort here? */ continue; } if( i > 0 ) { printf("\nprocessed %d of %d solids\n\n",sol_work,sol_total); if( sol_work < sol_total && version > 1 ) { printf("some solids are missing, aborting\n"); exit(1); } break; /* done */ } } /* REGION TABLE */ if(verbose)printf("\nRegion table\n"); i = sizeof(struct wmember) * (reg_total+2); if( (wmp = (struct wmember *)bu_calloc(reg_total+2, sizeof( struct wmember ), "wmp")) == (struct wmember *)0 ) { printf("malloc(%d) failed\n", i ); exit(42); } for( i=reg_total+1; i>=0; i-- ) { RT_LIST_INIT( &wmp[i].l ); } cur_col = 0; if( getregion() < 0 ) exit(10); if( version == 1 ) { for( i=1; i < reg_total; i++ ) { region_register( i, 0, 0, 0, 0 ); } } else { if( version == 4 ) { char dummy[88]; /* read the blank card (line) */ (void)get_line( dummy, sizeof(dummy), "blank card" ); } if(verbose) printf("\nRegion ident table\n"); getid(); } if(verbose) printf("\nGroups\n"); cur_col = 0; group_write(); if(verbose) printf("\n"); return(0); /* exit(0) */ } /* * C O L _ P R */ void col_pr(char *str) { printf("%s", str); cur_col += strlen(str); while( cur_col < 78 && ((cur_col%10) > 0) ) { putchar(' '); cur_col++; } if( cur_col >= 78 ) { printf("\n"); cur_col = 0; } } /* * Local Variables: * mode: C * tab-width: 8 * c-basic-offset: 4 * indent-tabs-mode: t * End: * ex: shiftwidth=4 tabstop=8 */ --- NEW FILE: f2a.c --- /* F 2 A . C * BRL-CAD * * Copyright (C) 2004-2005 United States Government as represented by * the U.S. Army Research Laboratory. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this file; see the file named COPYING for more * information. * */ /** @file f2a.c * * convert float to ascii. */ #include "common.h" #include <stdio.h> #include <stdlib.h> /** F 2 A () ==== convert float to ascii w.df format. No leading blanks */ f2a(float f, char *s, int w, int d) /* INPUT ===*/ /* OUTPUT ===*/ /* length ===*/ { int c, i, j; long n, sign; if( w <= d + 2 ) { printf( "ftoascii: incorrect format need w.df\n"); printf( "w must be at least 2 bigger then d.\n" ); printf( "w= %f\t d= %f\n", w, d ); printf( "STOP\n"); exit( 10 ); } for( i = 1; i <= d; i++ ) f = f * 10.0; /* shift left.*/ if( f < 0.0 ) f -= 0.5; /* round up */ else f += 0.5; n = f; /* truncate.*/ if( (sign = n) < 0 ) n = -n; /* get sign.*/ i = 0; /* CONVERT to ASCII.*/ do { s[i++] = n % 10 + '0'; if( i == d ) s[i++] = '.'; } while( (n /= 10) > 0 ); if( i < d ) /* zero fill the d field if (f < 1).*/ { for( j = i; j < d; j++ ) s[j] = '0'; s[j++] = '.'; i = j; } if( sign < 0 ) s[i++] = '-'; /* apply sign.*/ if( i > w ) printf("ftoascii: field length too small\n"); w = i; /* do not blank fill.*/ for ( j = i; j < w; j++ ) s[j] = ' '; /* blank fill.*/ s[w] = '\0'; for( i = 0, j = w - 1; /* reverse the array.*/ i < j; i++, j-- ) { c = s[i]; s[i] = s[j]; s[j] = c; } } /* * Local Variables: * mode: C * tab-width: 8 * c-basic-offset: 4 * indent-tabs-mode: t * End: * ex: shiftwidth=4 tabstop=8 */ --- NEW FILE: ged_types.h --- /* G E D _ T Y P E S . H * BRL-CAD * * Copyright (C) 2004-2005 United States Government as represented by * the U.S. Army Research Laboratory. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this file; see the file named COPYING for more * information. * */ /** @file ged_types.h * type definition for new "C" declaration: "homog_t". * * This is to make declairing Homogeneous Transform matricies easier. */ typedef float mat_t[4*4]; typedef float *matp_t; typedef float vect_t[4]; typedef float *vectp_t; #define X 0 #define Y 1 #define Z 2 #define H 3 #define ALPHA 0 #define BETA 1 #define GAMMA 2 /* * Local Variables: * mode: C * tab-width: 8 * c-basic-offset: 4 * indent-tabs-mode: t * End: * ex: shiftwidth=4 tabstop=8 */ --- NEW FILE: mat.c --- /* M A T . C * BRL-CAD * * Copyright (C) 2004-2005 United States Government as represented by * the U.S. Army Research Laboratory. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this file; see the file named COPYING for more * information. * */ /** @file mat.c * * 4 x 4 Matrix manipulation functions.............. * * mat_zero( &m ) Fill matrix m with zeros * mat_idn( &m ) Fill matrix m with identity matrix * mat_copy( &o, &i ) Copy matrix i to matrix o * mat_mul( &o, &i1, &i2 ) Multiply i1 by i2 and store in o * vecXmat( &ov, &iv, &m ) Multiply vector iv by m and store in ov * matXvec( &ov, &m, &iv ) Multiply m by vector iv and store in ov * mat_print( &m ) Print out the 4x4 matrix - calls printf * mat_hscale( &m, hscale ) Homogenious scale of input matrix * mat_inv( &om, &im ) Invert matrix im and store result in om * * * Matrix array elements have the following positions in the matrix: * * | 0 1 2 3 | | 0 | * [ 0 1 2 3 ] | 4 5 6 7 | | 1 | * | 8 9 10 11 | | 2 | * | 12 13 14 15 | | 3 | * * preVector (vect_t) Matrix (mat_t) postVector (vect_t) * */ #include "common.h" #include <stdio.h> #ifdef HAVE_FABS # ifdef HAVE_MATH_H # include <math.h> # endif #else # define fabs(x) ((x)>0?(x):-(x)) #endif #include "./ged_types.h" /* * M A T _ Z E R O * * Fill in the matrix "m" with zeros. */ mat_zero(register matp_t m) { register int i = 0; /* Clear everything */ for(; i<16; i++) *m++ = 0; } /* * M A T _ I D N * * Fill in the matrix "m" with an identity matrix. */ mat_idn(register matp_t m) { /* Clear everything first */ mat_zero( m ); /* Set ones in the diagonal */ m[0] = m[5] = m[10] = m[15] = 1; } /* * M A T _ C O P Y * * Copy the matrix "im" into the matrix "om". */ mat_copy(register matp_t om, register matp_t im) { register int i = 0; /* Copy all elements */ for(; i<16; i++) *om++ = *im++; } /* * M A T _ M U L * * Multiply matrix "im1" by "im2" and store the result in "om". * NOTE: This is different from multiplying "im2" by "im1" (most * of the time!) */ mat_mul(register matp_t om, register matp_t im1, register matp_t im2) { register int em1; /* Element subscript for im1 */ register int em2; /* Element subscript for im2 */ register int el = 0; /* Element subscript for om */ register int i; /* For counting */ /* For each element in the output matrix... */ for(; el<16; el++) { om[el] = 0; /* Start with zero in output */ em1 = (el/4)*4; /* Element at right of row in im1 */ em2 = el%4; /* Element at top of column in im2 */ for(i=0; i<4; i++) { om[el] += im1[em1] * im2[em2]; em1++; /* Next row element in m1 */ em2 += 4; /* Next column element in m2 */ } } } /* * V E C X M A T * * Multiply the vector "iv" by the matrix "im" and store the result * in the vector "ov". Note this is pre-multiply. */ vecXmat(register vectp_t ov, register vectp_t iv, register matp_t im) { register int el = 0; /* Position in output vector */ register int ev; /* Position in input vector */ register int em; /* Position in input matrix */ /* For each element in the output array... */ for(; el<4; el++) { ov[el] = 0; /* Start with zero in output */ em = el; /* Top of column in input matrix */ for(ev=0; ev<4; ev++) { ov[el] += iv[ev] * im[em]; em += 4; /* Next element in column from im */ } } } /* * M A T X V E C * * Multiply the matrix "im" by the vector "iv" and store the result * in the vector "ov". Note this is post-multiply. */ matXvec(register vectp_t ov, register matp_t im, register vectp_t iv) { register int eo = 0; /* Position in output vector */ register int em = 0; /* Position in input matrix */ register int ei; /* Position in input vector */ /* For each element in the output array... */ for(; eo<4; eo++) { ov[eo] = 0; /* Start with zero in output */ for(ei=0; ei<4; ei++) ov[eo] += im[em++] * iv[ei]; } } /* * M A T _ P R I N T * * Print out the 4x4 matrix addressed by "m". */ mat_print(register matp_t m) { register int i; for(i=0; i<16; i++) { printf("%f%c", m[i], ((i+1)%4) ? '\t' : '\n'); } } /* * M A T _ H S C A L E * * The matrix pointed at by "m" is homogeniously scaled by the * variable "hscale". NOTE that the input matrix is ALSO the output * matrix. */ mat_hscale(register matp_t m, float hscale) { m[0] *= hscale; m[5] *= hscale; m[10] *= hscale; } /* * M A T _ I N V * * The matrix pointed at by "im" is inverted and stored in the area * pointed at by "om". */ #define EPSILON 0.000001 /* * Invert a 4-by-4 matrix using Algorithm 120 from ACM. * This is a modified Gauss-Jordan alogorithm * Note: Inversion is done in place, with 3 work vectors */ void mat_inv(register matp_t output, matp_t input) { register int i, j; /* Indices */ static int k; /* Indices */ static int z[4]; /* Temporary */ static float b[4]; /* Temporary */ static float c[4]; /* Temporary */ mat_copy( output, input ); /* Duplicate */ /* Initialization */ for( j = 0; j < 4; j++ ) z[j] = j; /* Main Loop */ for( i = 0; i < 4; i++ ) { static float y; /* local temporary */ k = i; y = output[i*4+i]; for( j = i+1; j < 4; j++ ) { static float w; /* local temporary */ w = output[i*4+j]; if( fabs(w) > fabs(y) ) { k = j; y = w; } } if( fabs(y) < EPSILON ) { printf("mat_inv: error!\n"); return; } y = 1.0 / y; for( j = 0; j < 4; j++ ) { static float temp; /* Local */ c[j] = output[j*4+k]; output[j*4+k] = output[j*4+i]; output[j*4+i] = - c[j] * y; temp = output[i*4+j] * y; b[j] = temp; output[i*4+j] = temp; } output[i*4+i] = y; j = z[i]; z[i] = z[k]; z[k] = j; for( k = 0; k < 4; k++ ) { if( k == i ) continue; for( j = 0; j < 4; j++ ) { if( j == i ) continue; output[k*4+j] = output[k*4+j] - b[j] * c[k]; } } } /* Second Loop */ for( i = 0; i < 4; i++ ) { while( (k = z[i]) != i ) { static int p; /* Local temp */ for( j = 0; j < 4; j++ ) { static float w; /* Local temp */ w = output[i*4+j]; output[i*4+j] = output[k*4+j]; output[k*4+j] = w; } p = z[i]; z[i] = z[k]; z[k] = p; } } return; } /* * V T O H _ M O V E * * Takes a pointer to a [x,y,z] vector, and a pointer * to space for a homogeneous vector [x,y,z,w], * and builds [x,y,z,1]. */ vtoh_move(register float *h, register float *v) { *h++ = *v++; *h++ = *v++; *h++ = *v; *h++ = 1; } /* * H T O V _ M O V E * * Takes a pointer to [x,y,z,w], and converts it to * an ordinary vector [x/w, y/w, z/w]. * Optimization for the case of w==1 is performed. */ htov_move(register float *v, register float *h) { static float inv; if( h[3] == 1 ) { *v++ = *h++; *v++ = *h++; *v = *h; } else { inv = 1 / h[3]; *v++ = *h++ * inv; *v++ = *h++ * inv; *v = *h * inv; } } /* * Local Variables: * mode: C * tab-width: 8 * c-basic-offset: 4 * indent-tabs-mode: t * End: * ex: shiftwidth=4 tabstop=8 */ --- NEW FILE: read.c --- /* R E A D . C * BRL-CAD * * Copyright (C) 1989-2005 United States Government as represented by * the U.S. Army Research Laboratory. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this file; see the file named COPYING for more * information. * */ /** @file read.c * * This module contains all of the routines necessary to read in * a COMGEOM input file, and put the information into internal form. * * Author - * Michael John Muuss * * Original Version - * March 17, 1980 * * Source - * SECAD/VLD Computing Consortium, Bldg 394 * The U. S. Army Ballistic Research Laboratory * Aberdeen Proving Ground, Maryland 21005-5066 * */ #ifndef lint static const char RCSid[] = "@(#)$Header: /cvsroot/brlcad/brlcad/src/conv/comgeom/read.c,v 1.1 2005/10/27 03:36:04 brlcad Exp $ (BRL)"; #endif #include "common.h" #include <stdio.h> #include <math.h> #ifdef HAVE_STRING_H #include <string.h> #else #include <strings.h> #endif #include "machine.h" #include "bu.h" extern FILE *infp; extern char name_it[16]; /* argv[3] */ void namecvt(register int n, register char **cp, int c); /* * G E T L I N E */ int get_line(register char *cp, int buflen, char *title) { register int c; register int count = buflen; while( (c = fgetc(infp)) == '\n' ) /* Skip blank lines. */ ; while( c != EOF && c != '\n' ) { *cp++ = c; count--; if( count <= 0 ) { printf("get_line(x%lx, %d) input record overflows buffer for %s\n", (unsigned long)cp, buflen, title); break; } c = fgetc(infp); } if( c == EOF ) return EOF; while( count-- > 0 ) *cp++ = 0; return c; } /* * G E T I N T */ int getint(char *cp, int start, int len) { char buf[128]; if( len >= sizeof(buf) ) len = sizeof(buf)-1; strncpy( buf, cp+start, len ); buf[len] = '\0'; return atoi(buf); } /* * G E T D O U B L E */ double getdouble(char *cp, int start, int len) { char buf[128]; if( len >= sizeof(buf) ) len = sizeof(buf)-1; strncpy( buf, cp+start, len ); buf[len] = '\0'; return atof(buf); } /* N A M E C V T */ void namecvt(register int n, register char **cp, int c) { char str[16]; sprintf( str, "%c%d%.13s", (char)c, n, name_it ); *cp = bu_strdup( str ); } /* * Local Variables: * mode: C * tab-width: 8 * c-basic-offset: 4 * indent-tabs-mode: t * End: * ex: shiftwidth=4 tabstop=8 */ --- NEW FILE: region.c --- /* R E G I O N . C * BRL-CAD * * Copyright (C) 1989-2005 United States Government as represented by * the U.S. Army Research Laboratory. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this file; see the file named COPYING for more * information. * */ /** @file region.c * Author - * Michael John Muuss * * Source - * SECAD/VLD Computing Consortium, Bldg 394 * The U. S. Army Ballistic Research Laboratory * Aberdeen Proving Ground, Maryland 21005-5066 * */ #ifndef lint static const char RCSid[] = "@(#)$Header: /cvsroot/brlcad/brlcad/src/conv/comgeom/region.c,v 1.1 2005/10/27 03:36:04 brlcad Exp $ (BRL)"; #endif #include "common.h" #include <stdio.h> #ifdef HAVE_STRING_H #include <string.h> #else #include <strings.h> #endif #include <ctype.h> #include "machine.h" #include "vmath.h" #include "raytrace.h" #include "wdb.h" /* defined in read.c */ extern int get_line(register char *cp, int buflen, char *title); extern int getint(char *cp, int start, int len); extern void namecvt(register int n, register char **cp, int c); /* defined in cvt.c */ extern void col_pr(char *str); extern char name_it[]; extern struct wmember *wmp; /* array indexed by region number */ extern FILE *infp; extern struct rt_wdb *outfp; extern int reg_total; extern int version; extern int verbose; char rcard[128]; void region_register(int reg_num, int id, int air, int mat, int los); void group_init(void); void group_register(char *name, int lo, int hi); void group_add(register int val, char *name); void group_write(void); /* * G E T R E G I O N * * Use wmp[region_number] as head for each region. * * Returns - * -1 error * 0 done */ int getregion(void) { int i, j; int card; int op; int reg_reg_flag; int reg_num; char *inst_name=NULL; int inst_num; char *cp; reg_num = 0; /* safety */ /* Pre-load very first region card */ if( get_line( rcard, sizeof(rcard), "region card" ) == EOF ) { printf("getregion: premature EOF\n"); return( -1 ); } if( getint( rcard, 0, 5 ) != 1 ) { printf("First region card not #1\ncard='%s'\n", rcard); return(-1); } top: reg_reg_flag = 0; for( card=0; ; card++ ) { if( card == 0 ) { /* First card is already in input buffer */ reg_num = getint( rcard, 0, 5 ); /* -1 region number terminates table */ if( reg_num < 0 ) return( 0 ); /* Done */ if( reg_num > reg_total ) { printf("%d regions is more than claimed %d\n", reg_num, reg_total ); return(-1); } namecvt( reg_num, &(wmp[reg_num].wm_name), 'r' ); } else { if( get_line( rcard, sizeof(rcard), "region card" ) == EOF ) { printf("getregion: premature EOF\n"); return( -1 ); } if( strcmp( rcard, " end" ) == 0 || strcmp( rcard, " END" ) == 0 ) { /* Version 1, DoE/MORSE */ reg_total = reg_num; return(0); /* done */ } if( getint( rcard, 0, 5 ) != 0 ) { /* finished with this region */ break; } } if( version == 1 ) { cp = rcard + 10; } else { cp = rcard + 6; } op = WMOP_UNION; /* default */ /* Scan each of the 9 fields on the card */ for( i=0; i<9; i++, cp += 7 ) { char nbuf[32]; char *np; /* Remove all spaces from the number */ np = nbuf; for( j=2; j<7; j++ ) { if( !isascii( cp[j] ) ) *np++ = '?'; else if( isspace( cp[j] ) ) continue; *np++ = cp[j]; } *np = '\0'; /* Check for null field -- they are to be skipped */ if( (inst_num = atoi(nbuf)) == 0 ) { /* zeros are allowed as placeholders */ continue; } if( version == 5 ) { /* Region references region in Gift5 */ if( cp[1] == 'g' || cp[1] == 'G' ) { reg_reg_flag = 1; } else if( cp[1] == 'R' || cp[1] == 'r' ) { /* 'OR' */ op = WMOP_UNION; } else { if( inst_num < 0 ) { op = WMOP_SUBTRACT; inst_num = -inst_num; } else { op = WMOP_INTERSECT; } } } else { /* XXX this may actually be an old piece of code, * rather than the V4 way of doing it. */ if( cp[1] != ' ' ) { op = WMOP_UNION; } else { if( inst_num < 0 ) { op = WMOP_SUBTRACT; inst_num = -inst_num; } else { op = WMOP_INTERSECT; } } } /* In Gift5, regions can reference regions */ if( reg_reg_flag ) namecvt(inst_num, &inst_name, 'r'); else namecvt( inst_num, &inst_name, 's' ); reg_reg_flag = 0; (void)mk_addmember( inst_name, &wmp[reg_num].l, NULL, op ); bu_free( inst_name, "inst_name" ); } } if(verbose) col_pr( wmp[reg_num].wm_name ); /* The region will be output later in getid(), below */ goto top; } /* * G E T I D * * Load the region ID information into the structures */ void getid(void) { int reg_num; int id; int air; int mat= -1; int los= -2; char idcard[132]; while(1) { if( get_line( idcard, sizeof(idcard), "region ident card" ) == EOF ) { printf("\ngetid: EOF\n"); return; } if( idcard[0] == '\n' ) return; if( version == 5 ) { reg_num = getint( idcard, 0, 5 ); id = getint( idcard, 5, 5 ); air = getint( idcard, 10, 5 ); mat = getint( idcard, 15, 5 ); los = getint( idcard, 20, 5 ); } else { reg_num = getint( idcard, 0, 10 ); id = getint( idcard, 10, 10 ); air = getint( idcard, 20, 10 ); mat = getint( idcard, 74, 3 ); los = getint( idcard, 77, 3 ); } if( reg_num <= 0 ) { printf("\ngetid: region_id %d encountered, stoping\n", reg_num); return; } region_register( reg_num, id, air, mat, los ); } } /* * R E G I O N _ R E G I S T E R */ void region_register(int reg_num, int id, int air, int mat, int los) { register struct wmember *wp; wp = &wmp[reg_num]; if( RT_LIST_IS_EMPTY( &wp->l ) ) { if( verbose ) { char paren[32]; /* Denote an empty region */ sprintf( paren, "(%s)", wp->wm_name ); col_pr( paren ); } return; } mk_lrcomb( outfp, wp->wm_name, wp, 1, "", "", (unsigned char *)0, id, air, mat, los, 0 ); /* Add region to the one group that it belongs to. */ group_add( id, wp->wm_name ); if(verbose) col_pr( wp->wm_name ); } #define NGROUPS 21 struct groups { struct wmember grp_wm; int grp_lo; int grp_hi; } groups[NGROUPS]; int ngroups; void group_init(void) { group_register( "g00", 0, 0 ); group_register( "g0", 1, 99 ); group_register( "g1", 100, 199); group_register( "g2", 200, 299 ); group_register( "g3", 300, 399 ); group_register( "g4", 400, 499 ); group_register( "g5", 500, 599 ); group_register( "g6", 600, 699 ); group_register( "g7", 700, 799 ); group_register( "g8", 800, 899 ); group_register( "g9", 900, 999 ); group_register( "g10", 1000, 1999 ); group_register( "g11", 2000, 2999 ); group_register( "g12", 3000, 3999 ); group_register( "g13", 4000, 4999 ); group_register( "g14", 5000, 5999 ); group_register( "g15", 6000, 6999 ); group_register( "g16", 7000, 7999 ); group_register( "g17", 8000, 8999 ); group_register( "g18", 9000, 9999 ); group_register( "g19", 10000, 32767 ); } void group_register(char *name, int lo, int hi) { char nbuf[32]; register struct wmember *wp; if( ngroups >= NGROUPS ) { printf("Too many groups, ABORTING\n"); exit(13); } wp = &groups[ngroups].grp_wm; sprintf( nbuf, "%s%s", name, name_it ); wp->wm_name = bu_strdup( nbuf ); RT_LIST_INIT( &wp->l ); groups[ngroups].grp_lo = lo; groups[ngroups].grp_hi = hi; ngroups++; } void group_add(register int val, char *name) { register int i; for( i=ngroups-1; i>=0; i-- ) { if( val < groups[i].grp_lo ) continue; if( val > groups[i].grp_hi ) continue; goto add; } printf("Unable to find group for value %d\n", val); i = 0; add: (void)mk_addmember( name, &groups[i].grp_wm.l, NULL, WMOP_UNION ); } void group_write(void) { register struct wmember *wp; struct wmember allhead; register int i; RT_LIST_INIT( &allhead.l ); for( i=0; i < ngroups; i++ ) { wp = &groups[i].grp_wm; /* Skip empty groups */ if( RT_LIST_IS_EMPTY( &wp->l ) ) continue; /* Make a non-region combination */ mk_lfcomb( outfp, wp->wm_name, wp, 0 ); /* Add it to "all.g" */ (void)mk_addmember( wp->wm_name, &allhead.l, NULL, WMOP_UNION ); if(verbose) col_pr( wp->wm_name ); } /* Make all-encompasing "all.g" group here */ mk_lfcomb( outfp, "all.g", &allhead, 0 ); } /* * Local Variables: * mode: C * tab-width: 8 * c-basic-offset: 4 * indent-tabs-mode: t * End: * ex: shiftwidth=4 tabstop=8 */ --- NEW FILE: solid.c --- /* S O L I D . C * BRL-CAD * * Copyright (C) 1989-2005 United States Government as represented by * the U.S. Army Research Laboratory. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this file; see the file named COPYING for more * information. [...1037 lines suppressed...] void eat(int count) { char lbuf[132]; int i; for( i=0; i<count; i++ ) { (void)get_line( lbuf, sizeof(lbuf), "eaten card" ); } } /* * Local Variables: * mode: C * tab-width: 8 * c-basic-offset: 4 * indent-tabs-mode: t * End: * ex: shiftwidth=4 tabstop=8 */ --- NEW FILE: tools.c --- /* T O O L S . C * BRL-CAD * * Copyright (C) 2004-2005 United States Government as represented by * the U.S. Army Research Laboratory. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this file; see the file named COPYING for more * information. * */ /** @file tools.c * */ #include "common.h" #define PADCHR ~(1<<15) /* non data value.*/ char * endstr(char *str) { while( *str != 0 ) *str++; return( str ); } #ifndef HAVE_STRCPY strcpy(char *s, char *t) /* === */ { while( (*s++ = *t++) != '\0' ); *s = '\0'; } #endif strappend(char *s, char *t) /* === */ { s = endstr( s ); while( (*s++ = *t++) != '\0' ); *s = '\0'; } maxmin(int *l, int n, int *max, int *min) /* === */ { *max = -PADCHR; *min = PADCHR; /*BUGoff/printf( "max=%d min=%d\n", *max, *min );/* BUG */ while( --n>0 ) { if( *l > *max ) *max = *l; if( *l < *min ) *min = *l; ++l; } /*BUGoff/printf( "max=%d min=%d\n", *max, *min );/* BUG */ } /* * Local Variables: * mode: C * tab-width: 8 * c-basic-offset: 4 * indent-tabs-mode: t * End: * ex: shiftwidth=4 tabstop=8 */ --- NEW FILE: try.sh --- #!/bin/sh # T R Y . S H # BRL-CAD # # Copyright (C) 2004-2005 United States Government as represented by # the U.S. Army Research Laboratory. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # # 3. The name of the author may not be used to endorse or promote # products derived from this software without specific prior written # permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # ### # # Script for testing comgeom-g # # $Header: /cvsroot/brlcad/brlcad/src/conv/comgeom/try.sh,v 1.1 2005/10/27 03:36:04 brlcad Exp $ CASE=$1 if test x$2 = x then OPT="" DB=foo.g else shift OPT="$*" DB=/dev/null fi case $CASE in 1) comgeom-g $OPT -v4 m35.cg4 $DB break;; 2) comgeom-g $OPT m35a2.cg5 $DB break;; 3) comgeom-g $OPT apache.cg $DB break;; 4) comgeom-g $OPT avlb.cg5 $DB break;; 5) comgeom-g $OPT -v1 atr.cg1 $DB break;; *) echo "Try /$1/ unknown" exit 1; break;; esac # Local Variables: # mode: sh # tab-width: 8 # sh-indentation: 4 # sh-basic-offset: 4 # indent-tabs-mode: t # End: # ex: shiftwidth=4 tabstop=8 |