BRL-CAD

GED Database Format v4. More...

#include "common.h"
#include "vmath.h"
#include "nmg.h"
Include dependency graph for db4.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ident
 
struct  solidrec
 
struct  combination
 
struct  member
 
struct  material_rec
 
struct  B_solid
 
struct  b_surf
 
struct  polyhead
 
struct  polydata
 
struct  ars_rec
 
struct  ars_ext
 
struct  strsol
 
struct  arbn_rec
 
struct  exported_pipe_pnt
 
struct  pipewire_rec
 
struct  particle_rec
 
struct  extr_rec
 
struct  sketch_rec
 
struct  annot_rec
 
struct  script_rec
 
struct  cline_rec
 
struct  bot_rec
 
union  record
 

Macros

#define NAMESIZE   16
 
#define NAMEMOVE(from, to)   (void)strncpy(to, from, NAMESIZE)
 
#define DB_MINREC   128
 
#define ID_NO_UNIT   0 /* unspecified */
 
#define ID_MM_UNIT   1 /* millimeters (preferred) */
 
#define ID_CM_UNIT   2 /* centimeters */
 
#define ID_M_UNIT   3 /* meters */
 
#define ID_IN_UNIT   4 /* inches */
 
#define ID_FT_UNIT   5 /* feet */
 
#define ID_UM_UNIT   6 /* micrometers */
 
#define ID_KM_UNIT   7 /* kilometers */
 
#define ID_YD_UNIT   8 /* yards */
 
#define ID_MI_UNIT   9 /* miles */
 
#define ID_VERSION   "v4" /* Current Version */
 
#define ID_BY_UNKNOWN   0 /* unknown */
 
#define ID_BY_VAX   1 /* VAX (Little Endian) */
 
#define ED_BY_IBM   2 /* IBM (Big Endian) */
 
#define ID_FT_UNKNOWN   0 /* unknown */
 
#define ID_FT_VAX   1 /* VAX */
 
#define ID_FT_IBM   2 /* IBM */
 
#define ID_FT_IEEE   3 /* IEEE */
 
#define ID_FT_CRAY   4 /* Cray */
 
#define RPP   1 /* axis-aligned rectangular parallelepiped */
 
#define BOX   2 /* arbitrary rectangular parallelepiped */
 
#define RAW   3 /* right-angle wedge */
 
#define ARB4   4 /* tetrahedron */
 
#define ARB5   5 /* pyramid */
 
#define ARB6   6 /* extruded triangle */
 
#define ARB7   7 /* weird 7-vertex shape */
 
#define ARB8   8 /* hexahedron */
 
#define ELL   9 /* ellipsoid */
 
#define ELL1   10 /* another ellipsoid definition */
 
#define SPH   11 /* sphere */
 
#define RCC   12 /* right circular cylinder */
 
#define REC   13 /* right elliptic cylinder */
 
#define TRC   14 /* truncated regular cone */
 
#define TEC   15 /* truncated elliptic cone */
 
#define TOR   16 /* toroid */
 
#define TGC   17 /* truncated general cone */
 
#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 /* HACK arbitrary triangular-surfaced polyhedron */
 
#define ARSCONT   22 /* HACK extension record type for ARS solid */
 
#define ELLG   23 /* comgeom version of GENELL ellipsoid */
 
#define HALFSPACE   24 /* half-space */
 
#define SPLINE   25 /* HACK and trouble */
 
#define RPC   26 /* Right Parabolic Cylinder */
 
#define RHC   27 /* Right Parabolic Cylinder */
 
#define EPA   28 /* Elliptical Paraboloid */
 
#define EHY   29 /* Elliptical Hyperboloid */
 
#define ETO   30 /* Elliptical Torus */
 
#define GRP   31 /* Grip pseudo solid */
 
#define SUPERELL   32 /* Superquadratic Ellipsoid */
 
#define HYP   33 /* Hyperboloid of one sheet */
 
#define s_tgc_V   s_values[0]
 
#define s_tgc_H   s_values[3]
 
#define s_tgc_A   s_values[6]
 
#define s_tgc_B   s_values[9]
 
#define s_tgc_C   s_values[12]
 
#define s_tgc_D   s_values[15]
 
#define s_tor_V   s_values[0]
 
#define s_tor_H   s_values[3]
 
#define s_tor_A   s_values[6]
 
#define s_tor_B   s_values[9]
 
#define s_tor_C   s_values[12]
 
#define s_tor_D   s_values[15]
 
#define s_tor_E   s_values[18]
 
#define s_tor_F   s_values[21]
 
#define s_ell_V   s_values[0]
 
#define s_ell_A   s_values[3]
 
#define s_ell_B   s_values[6]
 
#define s_ell_C   s_values[9]
 
#define s_superell_V   s_values[0]
 
#define s_superell_A   s_values[3]
 
#define s_superell_B   s_values[6]
 
#define s_superell_C   s_values[9]
 
#define s_superell_n   s_values[12]
 
#define s_superell_e   s_values[13]
 
#define s_half_N   s_values[0]
 
#define s_half_d   s_values[3]
 
#define s_grip_C   s_values[0]
 
#define s_grip_N   s_values[3]
 
#define s_grip_m   s_values[6]
 
#define DBV4_NON_REGION   ' '
 
#define DBV4_NON_REGION_NULL   '\0'
 
#define DBV4_REGION   'R'
 
#define DBV4_REGION_FASTGEN_PLATE   'P'
 
#define DBV4_REGION_FASTGEN_VOLUME   'V'
 
#define DB_INH_LOWER   0 /* Lower nodes override */
 
#define DB_INH_HIGHER   1 /* Higher nodes override */
 
#define DB_SS_NGRAN   8 /* All STRSOL's have this many granules */
 
#define DB_SS_LEN   (DB_SS_NGRAN*DB_MINREC-2*NAMESIZE-2)
 
#define ID_IDENT   'I'
 
#define ID_SOLID   'S'
 
#define ID_COMB   'C'
 
#define ID_MEMB   'M'
 
#define ID_ARS_A   'A'
 
#define ID_ARS_B   'B'
 
#define ID_FREE   'F' /* Free record -- ignore */
 
#define ID_P_HEAD   'P' /* Polygon header */
 
#define ID_P_DATA   'Q' /* Polygon data record */
 
#define ID_BSOLID   'b' /* B-spline solid. multiple surfs */
 
#define ID_BSURF   'D' /* d_spline surface header */
 
#define ID_COLORTAB   'm' /* Material "color table" record */
 
#define DBID_STRSOL   's' /* String solid description */
 
#define DBID_ARBN   'n' /* Convex polyhedron with N faces */
 
#define DBID_PIPE   'w' /* pipe (wire) solid */
 
#define DBID_PARTICLE   'p' /* a particle (lozenge) */
 
#define DBID_NMG   'N' /* NMG solid */
 
#define DBID_SKETCH   'd' /* 2D sketch */
 
#define DBID_ANNOT   'a' /* 2D annotations */
 
#define DBID_EXTR   'e' /* solid of extrusion */
 
#define DBID_CLINE   'c' /* FASTGEN4 CLINE solid */
 
#define DBID_BOT   't' /* Bag o' triangles */
 
#define DBID_SCRIPT   'T' /* script */
 
#define DB_RECORD_NULL   ((union record *)0)
 

Typedefs

typedef float dbfloat_t
 

Functions

DEPRECATED void rt_fastf_float (fastf_t *ff, const dbfloat_t *fp, int n, int flip)
 
DEPRECATED void rt_mat_dbmat (fastf_t *ff, const dbfloat_t *dbp, int flip)
 
DEPRECATED void rt_dbmat_mat (dbfloat_t *dbp, const fastf_t *ff)
 

Detailed Description

GED Database Format v4.

All records are rounded up to have a fixed length; each such database record is also known as a "granule", and is the smallest unit of database storage.

Every granule can be identified by the first byte, which can be accessed by the u_id name. Note that the u_id field is not valid when writing the actual data for splines.

Each granule is read into a "union record", and is then processed based on the value of u_id. Each granule will have one of these formats: A Free record An ID record A SOLID record A COMBINATION record, followed by multiple MEMBER records An ARS ‘A’ (header) record, followed by multiple ARS ‘B’ (data) records A Polygon header record, followed by multiple Polygon data records A B-spline solid header record, followed by multiple B-spline surface records, followed by d_kv_size[0] floats, d_kv_size[1] floats, padded to d_nknots granules, followed by ctl_size[0]*ctl_size[1]*geom_type floats, padded to d_nctls granules.

The records are stored as binary records corresponding to PDP-11 and VAX C structs, so padding must be supplied explicitly for alignment.

For the time being, the representation of the floating point numbers in the database is machine-specific, requiring conversion to ASCII (via g2asc) and back to binary (via asc2g) when exchanging between machines of dissimilar types. In time, an external representation for floats might be implemented.

Definition in file db4.h.

Macro Definition Documentation

◆ ID_NO_UNIT

#define ID_NO_UNIT   0 /* unspecified */

Definition at line 93 of file db4.h.

◆ ID_MM_UNIT

#define ID_MM_UNIT   1 /* millimeters (preferred) */

Definition at line 94 of file db4.h.

◆ ID_CM_UNIT

#define ID_CM_UNIT   2 /* centimeters */

Definition at line 95 of file db4.h.

◆ ID_M_UNIT

#define ID_M_UNIT   3 /* meters */

Definition at line 96 of file db4.h.

◆ ID_IN_UNIT

#define ID_IN_UNIT   4 /* inches */

Definition at line 97 of file db4.h.

◆ ID_FT_UNIT

#define ID_FT_UNIT   5 /* feet */

Definition at line 98 of file db4.h.

◆ ID_UM_UNIT

#define ID_UM_UNIT   6 /* micrometers */

Definition at line 100 of file db4.h.

◆ ID_KM_UNIT

#define ID_KM_UNIT   7 /* kilometers */

Definition at line 101 of file db4.h.

◆ ID_YD_UNIT

#define ID_YD_UNIT   8 /* yards */

Definition at line 102 of file db4.h.

◆ ID_MI_UNIT

#define ID_MI_UNIT   9 /* miles */

Definition at line 103 of file db4.h.

◆ ID_VERSION

#define ID_VERSION   "v4" /* Current Version */

Definition at line 105 of file db4.h.

◆ ID_BY_UNKNOWN

#define ID_BY_UNKNOWN   0 /* unknown */

Definition at line 109 of file db4.h.

◆ ID_BY_VAX

#define ID_BY_VAX   1 /* VAX (Little Endian) */

Definition at line 110 of file db4.h.

◆ ED_BY_IBM

#define ED_BY_IBM   2 /* IBM (Big Endian) */

Definition at line 111 of file db4.h.

◆ ID_FT_UNKNOWN

#define ID_FT_UNKNOWN   0 /* unknown */

Definition at line 113 of file db4.h.

◆ ID_FT_VAX

#define ID_FT_VAX   1 /* VAX */

Definition at line 114 of file db4.h.

◆ ID_FT_IBM

#define ID_FT_IBM   2 /* IBM */

Definition at line 115 of file db4.h.

◆ ID_FT_IEEE

#define ID_FT_IEEE   3 /* IEEE */

Definition at line 116 of file db4.h.

◆ ID_FT_CRAY

#define ID_FT_CRAY   4 /* Cray */

Definition at line 117 of file db4.h.

◆ RPP

#define RPP   1 /* axis-aligned rectangular parallelepiped */

Definition at line 123 of file db4.h.

◆ BOX

#define BOX   2 /* arbitrary rectangular parallelepiped */

Definition at line 124 of file db4.h.

◆ RAW

#define RAW   3 /* right-angle wedge */

Definition at line 125 of file db4.h.

◆ ARB4

#define ARB4   4 /* tetrahedron */

Definition at line 126 of file db4.h.

◆ ARB5

#define ARB5   5 /* pyramid */

Definition at line 127 of file db4.h.

◆ ARB6

#define ARB6   6 /* extruded triangle */

Definition at line 128 of file db4.h.

◆ ARB7

#define ARB7   7 /* weird 7-vertex shape */

Definition at line 129 of file db4.h.

◆ ARB8

#define ARB8   8 /* hexahedron */

Definition at line 130 of file db4.h.

◆ ELL

#define ELL   9 /* ellipsoid */

Definition at line 131 of file db4.h.

◆ ELL1

#define ELL1   10 /* another ellipsoid definition */

Definition at line 132 of file db4.h.

◆ SPH

#define SPH   11 /* sphere */

Definition at line 133 of file db4.h.

◆ RCC

#define RCC   12 /* right circular cylinder */

Definition at line 134 of file db4.h.

◆ REC

#define REC   13 /* right elliptic cylinder */

Definition at line 135 of file db4.h.

◆ TRC

#define TRC   14 /* truncated regular cone */

Definition at line 136 of file db4.h.

◆ TEC

#define TEC   15 /* truncated elliptic cone */

Definition at line 137 of file db4.h.

◆ TOR

#define TOR   16 /* toroid */

Definition at line 138 of file db4.h.

◆ TGC

#define TGC   17 /* truncated general cone */

Definition at line 139 of file db4.h.

◆ GENTGC

#define GENTGC   18 /* supergeneralized TGC; internal form */

Definition at line 140 of file db4.h.

◆ GENELL

#define GENELL   19 /* ready for drawing ELL: V, A, B, C */

Definition at line 141 of file db4.h.

◆ GENARB8

#define GENARB8   20 /* generalized ARB8: V, and 7 other vectors */

Definition at line 142 of file db4.h.

◆ ARS

#define ARS   21 /* HACK arbitrary triangular-surfaced polyhedron */

Definition at line 143 of file db4.h.

◆ ARSCONT

#define ARSCONT   22 /* HACK extension record type for ARS solid */

Definition at line 144 of file db4.h.

◆ ELLG

#define ELLG   23 /* comgeom version of GENELL ellipsoid */

Definition at line 145 of file db4.h.

◆ HALFSPACE

#define HALFSPACE   24 /* half-space */

Definition at line 146 of file db4.h.

◆ SPLINE

#define SPLINE   25 /* HACK and trouble */

Definition at line 147 of file db4.h.

◆ RPC

#define RPC   26 /* Right Parabolic Cylinder */

Definition at line 148 of file db4.h.

◆ RHC

#define RHC   27 /* Right Parabolic Cylinder */

Definition at line 149 of file db4.h.

◆ EPA

#define EPA   28 /* Elliptical Paraboloid */

Definition at line 150 of file db4.h.

◆ EHY

#define EHY   29 /* Elliptical Hyperboloid */

Definition at line 151 of file db4.h.

◆ ETO

#define ETO   30 /* Elliptical Torus */

Definition at line 152 of file db4.h.

◆ GRP

#define GRP   31 /* Grip pseudo solid */

Definition at line 153 of file db4.h.

◆ SUPERELL

#define SUPERELL   32 /* Superquadratic Ellipsoid */

Definition at line 154 of file db4.h.

◆ HYP

#define HYP   33 /* Hyperboloid of one sheet */

Definition at line 155 of file db4.h.

◆ s_tgc_V

#define s_tgc_V   s_values[0]

Definition at line 159 of file db4.h.

◆ s_tgc_H

#define s_tgc_H   s_values[3]

Definition at line 160 of file db4.h.

◆ s_tgc_A

#define s_tgc_A   s_values[6]

Definition at line 161 of file db4.h.

◆ s_tgc_B

#define s_tgc_B   s_values[9]

Definition at line 162 of file db4.h.

◆ s_tgc_C

#define s_tgc_C   s_values[12]

Definition at line 163 of file db4.h.

◆ s_tgc_D

#define s_tgc_D   s_values[15]

Definition at line 164 of file db4.h.

◆ s_tor_V

#define s_tor_V   s_values[0]

Definition at line 166 of file db4.h.

◆ s_tor_H

#define s_tor_H   s_values[3]

Definition at line 167 of file db4.h.

◆ s_tor_A

#define s_tor_A   s_values[6]

Definition at line 168 of file db4.h.

◆ s_tor_B

#define s_tor_B   s_values[9]

Definition at line 169 of file db4.h.

◆ s_tor_C

#define s_tor_C   s_values[12]

Definition at line 170 of file db4.h.

◆ s_tor_D

#define s_tor_D   s_values[15]

Definition at line 171 of file db4.h.

◆ s_tor_E

#define s_tor_E   s_values[18]

Definition at line 172 of file db4.h.

◆ s_tor_F

#define s_tor_F   s_values[21]

Definition at line 173 of file db4.h.

◆ s_ell_V

#define s_ell_V   s_values[0]

Definition at line 175 of file db4.h.

◆ s_ell_A

#define s_ell_A   s_values[3]

Definition at line 176 of file db4.h.

◆ s_ell_B

#define s_ell_B   s_values[6]

Definition at line 177 of file db4.h.

◆ s_ell_C

#define s_ell_C   s_values[9]

Definition at line 178 of file db4.h.

◆ s_superell_V

#define s_superell_V   s_values[0]

Definition at line 180 of file db4.h.

◆ s_superell_A

#define s_superell_A   s_values[3]

Definition at line 181 of file db4.h.

◆ s_superell_B

#define s_superell_B   s_values[6]

Definition at line 182 of file db4.h.

◆ s_superell_C

#define s_superell_C   s_values[9]

Definition at line 183 of file db4.h.

◆ s_superell_n

#define s_superell_n   s_values[12]

Definition at line 184 of file db4.h.

◆ s_superell_e

#define s_superell_e   s_values[13]

Definition at line 185 of file db4.h.

◆ s_half_N

#define s_half_N   s_values[0]

Definition at line 187 of file db4.h.

◆ s_half_d

#define s_half_d   s_values[3]

Definition at line 188 of file db4.h.

◆ s_grip_C

#define s_grip_C   s_values[0]

Definition at line 190 of file db4.h.

◆ s_grip_N

#define s_grip_N   s_values[3]

Definition at line 191 of file db4.h.

◆ s_grip_m

#define s_grip_m   s_values[6]

Definition at line 192 of file db4.h.

◆ DBV4_NON_REGION

#define DBV4_NON_REGION   ' '

Definition at line 198 of file db4.h.

◆ DBV4_NON_REGION_NULL

#define DBV4_NON_REGION_NULL   '\0'

Definition at line 199 of file db4.h.

◆ DBV4_REGION

#define DBV4_REGION   'R'

Definition at line 200 of file db4.h.

◆ DBV4_REGION_FASTGEN_PLATE

#define DBV4_REGION_FASTGEN_PLATE   'P'

Definition at line 201 of file db4.h.

◆ DBV4_REGION_FASTGEN_VOLUME

#define DBV4_REGION_FASTGEN_VOLUME   'V'

Definition at line 202 of file db4.h.

◆ DB_INH_LOWER

#define DB_INH_LOWER   0 /* Lower nodes override */

Definition at line 215 of file db4.h.

◆ DB_INH_HIGHER

#define DB_INH_HIGHER   1 /* Higher nodes override */

Definition at line 216 of file db4.h.

◆ DB_SS_NGRAN

#define DB_SS_NGRAN   8 /* All STRSOL's have this many granules */

Definition at line 303 of file db4.h.

◆ DB_SS_LEN

#define DB_SS_LEN   (DB_SS_NGRAN*DB_MINREC-2*NAMESIZE-2)

Definition at line 304 of file db4.h.

◆ ID_IDENT

#define ID_IDENT   'I'

Definition at line 416 of file db4.h.

◆ ID_SOLID

#define ID_SOLID   'S'

Definition at line 417 of file db4.h.

◆ ID_COMB

#define ID_COMB   'C'

Definition at line 418 of file db4.h.

◆ ID_MEMB

#define ID_MEMB   'M'

Definition at line 419 of file db4.h.

◆ ID_ARS_A

#define ID_ARS_A   'A'

Definition at line 420 of file db4.h.

◆ ID_ARS_B

#define ID_ARS_B   'B'

Definition at line 421 of file db4.h.

◆ ID_FREE

#define ID_FREE   'F' /* Free record -- ignore */

Definition at line 422 of file db4.h.

◆ ID_P_HEAD

#define ID_P_HEAD   'P' /* Polygon header */

Definition at line 423 of file db4.h.

◆ ID_P_DATA

#define ID_P_DATA   'Q' /* Polygon data record */

Definition at line 424 of file db4.h.

◆ ID_BSOLID

#define ID_BSOLID   'b' /* B-spline solid. multiple surfs */

Definition at line 425 of file db4.h.

◆ ID_BSURF

#define ID_BSURF   'D' /* d_spline surface header */

Definition at line 426 of file db4.h.

◆ ID_COLORTAB

#define ID_COLORTAB   'm' /* Material "color table" record */

Definition at line 427 of file db4.h.

◆ DBID_STRSOL

#define DBID_STRSOL   's' /* String solid description */

Definition at line 428 of file db4.h.

◆ DBID_ARBN

#define DBID_ARBN   'n' /* Convex polyhedron with N faces */

Definition at line 429 of file db4.h.

◆ DBID_PIPE

#define DBID_PIPE   'w' /* pipe (wire) solid */

Definition at line 430 of file db4.h.

◆ DBID_PARTICLE

#define DBID_PARTICLE   'p' /* a particle (lozenge) */

Definition at line 431 of file db4.h.

◆ DBID_NMG

#define DBID_NMG   'N' /* NMG solid */

Definition at line 432 of file db4.h.

◆ DBID_SKETCH

#define DBID_SKETCH   'd' /* 2D sketch */

Definition at line 433 of file db4.h.

◆ DBID_ANNOT

#define DBID_ANNOT   'a' /* 2D annotations */

Definition at line 434 of file db4.h.

◆ DBID_EXTR

#define DBID_EXTR   'e' /* solid of extrusion */

Definition at line 435 of file db4.h.

◆ DBID_CLINE

#define DBID_CLINE   'c' /* FASTGEN4 CLINE solid */

Definition at line 436 of file db4.h.

◆ DBID_BOT

#define DBID_BOT   't' /* Bag o' triangles */

Definition at line 437 of file db4.h.

◆ DBID_SCRIPT

#define DBID_SCRIPT   'T' /* script */

Definition at line 438 of file db4.h.