raytrace.h

Go to the documentation of this file.
00001 /*                      R A Y T R A C E . H
00002  * BRL-CAD
00003  *
00004  * Copyright (c) 1993-2006 United States Government as represented by
00005  * the U.S. Army Research Laboratory.
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License
00009  * as published by the Free Software Foundation; either version 2.1 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this file; see the file named COPYING for more
00019  * information.
00020  */
00021 /** @addtogroup librt */
00022 /*@{*/
00023 /** @file raytrace.h
00024  *
00025  *  All the data structures and manifest constants
00026  *  necessary for interacting with the BRL-CAD LIBRT ray-tracing library.
00027  *
00028  *  Note that this header file defines many internal data structures,
00029  *  as well as the library's external (interface) data structures.  These are
00030  *  provided for the convenience of applications builders.  However,
00031  *  the internal data structures are subject to change in each release.
00032  *
00033  *  @author
00034  *      Michael John Muuss
00035  *
00036  *  @par Source
00037  *      The U. S. Army Research Laboratory
00038  *@n    Aberdeen Proving Ground, Maryland  21005 USA
00039  *
00040  *  Include Sequencing -
00041 @code
00042         # include "common.h"    /_* Must come before system <> includes *_/
00043         #ifdef HAVE_STRING_H    /_* OPTIONAL, for strcmp() etc. *_/
00044         #  include <string.h>
00045         #else
00046         #  include <strings.h>
00047         #endif
00048         # include <stdio.h>
00049         # include <math.h>
00050         # include "machine.h"   /_* For fastf_t definition on this machine *_/
00051         # include "bu.h"
00052         # include "vmath.h"     /_* For vect_t definition *_/
00053         # include "bn.h"
00054         # include "db.h"                /_* OPTIONAL, precedes raytrace.h when used *_/
00055         # include "nmg.h"       /_* OPTIONAL, precedes raytrace.h when used *_/
00056         # include "raytrace.h"
00057         # include "nurb.h"      /_* OPTIONAL, follows raytrace.h when used *_/
00058 @endcode
00059  *
00060  *  Libraries Used -
00061  *      LIBRT LIBRT_LIBES -lm -lc
00062  *
00063  *  $Header: /cvsroot/brlcad/brlcad/include/raytrace.h,v 14.45 2006/09/18 05:24:07 lbutler Exp $
00064  */
00065 
00066 #ifndef RAYTRACE_H
00067 #define RAYTRACE_H seen
00068 
00069 /*
00070  *  Auto-include the BRL-CAD Utilities library, and compatability macros
00071  */
00072 #include "bu.h"
00073 #include "compat4.h"
00074 #include "bn.h"
00075 #include "db5.h"
00076 #include "tcl.h"
00077 
00078 #include "nmg.h"
00079 
00080 __BEGIN_DECLS
00081 
00082 #ifndef RT_EXPORT
00083 #  if defined(_WIN32) && !defined(__CYGWIN__) && defined(BRLCAD_DLL)
00084 #    ifdef RT_EXPORT_DLL
00085 #      define RT_EXPORT __declspec(dllexport)
00086 #    else
00087 #      define RT_EXPORT __declspec(dllimport)
00088 #    endif
00089 #  else
00090 #    define RT_EXPORT
00091 #  endif
00092 #endif
00093 
00094 #define RAYTRACE_H_VERSION      "@(#)$Header: /cvsroot/brlcad/brlcad/include/raytrace.h,v 14.45 2006/09/18 05:24:07 lbutler Exp $ (BRL)"
00095 
00096 /*
00097  *                              D E B U G
00098  *
00099  *  Each type of debugging support is independently controled,
00100  *  by a separate bit in the word RT_G_DEBUG
00101  *
00102  *  For programs based on the "RT" program, these flags follow
00103  *  the "-x" (lower case x) option.
00104  */
00105 #define DEBUG_OFF       0       /**< @brief No debugging */
00106 
00107 /* These definitions are each for one bit */
00108 
00109 /* Options useful for debugging applications */
00110 #define DEBUG_ALLRAYS   0x00000001      /**< @brief 1 Print calls to rt_shootray() */
00111 #define DEBUG_ALLHITS   0x00000002      /**< @brief 2 Print partitions passed to a_hit() */
00112 #define DEBUG_SHOOT     0x00000004      /**< @brief 3 Info about rt_shootray() processing */
00113 #define DEBUG_INSTANCE  0x00000008      /**< @brief 4 regionid instance revectoring */
00114 
00115 /* Options useful for debugging the database */
00116 #define DEBUG_DB        0x00000010      /**< @brief 5 Database debugging */
00117 #define DEBUG_SOLIDS    0x00000020      /**< @brief 6 Print prep'ed solids */
00118 #define DEBUG_REGIONS   0x00000040      /**< @brief 7 Print regions & boolean trees */
00119 #define DEBUG_ARB8      0x00000080      /**< @brief 8 Print voluminus ARB8 details */
00120 #define DEBUG_SPLINE    0x00000100      /**< @brief 9 Splines */
00121 #define DEBUG_ANIM      0x00000200      /**< @brief 10 Animation */
00122 #define DEBUG_ANIM_FULL 0x00000400      /**< @brief 11 Animation matrices */
00123 #define DEBUG_VOL       0x00000800      /**< @brief 12 Volume & opaque Binary solid */
00124 
00125 /* Options useful for debugging the library */
00126 #define DEBUG_ROOTS     0x00001000      /**< @brief 13 Print rootfinder details */
00127 #define DEBUG_PARTITION 0x00002000      /**< @brief 14 Info about bool_weave() */
00128 #define DEBUG_CUT       0x00004000      /**< @brief 15 Print space cutting statistics */
00129 #define DEBUG_BOXING    0x00008000      /**< @brief 16 Object/box checking details */
00130 #define DEBUG_MEM       0x00010000      /**< @brief 17 -->> BU_DEBUG_MEM_LOG */
00131 #define DEBUG_MEM_FULL  0x00020000      /**< @brief 18 -->> BU_DEBUG_MEM_CHECK */
00132 #define DEBUG_FDIFF     0x00040000      /**< @brief 19 bool/fdiff debugging */
00133 #define DEBUG_PARALLEL  0x00080000      /**< @brief 20 -->> BU_DEBUG_PARALLEL */
00134 #define DEBUG_CUTDETAIL 0x00100000      /**< @brief 21 Print space cutting details */
00135 #define DEBUG_TREEWALK  0x00200000      /**< @brief 22 Database tree traversal */
00136 #define DEBUG_TESTING   0x00400000      /**< @brief 23 One-shot debugging flag */
00137 #define DEBUG_ADVANCE   0x00800000      /**< @brief 24 Cell-to-cell space partitioning */
00138 #define DEBUG_MATH      0x01000000      /**< @brief 25 nmg math routines */
00139 
00140 /* Options for debugging particular solids */
00141 #define DEBUG_EBM       0x02000000      /**< @brief 26 Extruded bit-map solids */
00142 #define DEBUG_HF        0x04000000      /**< @brief 27 Height Field solids */
00143 
00144 /* Options which will cause the library to write binary debugging output */
00145 #define DEBUG_PLOTSOLIDS 0x40000000     /**< @brief 31 plot all solids */
00146 #define DEBUG_PLOTBOX   0x80000000      /**< @brief 32 Plot(3) bounding boxes and cuts */
00147 
00148 /** Format string for bu_printb() */
00149 #define DEBUG_FORMAT    \
00150 "\020\040PLOTBOX\
00151 \037PLOTSOLIDS\
00152 \033HF\032EBM\031MATH\030ADVANCE\
00153 \027TESTING\026TREEWALK\025CUTDETAIL\024PARALLEL\023FDIFF\022MEM_FULL\
00154 \021MEM\020BOXING\017CUTTING\016PARTITION\015ROOTS\014VOL\
00155 \013ANIM_FULL\012ANIM\011SPLINE\010ARB8\7REGIONS\6SOLIDS\5DB\
00156 \4INSTANCE\3SHOOT\2ALLHITS\1ALLRAYS"
00157 
00158 /**
00159  *  It is necessary to have a representation of 1.0/0.0, or "infinity"
00160  *  that fits within the dynamic range of the machine being used.
00161  *  This constant places an upper bound on the size object which
00162  *  can be represented in the model.
00163  */
00164 #ifdef INFINITY
00165 #       undef INFINITY
00166 #endif
00167 
00168 #if defined(vax) || (defined(sgi) && !defined(mips))
00169 #       define INFINITY (1.0e20)        /* VAX limit is 10**37 */
00170 #else
00171 #       define INFINITY (1.0e40)        /* IBM limit is 10**75 */
00172 #endif
00173 
00174 #define RT_BADNUM(n)    (!((n) >= -INFINITY && (n) <= INFINITY))
00175 #define RT_BADVEC(v)    (RT_BADNUM((v)[X]) || RT_BADNUM((v)[Y]) || RT_BADNUM((v)[Z]))
00176 
00177 /*
00178  *  Unfortunately, to prevent divide-by-zero, some tolerancing
00179  *  needs to be introduced.
00180  *
00181  *
00182  *  RT_LEN_TOL is the shortest length, in mm, that can be stood
00183  *  as the dimensions of a primitive.
00184  *  Can probably become at least SMALL.
00185  *
00186  *  Dot products smaller than RT_DOT_TOL are considered to have
00187  *  a dot product of zero, i.e., the angle is effectively zero.
00188  *  This is used to check vectors that should be perpendicular.
00189  *  asin(0.1   ) = 5.73917 degrees
00190  *  asin(0.01  ) = 0.572967
00191  *  asin(0.001 ) = 0.0572958 degrees
00192  *  asin(0.0001) = 0.00572958 degrees
00193  *
00194  *  sin(0.01 degrees) = sin(0.000174 radians) = 0.000174533
00195  *
00196  *  Many TGCs at least, in existing databases, will fail the
00197  *  perpendicularity test if DOT_TOL is much smaller than 0.001,
00198  *  which establishes a 1/20th degree tolerance.
00199  *  The intent is to eliminate grossly bad primitives, not pick nits.
00200  *
00201  *  RT_PCOEF_TOL is a tolerance on polynomial coefficients to prevent
00202  *  the root finder from having heartburn.
00203  */
00204 #define RT_LEN_TOL      (1.0e-8)
00205 #define RT_DOT_TOL      (0.001)
00206 #define RT_PCOEF_TOL    (1.0e-10)
00207 
00208 
00209 /**
00210  *                      R T _ T E S S _ T O L
00211  *
00212  *  Tessellation (geometric) tolerances,
00213  *  different beasts than the calcuation tolerance in bn_tol.
00214  */
00215 struct rt_tess_tol  {
00216         long            magic;
00217         double          abs;                    /**< @brief absolute dist tol */
00218         double          rel;                    /**< @brief rel dist tol */
00219         double          norm;                   /**< @brief normal tol */
00220 };
00221 #define RT_TESS_TOL_MAGIC       0xb9090dab
00222 #define RT_CK_TESS_TOL(_p)      BU_CKMAG(_p, RT_TESS_TOL_MAGIC, "rt_tess_tol")
00223 
00224 
00225 /**
00226  *                      R T _ D B _ I N T E R N A L
00227  *
00228  *  A handle on the internal format of an MGED database object.
00229  */
00230 struct rt_db_internal  {
00231         long            idb_magic;
00232         int             idb_major_type;
00233         int             idb_minor_type;         /**< @brief ID_xxx */
00234         const struct rt_functab *idb_meth;      /**< @brief for ft_ifree(), etc. */
00235         genptr_t        idb_ptr;
00236         struct bu_attribute_value_set idb_avs;
00237 };
00238 #define idb_type                idb_minor_type
00239 #define RT_DB_INTERNAL_MAGIC    0x0dbbd867
00240 #define RT_INIT_DB_INTERNAL(_p) {(_p)->idb_magic = RT_DB_INTERNAL_MAGIC; \
00241         (_p)->idb_type = -1; (_p)->idb_ptr = GENPTR_NULL;\
00242         (_p)->idb_avs.magic = -1;}
00243 #define RT_CK_DB_INTERNAL(_p)   BU_CKMAG(_p, RT_DB_INTERNAL_MAGIC, "rt_db_internal")
00244 
00245 /**
00246  *                      D B _ F U L L _ P A T H
00247  *
00248  *  For collecting paths through the database tree
00249  */
00250 struct db_full_path {
00251         long            magic;
00252         int             fp_len;
00253         int             fp_maxlen;
00254         struct directory **fp_names;    /**< @brief array of dir pointers */
00255 };
00256 #define DB_FULL_PATH_POP(_pp)   {(_pp)->fp_len--;}
00257 #define DB_FULL_PATH_CUR_DIR(_pp)       ((_pp)->fp_names[(_pp)->fp_len-1])
00258 #define DB_FULL_PATH_GET(_pp,_i)        ((_pp)->fp_names[(_i)])
00259 #define DB_FULL_PATH_MAGIC      0x64626670
00260 #define RT_CK_FULL_PATH(_p)     BU_CKMAG(_p, DB_FULL_PATH_MAGIC, "db_full_path")
00261 
00262 /**
00263  *                      X R A Y
00264  *
00265  * All necessary information about a ray.
00266  * Not called just "ray" to prevent conflicts with VLD stuff.
00267  */
00268 struct xray {
00269         long            magic;
00270         int             index;          /**< @brief Which ray of a bundle */
00271         point_t         r_pt;           /**< @brief Point at which ray starts */
00272         vect_t          r_dir;          /**< @brief Direction of ray (UNIT Length) */
00273         fastf_t         r_min;          /**< @brief entry dist to bounding sphere */
00274         fastf_t         r_max;          /**< @brief exit dist from bounding sphere */
00275 };
00276 #define RAY_NULL        ((struct xray *)0)
00277 #define RT_RAY_MAGIC    0x78726179      /**< @brief "xray" */
00278 #define RT_CK_RAY(_p)   BU_CKMAG(_p,RT_RAY_MAGIC,"struct xray");
00279 
00280 /**
00281  *                      H I T
00282  *
00283  *  Information about where a ray hits the surface
00284  *
00285  * Important Note:  Surface Normals always point OUT of a solid.
00286  *
00287  *  Statement of intent:
00288  *      The hit_point and hit_normal elements will be removed from this
00289  *      structure, so as to separate the concept of the solid's normal
00290  *      at the hit point from the post-boolean normal at the hit point.
00291  */
00292 struct hit {
00293         long            hit_magic;
00294         fastf_t         hit_dist;       /**< @brief dist from r_pt to hit_point */
00295         point_t         hit_point;      /**< @brief Intersection point */
00296         vect_t          hit_normal;     /**< @brief Surface Normal at hit_point */
00297         vect_t          hit_vpriv;      /**< @brief PRIVATE vector for xxx_*() */
00298         genptr_t        hit_private;    /**< @brief PRIVATE handle for xxx_shot() */
00299         int             hit_surfno;     /**< @brief solid-specific surface indicator */
00300         struct xray     *hit_rayp;      /**< @brief pointer to defining ray */
00301 };
00302 #define HIT_NULL        ((struct hit *)0)
00303 #define RT_HIT_MAGIC    0x20686974      /**< @brief " hit" */
00304 #define RT_CK_HIT(_p)   BU_CKMAG(_p,RT_HIT_MAGIC,"struct hit")
00305 
00306 /**
00307  * Old macro:
00308  *  Only the hit_dist field of pt_inhit and pt_outhit are valid
00309  *  when a_hit() is called;  to compute both hit_point and hit_normal,
00310  *  use RT_HIT_NORM() macro;  to compute just hit_point, use
00311  *  VJOIN1( hitp->hit_point, rp->r_pt, hitp->hit_dist, rp->r_dir );
00312  */
00313 #define RT_HIT_NORM( _hitp, _stp, _unused )  { \
00314         RT_CK_HIT(_hitp); \
00315         RT_CK_SOLTAB(_stp); \
00316         (_stp)->st_meth->ft_norm(_hitp, _stp, (_hitp)->hit_rayp); }
00317 
00318 /**
00319  *  New macro:  Compute normal into (_hitp)->hit_normal, but leave
00320  *  it un-flipped, as one hit may be shared between multiple partitions
00321  *  with different flip status.
00322  *  (Example:  box.r = box.s - sph.s; sph.r = sph.s)
00323  *  Return the post-boolean normal into caller-provided _normal vector.
00324  */
00325 #define RT_HIT_NORMAL( _normal, _hitp, _stp, _unused, _flipflag )  { \
00326         RT_CK_HIT(_hitp); \
00327         RT_CK_SOLTAB(_stp); \
00328         RT_CK_FUNCTAB((_stp)->st_meth); \
00329         (_stp)->st_meth->ft_norm(_hitp, _stp, (_hitp)->hit_rayp); \
00330         if( _flipflag )  { \
00331                 VREVERSE( _normal, (_hitp)->hit_normal ); \
00332         } else { \
00333                 VMOVE( _normal, (_hitp)->hit_normal ); \
00334         } \
00335  }
00336 
00337 /* A more powerful interface would be: */
00338 /* RT_GET_NORMAL( _normal, _partition, inhit/outhit flag, ap ) */
00339 
00340 
00341 
00342 /**
00343  *                      C U R V A T U R E
00344  *
00345  *  Information about curvature of the surface at a hit point.
00346  *  The principal direction pdir has unit length and principal curvature c1.
00347  *  |c1| <= |c2|, i.e. c1 is the most nearly flat principle curvature.
00348  *  A POSITIVE curvature indicates that the surface bends TOWARD the
00349  *  (outward pointing) normal vector at that point.
00350  *  c1 and c2 are the inverse radii of curvature.
00351  *  The other principle direction is implied: pdir2 = normal x pdir1.
00352  */
00353 struct curvature {
00354         vect_t          crv_pdir;       /**< @brief Principle direction */
00355         fastf_t         crv_c1;         /**< @brief curvature in principle dir */
00356         fastf_t         crv_c2;         /**< @brief curvature in other direction */
00357 };
00358 #define CURVE_NULL      ((struct curvature *)0)
00359 
00360 /**
00361  *  Use this macro after having computed the normal, to
00362  *  compute the curvature at a hit point.
00363  *
00364  *  In Release 4.4 and earlier, this was called RT_CURVE().
00365  *  When the extra argument was added the name was changed.
00366  */
00367 #define RT_CURVATURE( _curvp, _hitp, _flipflag, _stp )  { \
00368         RT_CK_HIT(_hitp); \
00369         RT_CK_SOLTAB(_stp); \
00370         RT_CK_FUNCTAB((_stp)->st_meth); \
00371         (_stp)->st_meth->ft_curve( _curvp, _hitp, _stp ); \
00372         if( _flipflag )  { \
00373                 (_curvp)->crv_c1 = - (_curvp)->crv_c1; \
00374                 (_curvp)->crv_c2 = - (_curvp)->crv_c2; \
00375         } \
00376  }
00377 
00378 /* A more powerful interface would be: */
00379 /* RT_GET_CURVATURE(_curvp, _partition, inhit/outhit flag, ap) */
00380 
00381 /**
00382  *                      U V C O O R D
00383  *
00384  *  Mostly for texture mapping, information about parametric space.
00385  */
00386 struct uvcoord {
00387         fastf_t         uv_u;           /**< @brief Range 0..1 */
00388         fastf_t         uv_v;           /**< @brief Range 0..1 */
00389         fastf_t         uv_du;          /**< @brief delta in u */
00390         fastf_t         uv_dv;          /**< @brief delta in v */
00391 };
00392 #define RT_HIT_UVCOORD( ap, _stp, _hitp, uvp )  { \
00393         RT_CK_HIT(_hitp); \
00394         RT_CK_SOLTAB(_stp); \
00395         RT_CK_FUNCTAB((_stp)->st_meth); \
00396         (_stp)->st_meth->ft_uv( ap, _stp, _hitp, uvp ); }
00397 
00398 /* A more powerful interface would be: */
00399 /* RT_GET_UVCOORD(_uvp, _partition, inhit/outhit flag, ap) */
00400 
00401 
00402 /**
00403  *                      S E G
00404  *
00405  * Intersection segment.
00406  *
00407  * Includes information about both endpoints of intersection.
00408  * Contains forward link to additional intersection segments
00409  * if the intersection spans multiple segments (eg, shooting
00410  * a ray through a torus).
00411  */
00412 struct seg {
00413         struct bu_list  l;
00414         struct hit      seg_in;         /**< @brief IN information */
00415         struct hit      seg_out;        /**< @brief OUT information */
00416         struct soltab   *seg_stp;       /**< @brief pointer back to soltab */
00417 };
00418 #define RT_SEG_NULL     ((struct seg *)0)
00419 #define RT_SEG_MAGIC    0x98bcdef1
00420 
00421 #define RT_CHECK_SEG(_p)        BU_CKMAG(_p, RT_SEG_MAGIC, "struct seg")
00422 #define RT_CK_SEG(_p)           BU_CKMAG(_p, RT_SEG_MAGIC, "struct seg")
00423 
00424 #define RT_GET_SEG(p,res)    { \
00425         while( !BU_LIST_WHILE((p),seg,&((res)->re_seg)) || !(p) ) \
00426                 rt_get_seg(res); \
00427         BU_LIST_DEQUEUE( &((p)->l) ); \
00428         (p)->l.forw = (p)->l.back = BU_LIST_NULL; \
00429         (p)->seg_in.hit_magic = (p)->seg_out.hit_magic = RT_HIT_MAGIC; \
00430         res->re_segget++; }
00431 
00432 #define RT_FREE_SEG(p,res)  { \
00433         RT_CHECK_SEG(p); \
00434         BU_LIST_INSERT( &((res)->re_seg), &((p)->l) ); \
00435         res->re_segfree++; }
00436 
00437 /**  This could be
00438  *      BU_LIST_INSERT_LIST( &((_res)->re_seg), &((_segheadp)->l) )
00439  *  except for security of checking & counting each element this way.
00440  */
00441 #define RT_FREE_SEG_LIST( _segheadp, _res )     { \
00442         register struct seg *_a; \
00443         while( BU_LIST_WHILE( _a, seg, &((_segheadp)->l) ) )  { \
00444                 BU_LIST_DEQUEUE( &(_a->l) ); \
00445                 RT_FREE_SEG( _a, _res ); \
00446         } }
00447 
00448 /**
00449  *  Macros to operate on Right Rectangular Parallelpipeds (RPPs).
00450  * XXX move to vmath.h?
00451  */
00452 struct bound_rpp {
00453         point_t min;
00454         point_t max;
00455 };
00456 
00457 #if 0
00458 /**
00459  *  Compare two bounding RPPs;  return true if disjoint.
00460  */
00461 #define RT_2RPP_DISJOINT(_l1, _h1, _l2, _h2) \
00462         V3RPP_DISJOINT(_l1, _h1, _l2, _h2)
00463 
00464 /** Test for point being inside or on an RPP */
00465 #define RT_POINT_IN_RPP(_pt, _min, _max)        \
00466         V3PT_IN_RPP(_pt, _min, _max)
00467 #endif
00468 
00469 /**
00470  *                      S O L T A B
00471  *
00472  * Internal information used to keep track of solids in the model
00473  * Leaf name and Xform matrix are unique identifier.
00474  */
00475 struct soltab {
00476         struct bu_list  l;              /**< @brief links, headed by rti_headsolid */
00477         struct bu_list  l2;             /**< @brief links, headed by st_dp->d_use_hd */
00478         const struct rt_functab *st_meth; /**< @brief pointer to per-solid methods */
00479         struct rt_i     *st_rtip;       /**< @brief "up" pointer to rt_i */
00480         long            st_uses;        /**< @brief Usage count, for instanced solids */
00481         int             st_id;          /**< @brief Solid ident */
00482         point_t         st_center;      /**< @brief Centroid of solid */
00483         fastf_t         st_aradius;     /**< @brief Radius of APPROXIMATING sphere */
00484         fastf_t         st_bradius;     /**< @brief Radius of BOUNDING sphere */
00485         genptr_t        st_specific;    /**< @brief -> ID-specific (private) struct */
00486         const struct directory *st_dp;  /**< @brief Directory entry of solid */
00487         point_t         st_min;         /**< @brief min X, Y, Z of bounding RPP */
00488         point_t         st_max;         /**< @brief max X, Y, Z of bounding RPP */
00489         long            st_bit;         /**< @brief solids bit vector index (const) */
00490         struct bu_ptbl  st_regions;     /**< @brief ptrs to regions using this solid (const) */
00491         matp_t          st_matp;        /**< @brief solid coords to model space, NULL=identity */
00492         struct db_full_path st_path;    /**< @brief path from region to leaf */
00493         /* Experimental stuff for accelerating "pieces" of solids */
00494         long            st_npieces;     /**< @brief #  pieces used by this solid */
00495         long            st_piecestate_num; /**< @brief re_pieces[] subscript */
00496         struct bound_rpp *st_piece_rpps;/**< @brief bounding RPP of each piece of this solid */
00497 };
00498 #define st_name         st_dp->d_namep
00499 #define RT_SOLTAB_NULL  ((struct soltab *)0)
00500 #define SOLTAB_NULL     RT_SOLTAB_NULL  /**< @brief backwards compat */
00501 #define RT_SOLTAB_MAGIC         0x92bfcde0      /**< @brief l.magic */
00502 #define RT_SOLTAB2_MAGIC        0x92bfcde2      /**< @brief l2.magic */
00503 
00504 #define RT_CHECK_SOLTAB(_p)     BU_CKMAG( _p, RT_SOLTAB_MAGIC, "struct soltab")
00505 #define RT_CK_SOLTAB(_p)        BU_CKMAG( _p, RT_SOLTAB_MAGIC, "struct soltab")
00506 
00507 /*
00508  *  Values for Solid ID.
00509  */
00510 #define ID_NULL         0       /**< @brief Unused */
00511 #define ID_TOR          1       /**< @brief Toroid */
00512 #define ID_TGC          2       /**< @brief Generalized Truncated General Cone */
00513 #define ID_ELL          3       /**< @brief Ellipsoid */
00514 #define ID_ARB8         4       /**< @brief Generalized ARB.  V + 7 vectors */
00515 #define ID_ARS          5       /**< @brief ARS */
00516 #define ID_HALF         6       /**< @brief Half-space */
00517 #define ID_REC          7       /**< @brief Right Elliptical Cylinder [TGC special] */
00518 #define ID_POLY         8       /**< @brief Polygonal facted object */
00519 #define ID_BSPLINE      9       /**< @brief B-spline object */
00520 #define ID_SPH          10      /**< @brief Sphere */
00521 #define ID_NMG          11      /**< @brief n-Manifold Geometry solid */
00522 #define ID_EBM          12      /**< @brief Extruded bitmap solid */
00523 #define ID_VOL          13      /**< @brief 3-D Volume */
00524 #define ID_ARBN         14      /**< @brief ARB with N faces */
00525 #define ID_PIPE         15      /**< @brief Pipe (wire) solid */
00526 #define ID_PARTICLE     16      /**< @brief Particle system solid */
00527 #define ID_RPC          17      /**< @brief Right Parabolic Cylinder  */
00528 #define ID_RHC          18      /**< @brief Right Hyperbolic Cylinder  */
00529 #define ID_EPA          19      /**< @brief Elliptical Paraboloid  */
00530 #define ID_EHY          20      /**< @brief Elliptical Hyperboloid  */
00531 #define ID_ETO          21      /**< @brief Elliptical Torus  */
00532 #define ID_GRIP         22      /**< @brief Pseudo Solid Grip */
00533 #define ID_JOINT        23      /**< @brief Pseudo Solid/Region Joint */
00534 #define ID_HF           24      /**< @brief Height Field */
00535 #define ID_DSP          25      /**< @brief Displacement map */
00536 #define ID_SKETCH       26      /**< @brief 2D sketch */
00537 #define ID_EXTRUDE      27      /**< @brief Solid of extrusion */
00538 #define ID_SUBMODEL     28      /**< @brief Instanced submodel */
00539 #define ID_CLINE        29      /**< @brief FASTGEN4 CLINE solid */
00540 #define ID_BOT          30      /**< @brief Bag o' triangles */
00541 
00542   /* Add a new primitive id above here (this is will break v5 format)
00543    * XXX must update the non-geometric object id's below XXX
00544    */
00545 #define ID_MAX_SOLID    37      /**< @brief Maximum defined ID_xxx for solids */
00546 
00547 /*
00548  *      Non-geometric objects
00549  */
00550 #define ID_COMBINATION  31      /**< @brief Combination Record */
00551 #define ID_BINEXPM      32      /**< @brief Experimental binary */
00552 #define ID_BINUNIF      33      /**< @brief Uniform-array binary */
00553 #define ID_BINMIME      34      /**< @brief MIME-typed binary */
00554 
00555 /* XXX - superellipsoid should be 31, but is not v5 compatible */
00556 #define ID_SUPERELL     35      /**< @brief Superquadratic ellipsoid */
00557 #define ID_METABALL     36      /**< @brief Metaball */
00558 
00559 #define ID_MAXIMUM      37      /**< @brief Maximum defined ID_xxx value */
00560 
00561 /**
00562  *                      M A T E R _ I N F O
00563  */
00564 struct mater_info {
00565         float   ma_color[3];            /**< @brief explicit color:  0..1  */
00566         float   ma_temperature;         /**< @brief positive ==> degrees Kelvin */
00567         char    ma_color_valid;         /**< @brief non-0 ==> ma_color is non-default */
00568         char    ma_cinherit;            /**< @brief color: DB_INH_LOWER / DB_INH_HIGHER */
00569         char    ma_minherit;            /**< @brief mater: DB_INH_LOWER / DB_INH_HIGHER */
00570         char    *ma_shader;             /**< @brief shader name & parms */
00571 };
00572 
00573 /**
00574  *                      R E G I O N
00575  *
00576  *  The region structure.
00577  */
00578 struct region  {
00579         struct bu_list  l;              /**< @brief magic # and doubly linked list */
00580         const char      *reg_name;      /**< @brief Identifying string */
00581         union tree      *reg_treetop;   /**< @brief Pointer to boolean tree */
00582         int             reg_bit;        /**< @brief constant index into Regions[] */
00583         int             reg_regionid;   /**< @brief Region ID code.  If <=0, use reg_aircode */
00584         int             reg_aircode;    /**< @brief Region ID AIR code */
00585         int             reg_gmater;     /**< @brief GIFT Material code */
00586         int             reg_los;        /**< @brief equivalent LOS estimate ?? */
00587         struct mater_info reg_mater;    /**< @brief Real material information */
00588         genptr_t        reg_mfuncs;     /**< @brief User appl. funcs for material */
00589         genptr_t        reg_udata;      /**< @brief User appl. data for material */
00590         int             reg_transmit;   /**< @brief flag:  material transmits light */
00591         long            reg_instnum;    /**< @brief instance number, from d_uses */
00592         short           reg_all_unions; /**< @brief 1=boolean tree is all unions */
00593         short           reg_is_fastgen; /**< @brief FASTGEN-compatability mode? */
00594 #define REGION_NON_FASTGEN      0
00595 #define REGION_FASTGEN_PLATE    1
00596 #define REGION_FASTGEN_VOLUME   2
00597         struct bu_mro   **attr_values;  /**< @brief Null terminated array of MRO structs
00598                                          * Each containing a value for the corresponding
00599                                          * attribute name passed to rt_gettrees_and_attrs() */
00600 };
00601 #define REGION_NULL     ((struct region *)0)
00602 #define RT_REGION_MAGIC 0xdffb8001
00603 #define RT_CK_REGION(_p)        BU_CKMAG(_p,RT_REGION_MAGIC,"struct region")
00604 
00605 /**
00606  *                      P A R T I T I O N
00607  *
00608  *  Partitions of a ray.  Passed from rt_shootray() into user's
00609  *  a_hit() function.
00610  *
00611  *  Not changed to a bu_list for backwards compatability, but
00612  *  you can iterate the whole list by writing:
00613  *      for( BU_LIST_FOR( pp, partition, (struct bu_list *)PartHeadp ) )
00614  */
00615 
00616 struct partition {
00617         /* This can be thought of and operated on as a struct bu_list */
00618         long            pt_magic;               /**< @brief sanity check */
00619         struct partition *pt_forw;              /**< @brief forwards link */
00620         struct partition *pt_back;              /**< @brief backwards link */
00621         struct seg      *pt_inseg;              /**< @brief IN seg ptr (gives stp) */
00622         struct hit      *pt_inhit;              /**< @brief IN hit pointer */
00623         struct seg      *pt_outseg;             /**< @brief OUT seg pointer */
00624         struct hit      *pt_outhit;             /**< @brief OUT hit ptr */
00625         struct region   *pt_regionp;            /**< @brief ptr to containing region */
00626         char            pt_inflip;              /**< @brief flip inhit->hit_normal */
00627         char            pt_outflip;             /**< @brief flip outhit->hit_normal */
00628         struct region   **pt_overlap_reg;       /**< @brief NULL-terminated array of overlapping regions.  NULL if no overlap. */
00629         struct bu_ptbl  pt_seglist;             /**< @brief all segs in this partition */
00630 };
00631 #define PT_NULL         ((struct partition *)0)
00632 #define PT_MAGIC        0x87687681
00633 #define PT_HD_MAGIC     0x87687680
00634 
00635 #define RT_CHECK_PT(_p) RT_CK_PT(_p)    /**< @brief compat */
00636 #define RT_CK_PT(_p)    BU_CKMAG(_p,PT_MAGIC, "struct partition")
00637 #define RT_CK_PARTITION(_p)     BU_CKMAG(_p,PT_MAGIC, "struct partition")
00638 #define RT_CK_PT_HD(_p) BU_CKMAG(_p,PT_HD_MAGIC, "struct partition list head")
00639 
00640 /* Macros for copying only the essential "middle" part of a partition struct */
00641 #define RT_PT_MIDDLE_START      pt_inseg                /**< @brief 1st elem to copy */
00642 #define RT_PT_MIDDLE_END        pt_seglist.l.magic      /**< @brief copy up to this elem (non-inclusive) */
00643 #define RT_PT_MIDDLE_LEN(p) \
00644         (((char *)&(p)->RT_PT_MIDDLE_END) - ((char *)&(p)->RT_PT_MIDDLE_START))
00645 
00646 #define RT_DUP_PT(ip,new,old,res)       { \
00647         GET_PT(ip,new,res); \
00648         memcpy((char *)(&(new)->RT_PT_MIDDLE_START), (char *)(&(old)->RT_PT_MIDDLE_START), RT_PT_MIDDLE_LEN(old) ); \
00649         (new)->pt_overlap_reg = NULL; \
00650         bu_ptbl_cat( &(new)->pt_seglist, &(old)->pt_seglist );  }
00651 
00652 /** Clear out the pointers, empty the hit list */
00653 #define GET_PT_INIT(ip,p,res)   {\
00654         GET_PT(ip,p,res); \
00655         memset( ((char *) &(p)->RT_PT_MIDDLE_START), 0, RT_PT_MIDDLE_LEN(p) ); }
00656 
00657 #define GET_PT(ip,p,res)   { \
00658         if( BU_LIST_NON_EMPTY_P(p, partition, &res->re_parthead) )  { \
00659                 BU_LIST_DEQUEUE((struct bu_list *)(p)); \
00660                 bu_ptbl_reset( &(p)->pt_seglist ); \
00661         } else { \
00662                 (p) = (struct partition *)bu_calloc(1, sizeof(struct partition), "struct partition"); \
00663                 (p)->pt_magic = PT_MAGIC; \
00664                 bu_ptbl_init( &(p)->pt_seglist, 42, "pt_seglist ptbl" ); \
00665                 (res)->re_partlen++; \
00666         } \
00667         res->re_partget++; }
00668 
00669 #define FREE_PT(p,res)  { \
00670         BU_LIST_APPEND( &(res->re_parthead), (struct bu_list *)(p) ); \
00671         if( (p)->pt_overlap_reg )  { \
00672                 bu_free( (genptr_t)((p)->pt_overlap_reg), "pt_overlap_reg" );\
00673                 (p)->pt_overlap_reg = NULL; \
00674         } \
00675         res->re_partfree++; }
00676 
00677 #define RT_FREE_PT_LIST( _headp, _res )         { \
00678                 register struct partition *_pp, *_zap; \
00679                 for( _pp = (_headp)->pt_forw; _pp != (_headp);  )  { \
00680                         _zap = _pp; \
00681                         _pp = _pp->pt_forw; \
00682                         BU_LIST_DEQUEUE( (struct bu_list *)(_zap) ); \
00683                         FREE_PT(_zap, _res); \
00684                 } \
00685                 (_headp)->pt_forw = (_headp)->pt_back = (_headp); \
00686         }
00687 
00688 /** Insert "new" partition in front of "old" partition.  Note order change */
00689 #define INSERT_PT(_new,_old)    BU_LIST_INSERT((struct bu_list *)_old,(struct bu_list *)_new)
00690 
00691 /** Append "new" partition after "old" partition.  Note arg order change */
00692 #define APPEND_PT(_new,_old)    BU_LIST_APPEND((struct bu_list *)_old,(struct bu_list *)_new)
00693 
00694 /** Dequeue "cur" partition from doubly-linked list */
00695 #define DEQUEUE_PT(_cur)        BU_LIST_DEQUEUE((struct bu_list *)_cur)
00696 
00697 /**
00698  *                      C U T
00699  *
00700  *  Structure for space subdivision.
00701  *
00702  *  cut_type is an integer for efficiency of access in rt_shootray()
00703  *  on non-word addressing machines.
00704  *
00705  *  If a solid has 'pieces', it will be listed either in bn_list (initially),
00706  *  or in bn_piecelist, but not both.
00707  */
00708 union cutter  {
00709 #define CUT_CUTNODE     1
00710 #define CUT_BOXNODE     2
00711 #define CUT_NUGRIDNODE  3
00712 #define CUT_MAXIMUM     3
00713         int     cut_type;
00714         union cutter *cut_forw;         /**< @brief Freelist forward link */
00715         struct cutnode  {
00716                 int     cn_type;
00717                 int     cn_axis;        /**< @brief 0,1,2 = cut along X,Y,Z */
00718                 fastf_t cn_point;       /**< @brief cut through axis==point */
00719                 union cutter *cn_l;     /**< @brief val < point */
00720                 union cutter *cn_r;     /**< @brief val >= point */
00721         } cn;
00722         struct boxnode  {
00723                 int     bn_type;
00724                 fastf_t bn_min[3];
00725                 fastf_t bn_max[3];
00726                 struct soltab **bn_list; /**< @brief bn_list[bn_len] */
00727                 int     bn_len;         /**< @brief # of solids in list */
00728                 int     bn_maxlen;      /**< @brief # of ptrs allocated to list */
00729                 struct rt_piecelist *bn_piecelist; /**< @brief [] solids with pieces */
00730                 int     bn_piecelen;    /**< @brief # of piecelists used */
00731                 int     bn_maxpiecelen; /**< @brief # of piecelists allocated */
00732         } bn;
00733         struct nugridnode {
00734                 int     nu_type;
00735                 struct nu_axis {
00736                         fastf_t nu_spos;        /**< @brief cell start position */
00737                         fastf_t nu_epos;        /**< @brief cell end position */
00738                         fastf_t nu_width;       /**< @brief voxel size (end - start) */
00739                 } *nu_axis[3];
00740                 int      nu_cells_per_axis[3]; /**< @brief number of slabs */
00741                 int      nu_stepsize[3];       /**< @brief number of cells to jump for one step in each axis */
00742                 union cutter    *nu_grid;        /**< @brief 3-D array of boxnodes */
00743         } nugn;
00744 };
00745 
00746 #define CUTTER_NULL     ((union cutter *)0)
00747 
00748 /**
00749  *                      M E M _ M A P
00750  *
00751  *  These structures are used to manage internal resource maps.
00752  *  Typically these maps describe some kind of memory or file space.
00753  */
00754 struct mem_map {
00755         struct mem_map  *m_nxtp;        /**< @brief Linking pointer to next element */
00756         unsigned         m_size;        /**< @brief Size of this free element */
00757         unsigned long    m_addr;        /**< @brief Address of start of this element */
00758 };
00759 #define MAP_NULL        ((struct mem_map *) 0)
00760 
00761 
00762 /**
00763  *  The directory is organized as forward linked lists hanging off of
00764  *  one of RT_DBNHASH headers in the db_i structure.
00765  */
00766 #define RT_DBNHASH              1024    /**< @brief size of hash table */
00767 
00768 #if     ((RT_DBNHASH)&((RT_DBNHASH)-1)) != 0
00769 #define RT_DBHASH(sum)  ((unsigned)(sum) % (RT_DBNHASH))
00770 #else
00771 #define RT_DBHASH(sum)  ((unsigned)(sum) & ((RT_DBNHASH)-1))
00772 #endif
00773 
00774 /**
00775  *                      D B _ I
00776  *
00777  *  One of these structures is used to describe each separate instance
00778  *  of a BRL-CAD model database ".g" file.
00779  *
00780  *  dbi_filepath is a C-style argv array of places to search when
00781  *  opening related files (such as data files for EBM solids or
00782  *  texture-maps).  The array and strings are all dynamically allocated.
00783  */
00784 struct db_i  {
00785         long                    dbi_magic;      /**< @brief magic number */
00786         /* THESE ELEMENTS ARE AVAILABLE FOR APPLICATIONS TO READ */
00787         char                    *dbi_filename;  /**< @brief file name */
00788         int                     dbi_read_only;  /**< @brief !0 => read only file */
00789         double                  dbi_local2base; /**< @brief local2mm */
00790         double                  dbi_base2local; /**< @brief unit conversion factors */
00791         char                    *dbi_title;     /**< @brief title from IDENT rec */
00792         char                    *const*dbi_filepath; /**< @brief search path for aux file opens (convenience var) */
00793         /* THESE ELEMENTS ARE FOR LIBRT ONLY, AND MAY CHANGE */
00794         struct directory        *dbi_Head[RT_DBNHASH];
00795         int                     dbi_fd;         /**< @brief UNIX file descriptor */
00796         FILE                    *dbi_fp;        /**< @brief STDIO file descriptor */
00797         long                    dbi_eof;        /**< @brief End+1 pos after db_scan() */
00798         long                    dbi_nrec;       /**< @brief # records after db_scan() */
00799         int                     dbi_uses;       /**< @brief # of uses of this struct */
00800         struct mem_map          *dbi_freep;     /**< @brief map of free granules */
00801         genptr_t                dbi_inmem;      /**< @brief ptr to in-memory copy */
00802         struct animate          *dbi_anroot;    /**< @brief heads list of anim at root lvl */
00803         struct bu_mapped_file   *dbi_mf;        /**< @brief Only in read-only mode */
00804         struct bu_ptbl          dbi_clients;    /**< @brief List of rtip's using this db_i */
00805         int                     dbi_version;    /**< @brief 4 or 5 */
00806         struct rt_wdb           *dbi_wdbp;      /**< @brief ptr back to containing rt_wdb */
00807 };
00808 #define DBI_NULL        ((struct db_i *)0)
00809 #define DBI_MAGIC       0x57204381
00810 
00811 #define RT_CHECK_DBI(_p)                BU_CKMAG(_p,DBI_MAGIC,"struct db_i")
00812 #define RT_CHECK_DBI_TCL(_interp,_p)    BU_CKMAG_TCL(_interp,_p,DBI_MAGIC,"struct db_i")
00813 #define RT_CK_DBI(_p)                   RT_CHECK_DBI(_p)
00814 #define RT_CK_DBI_TCL(_interp,_p)       RT_CHECK_DBI_TCL(_interp,_p)
00815 
00816 /**
00817  *                      D I R E C T O R Y
00818  *
00819  *  One of these structures is allocated in memory to represent each
00820  *  named object in the database.
00821  *
00822  *  Note that a d_addr of RT_DIR_PHONY_ADDR (-1L) means that database
00823  *  storage has not been allocated yet.
00824  *
00825  *  Note that there is special handling for RT_DIR_INMEM "in memory" overrides.
00826  *
00827  *  Construction should be done only by using RT_GET_DIRECTORY()
00828  *  Destruction should be done only by using db_dirdelete().
00829  *
00830  *  Special note:  In order to reduce the overhead of calling bu_malloc()
00831  *  (really bu_strdup()) to stash the name in d_namep, we carry along
00832  *  enough storage for small names right in the structure itself (d_shortname).
00833  *  Thus, d_namep should never be assigned to directly, it should always
00834  *  be accessed using RT_DIR_SET_NAMEP() and RT_DIR_FREE_NAMEP().
00835  *
00836  *  The in-memory name of an object should only be changed using db_rename(),
00837  *  so that it can be requeued on the correct linked list, based on new hash.
00838  *  This should be followed by rt_db_put_internal() on the object to
00839  *  modify the on-disk name.
00840  */
00841 struct directory  {
00842         long            d_magic;                /**< @brief Magic number */
00843         char            *d_namep;               /**< @brief pointer to name string */
00844         union {
00845                 long    file_offset;            /**< @brief disk address in obj file */
00846                 genptr_t ptr;                   /**< @brief ptr to in-memory-only obj */
00847         } d_un;
00848         struct directory *d_forw;               /**< @brief link to next dir entry */
00849         struct animate  *d_animate;             /**< @brief link to animation */
00850         long            d_uses;                 /**< @brief # uses, from instancing */
00851         long            d_len;                  /**< @brief # of db granules used */
00852         long            d_nref;                 /**< @brief # times ref'ed by COMBs */
00853         int             d_flags;                /**< @brief flags */
00854         unsigned char   d_major_type;           /**< @brief object major type */
00855         unsigned char   d_minor_type;           /**< @brief object minor type */
00856         struct bu_list  d_use_hd;               /**< @brief heads list of uses (struct soltab l2) */
00857         char            d_shortname[16];        /**< @brief Stash short names locally */
00858 };
00859 #define DIR_NULL        ((struct directory *)0)
00860 #define RT_DIR_MAGIC    0x05551212              /**< @brief Directory assistance */
00861 #define RT_CK_DIR(_dp)  BU_CKMAG(_dp, RT_DIR_MAGIC, "(librt)directory")
00862 
00863 #define d_addr  d_un.file_offset
00864 #define RT_DIR_PHONY_ADDR       (-1L)   /**< @brief Special marker for d_addr field */
00865 
00866 /* flags for db_diradd() and friends */
00867 #define DIR_SOLID       0x1             /**< @brief this name is a solid */
00868 #define DIR_COMB        0x2             /**< @brief combination */
00869 #define DIR_REGION      0x4             /**< @brief region */
00870 #define DIR_HIDDEN      0x8             /**< @brief object name is hidden */
00871 #define DIR_NON_GEOM    0x10            /**< @brief object is not geometry (e.g. binary object) */
00872 #define DIR_USED        0x80            /**< @brief One bit, used similar to d_nref */
00873 #define RT_DIR_INMEM    0x100           /**< @brief object is in memory (only) */
00874 
00875 /**< @brief Args to db_lookup() */
00876 #define LOOKUP_NOISY    1
00877 #define LOOKUP_QUIET    0
00878 
00879 #define FOR_ALL_DIRECTORY_START(_dp,_dbip)      { int _i; \
00880         for( _i = RT_DBNHASH-1; _i >= 0; _i-- )  { \
00881                 for( (_dp) = (_dbip)->dbi_Head[_i]; (_dp); (_dp) = (_dp)->d_forw )  {
00882 
00883 #define FOR_ALL_DIRECTORY_END   }}}
00884 
00885 #define RT_DIR_SET_NAMEP(_dp,_name)     { \
00886         if( strlen(_name) < sizeof((_dp)->d_shortname) )  {\
00887                 strncpy( (_dp)->d_shortname, (_name), sizeof((_dp)->d_shortname) ); \
00888                 (_dp)->d_namep = (_dp)->d_shortname; \
00889         } else { \
00890                 (_dp)->d_namep = bu_strdup(_name); /* Calls bu_malloc() */ \
00891         } }
00892 
00893 /** Use this macro to free the d_namep member, which is sometimes not dynamic. */
00894 #define RT_DIR_FREE_NAMEP(_dp)  { \
00895         if( (_dp)->d_namep != (_dp)->d_shortname )  \
00896                 bu_free((_dp)->d_namep, "d_namep"); \
00897         (_dp)->d_namep = NULL; }
00898 
00899 #if 1
00900 /** The efficient way */
00901 #define RT_GET_DIRECTORY(_p,_res)    { \
00902         while( ((_p) = (_res)->re_directory_hd) == NULL ) \
00903                 db_get_directory(_res); \
00904         (_res)->re_directory_hd = (_p)->d_forw; \
00905         (_p)->d_forw = NULL; }
00906 #else
00907 /* XXX Conservative, for testing parallel problems with Ft. AP Hill */
00908 #define RT_GET_DIRECTORY(_p,_res)    {BU_GETSTRUCT(_p, directory); \
00909         (_p)->d_magic = RT_DIR_MAGIC; \
00910         BU_LIST_INIT( &((_p)->d_use_hd) ); }
00911 #endif
00912 
00913 
00914 
00915 /**
00916  *                      R T _ C O M B _ I N T E R N A L
00917  *
00918  *  In-memory format for database "combination" record (non-leaf node).
00919  *  (Regions and Groups are both a kind of Combination).
00920  *  Perhaps move to wdb.h or rtgeom.h?
00921  */
00922 struct rt_comb_internal  {
00923         long            magic;
00924         union tree      *tree;          /**< @brief Leading to tree_db_leaf leaves */
00925         char            region_flag;    /**< @brief !0 ==> this COMB is a REGION */
00926         char            is_fastgen;     /**< @brief REGION_NON_FASTGEN/_PLATE/_VOLUME */
00927         /* Begin GIFT compatability */
00928         int             region_id;
00929         int             aircode;
00930         int             GIFTmater;
00931         int             los;
00932         /* End GIFT compatability */
00933         char            rgb_valid;      /**< @brief !0 ==> rgb[] has valid color */
00934         unsigned char   rgb[3];
00935         float           temperature;    /**< @brief > 0 ==> region temperature */
00936         struct bu_vls   shader;
00937         struct bu_vls   material;
00938         char            inherit;
00939 };
00940 #define RT_COMB_MAGIC   0x436f6d49      /**< @brief "ComI" */
00941 #define RT_CHECK_COMB(_p)               BU_CKMAG( _p , RT_COMB_MAGIC , "rt_comb_internal" )
00942 #define RT_CK_COMB(_p)                  RT_CHECK_COMB(_p)
00943 #define RT_CHECK_COMB_TCL(_interp,_p)   BU_CKMAG_TCL(interp,_p,RT_COMB_MAGIC, "rt_comb_internal" )
00944 #define RT_CK_COMB_TCL(_interp,_p)      RT_CHECK_COMB_TCL(_interp,_p)
00945 
00946 /**
00947  *                      R T _ B I N U N I F _ I N T E R N A L
00948  *
00949  *  In-memory format for database uniform-array binary object.
00950  *  Perhaps move to wdb.h or rtgeom.h?
00951  */
00952 struct rt_binunif_internal {
00953         long            magic;
00954         int             type;
00955         long            count;
00956         union           {
00957                             float               *flt;
00958                             double              *dbl;
00959                             char                *int8;
00960                             short               *int16;
00961                             int                 *int32;
00962                             long                *int64;
00963                             unsigned char       *uint8;
00964                             unsigned short      *uint16;
00965                             unsigned int        *uint32;
00966                             unsigned long       *uint64;
00967         }               u;
00968 };
00969 #define RT_BINUNIF_INTERNAL_MAGIC       0x42696e55      /* "BinU" */
00970 #define RT_CHECK_BINUNIF(_p)            BU_CKMAG( _p , RT_BINUNIF_INTERNAL_MAGIC , "rt_binunif_internal" )
00971 #define RT_CK_BINUNIF(_p)               RT_CHECK_BINUNIF(_p)
00972 #define RT_CHECK_BINUNIF_TCL(_interp,_p)        BU_CKMAG_TCL(interp,_p,RT_BINUNIF_MAGIC, "rt_binunif_internal" )
00973 #define RT_CK_BINUNIF_TCL(_interp,_p)   RT_CHECK_BINUNIF_TCL(_interp,_p)
00974 
00975 /**
00976  *                      D B _ T R E E _ S T A T E
00977  *
00978  *  State for database tree walker db_walk_tree()
00979  *  and related user-provided handler routines.
00980  */
00981 struct db_tree_state {
00982         long            magic;
00983         struct db_i     *ts_dbip;
00984         int             ts_sofar;               /**< @brief Flag bits */
00985 
00986         int             ts_regionid;    /**< @brief GIFT compat region ID code*/
00987         int             ts_aircode;     /**< @brief GIFT compat air code */
00988         int             ts_gmater;      /**< @brief GIFT compat material code */
00989         int             ts_los;         /**< @brief equivalent LOS estimate .. */
00990         struct mater_info ts_mater;     /**< @brief material properties */
00991 
00992                         /* XXX ts_mat should be a matrix pointer, not a matrix */
00993         mat_t           ts_mat;         /**< @brief transform matrix */
00994         int             ts_is_fastgen;  /**< @brief REGION_NON_FASTGEN/_PLATE/_VOLUME */
00995         struct bu_attribute_value_set   ts_attrs;       /**< @brief attribute/value structure */
00996 
00997         int             ts_stop_at_regions;     /**< @brief else stop at solids */
00998         int             (*ts_region_start_func) BU_ARGS((
00999                                 struct db_tree_state * /**< @brief tsp*/,
01000                                 struct db_full_path * /**< @brief pathp*/,
01001                                 const struct rt_comb_internal * /**< @brief combp */,
01002                                 genptr_t client_data
01003                         ));
01004         union tree *    (*ts_region_end_func) BU_ARGS((
01005                                 struct db_tree_state * /**< @brief tsp*/,
01006                                 struct db_full_path * /**< @brief pathp*/,
01007                                 union tree * /**< @brief curtree*/,
01008                                 genptr_t client_data
01009                         ));
01010         union tree *    (*ts_leaf_func) BU_ARGS((
01011                                 struct db_tree_state * /**< @brief tsp*/,
01012                                 struct db_full_path * /**< @brief pathp*/,
01013                                 struct rt_db_internal * /**< @brief ip*/,
01014                                 genptr_t client_data
01015                         ));
01016         const struct rt_tess_tol *ts_ttol;      /**< @brief  Tessellation tolerance */
01017         const struct bn_tol     *ts_tol;        /**< @brief  Math tolerance */
01018         struct model            **ts_m;         /**< @brief  ptr to ptr to NMG "model" */
01019         struct rt_i             *ts_rtip;       /**< @brief  Helper for rt_gettrees() */
01020         struct resource         *ts_resp;       /**< @brief  Per-CPU data */
01021 };
01022 #define TS_SOFAR_MINUS  1               /**< @brief  Subtraction encountered above */
01023 #define TS_SOFAR_INTER  2               /**< @brief  Intersection encountered above */
01024 #define TS_SOFAR_REGION 4               /**< @brief  Region encountered above */
01025 
01026 #define RT_DBTS_MAGIC   0x64627473      /**< @brief  "dbts" */
01027 #define RT_CK_DBTS(_p)  BU_CKMAG(_p, RT_DBTS_MAGIC, "db_tree_state")
01028 
01029 /**
01030  *                          D B _ T R A V E R S E
01031  *
01032  *  State for database traversal functions.
01033  */
01034 struct db_traverse
01035 {
01036         long    magic;
01037         struct db_i     *dbip;
01038         void    (*comb_enter_func) (
01039                         struct db_i *, 
01040                         struct directory *, 
01041                         genptr_t);
01042         void    (*comb_exit_func) (
01043                         struct db_i *, 
01044                         struct directory *, 
01045                         genptr_t);
01046         void    (*leaf_func) (
01047                         struct db_i *, 
01048                         struct directory *, 
01049                         genptr_t);
01050         struct resource *resp;
01051         genptr_t        client_data;
01052 };
01053 #define RT_DBTR_MAGIC 0x64627472  /**< @brief  "dbtr" */
01054 #define RT_INIT_DBTR(_p) {(_p)->magic = RT_DBTR_MAGIC; \
01055         (_p)->dbip = GENPTR_NULL; (_p)->comb_enter_func = GENPTR_NULL; \
01056         (_p)->comb_exit_func = GENPTR_NULL; (_p)->leaf_func = GENPTR_NULL; \
01057         (_p)->resp = GENPTR_NULL; (_p)->client_data = GENPTR_NULL;}
01058 #define RT_CK_DBTR(_p) BU_CKMAG(_p, RT_DBTR_MAGIC, "db_traverse")
01059 
01060 /**
01061  *                      C O M B I N E D _ T R E E _ S T A T E
01062  */
01063 struct combined_tree_state {
01064         long                    magic;
01065         struct db_tree_state    cts_s;
01066         struct db_full_path     cts_p;
01067 };
01068 #define RT_CTS_MAGIC    0x98989123
01069 #define RT_CK_CTS(_p)   BU_CKMAG(_p, RT_CTS_MAGIC, "combined_tree_state")
01070 
01071 /*
01072  *                      T R E E
01073  *
01074  *  Binary trees representing the Boolean operations between solids.
01075  */
01076 #define MKOP(x)         (x)
01077 
01078 #define OP_SOLID        MKOP(1)         /**< @brief  Leaf:  tr_stp -> solid */
01079 #define OP_UNION        MKOP(2)         /**< @brief  Binary: L union R */
01080 #define OP_INTERSECT    MKOP(3)         /**< @brief  Binary: L intersect R */
01081 #define OP_SUBTRACT     MKOP(4)         /**< @brief  Binary: L subtract R */
01082 #define OP_XOR          MKOP(5)         /**< @brief  Binary: L xor R, not both*/
01083 #define OP_REGION       MKOP(6)         /**< @brief  Leaf: tr_stp -> combined_tree_state */
01084 #define OP_NOP          MKOP(7)         /**< @brief  Leaf with no effect */
01085 /* Internal to library routines */
01086 #define OP_NOT          MKOP(8)         /**< @brief  Unary:  not L */
01087 #define OP_GUARD        MKOP(9)         /**< @brief  Unary:  not L, or else! */
01088 #define OP_XNOP         MKOP(10)        /**< @brief  Unary:  L, mark region */
01089 #define OP_NMG_TESS     MKOP(11)        /**< @brief  Leaf: tr_stp -> nmgregion */
01090 /* LIBWDB import/export interface to combinations */
01091 #define OP_DB_LEAF      MKOP(12)        /**< @brief  Leaf of combination, db fmt */
01092 #define OP_FREE         MKOP(13)        /**< @brief  Unary:  L has free chain */
01093 
01094 union tree {
01095         long    magic;                          /**< @brief  First word: magic number */
01096         /* Second word is always OP code */
01097         struct tree_node {
01098                 long            magic;
01099                 int             tb_op;          /**< @brief  non-leaf */
01100                 struct region   *tb_regionp;    /**< @brief  ptr to containing region */
01101                 union tree      *tb_left;
01102                 union tree      *tb_right;
01103         } tr_b;
01104         struct tree_leaf {
01105                 long            magic;
01106                 int             tu_op;          /**< @brief  leaf, OP_SOLID */
01107                 struct region   *tu_regionp;    /**< @brief  ptr to containing region */
01108                 struct soltab   *tu_stp;
01109         } tr_a;
01110         struct tree_cts {
01111                 long            magic;
01112                 int             tc_op;          /**< @brief  leaf, OP_REGION */
01113                 struct region   *tc_pad;        /**< @brief  unused */
01114                 struct combined_tree_state      *tc_ctsp;
01115         } tr_c;
01116         struct tree_nmgregion {
01117                 long            magic;
01118                 int             td_op;          /**< @brief  leaf, OP_NMG_TESS */
01119                 const char      *td_name;       /**< @brief  If non-null, dynamic string describing heritage of this region */
01120                 struct nmgregion *td_r;         /**< @brief  ptr to NMG region */
01121         } tr_d;
01122         struct tree_db_leaf  {
01123                 long            magic;
01124                 int             tl_op;          /**< @brief  leaf, OP_DB_LEAF */
01125                 matp_t          tl_mat;         /**< @brief  xform matp, NULL ==> identity */
01126                 char            *tl_name;       /**< @brief  Name of this leaf (bu_strdup'ed) */
01127         } tr_l;
01128 };
01129 /* Things which are in the same place in both A & B structures */
01130 #define tr_op           tr_a.tu_op
01131 #define tr_regionp      tr_a.tu_regionp
01132 
01133 #define TREE_NULL       ((union tree *)0)
01134 #define RT_TREE_MAGIC   0x91191191
01135 #define RT_CK_TREE(_p)  BU_CKMAG(_p, RT_TREE_MAGIC, "union tree")
01136 
01137 
01138 /**             R T _ T R E E _ A R R A Y
01139  *
01140  *      flattened version of the union tree
01141  */
01142 struct rt_tree_array
01143 {
01144         union tree      *tl_tree;
01145         int             tl_op;
01146 };
01147 
01148 #define TREE_LIST_NULL  ((struct tree_list *)0)
01149 
01150 /* Some dubious defines, to support the wdb_obj.c evolution */
01151 #define RT_MAXARGS              9000
01152 #define RT_MAXLINE              10240
01153 
01154 /**
01155  *                      R T _ W D B
01156  *
01157  *  This data structure is at the core of the "LIBWDB" support for
01158  *  allowing application programs to read and write BRL-CAD databases.
01159  *  Many different access styles are supported.
01160  */
01161 
01162 struct rt_wdb  {
01163         struct bu_list  l;
01164         int             type;
01165         struct db_i     *dbip;
01166         struct bu_vls   wdb_name;       /**< @brief  database object name */
01167         struct db_tree_state    wdb_initial_tree_state;
01168         struct rt_tess_tol      wdb_ttol;
01169         struct bn_tol           wdb_tol;
01170         struct resource         *wdb_resp;
01171 
01172         /* variables for name prefixing */
01173         struct bu_vls   wdb_prestr;
01174         int             wdb_ncharadd;
01175         int             wdb_num_dups;
01176 
01177         /* default region ident codes for this particular database. */
01178         int             wdb_item_default;/**< @brief  GIFT region ID */
01179         int             wdb_air_default;
01180         int             wdb_mat_default;/**< @brief  GIFT material code */
01181         int             wdb_los_default;/**< @brief  Line-of-sight estimate */
01182         struct bu_observer      wdb_observers;
01183         Tcl_Interp      *wdb_interp;
01184 };
01185 
01186 #define RT_WDB_MAGIC                    0x5f576462
01187 #define RT_CHECK_WDB(_p)                BU_CKMAG(_p,RT_WDB_MAGIC,"rt_wdb")
01188 #define RT_CHECK_WDB_TCL(_interp,_p)    BU_CKMAG_TCL(_interp,_p,RT_WDB_MAGIC,"rt_wdb")
01189 #define RT_CK_WDB(_p)                   RT_CHECK_WDB(_p)
01190 #define RT_CK_WDB_TCL(_interp,_p)       RT_CHECK_WDB_TCL(_interp,_p)
01191 #define RT_WDB_NULL             ((struct rt_wdb *)NULL)
01192 #define RT_WDB_TYPE_DB_DISK                     2
01193 #define RT_WDB_TYPE_DB_DISK_APPEND_ONLY         3
01194 #define RT_WDB_TYPE_DB_INMEM                    4
01195 #define RT_WDB_TYPE_DB_INMEM_APPEND_ONLY        5
01196 
01197 RT_EXPORT extern struct rt_wdb HeadWDB;         /**< @brief  head of BRL-CAD database object list */
01198 
01199 /*
01200  * Carl's vdraw stuff.
01201  */
01202 #define RT_VDRW_PREFIX          "_VDRW"
01203 #define RT_VDRW_PREFIX_LEN      6
01204 #define RT_VDRW_MAXNAME 31
01205 #define RT_VDRW_DEF_COLOR       0xffff00
01206 struct vd_curve {
01207         struct bu_list  l;
01208         char            vdc_name[RT_VDRW_MAXNAME+1];    /**< @brief  name array */
01209         long            vdc_rgb;        /**< @brief  color */
01210         struct bu_list  vdc_vhd;        /**< @brief  head of list of vertices */
01211 };
01212 #define VD_CURVE_NULL           ((struct vd_curve *)NULL)
01213 
01214 /**
01215  * Used to keep track of forked rt's for possible future aborts.
01216  * Currently used in mged/rtif.c and librt/dg_obj.c
01217  */
01218 struct run_rt {
01219         struct bu_list          l;
01220 #ifdef _WIN32
01221         HANDLE                  fd;
01222         HANDLE                  hProcess;
01223         DWORD                   pid;
01224 
01225 #ifdef TCL_OK
01226         Tcl_Channel             chan;
01227 #else
01228         genptr_t chan;
01229 #endif
01230 #else
01231         int                     fd;
01232         int                     pid;
01233 #endif
01234         int                     aborted;
01235 };
01236 
01237 /*
01238  *                      D G _ O B J
01239  *
01240  * A drawable geometry object is associated with a database object
01241  * and is used to maintain lists of geometry that are ready for display.
01242  * This geometry can come from a Brl-Cad database or from vdraw commands.
01243  * The drawable geometry object is also capabable of raytracing geometry
01244  * that comes from a Brl-Cad database.
01245  */
01246 struct dg_qray_color {
01247   unsigned char r;
01248   unsigned char g;
01249   unsigned char b;
01250 };
01251 
01252 struct dg_qray_fmt {
01253   char type;
01254   struct bu_vls fmt;
01255 };
01256 
01257 struct dg_obj {
01258         struct bu_list  l;
01259         struct bu_vls           dgo_name;       /**< @brief  drawable geometry object name */
01260         struct rt_wdb           *dgo_wdbp;      /**< @brief  associated database */
01261         struct bu_list          dgo_headSolid;  /**< @brief  head of solid list */
01262         struct bu_list          dgo_headVDraw;  /**< @brief  head of vdraw list */
01263         struct vd_curve         *dgo_currVHead; /**< @brief  current vdraw head */
01264         struct solid            *dgo_freeSolids; /**< @brief  ptr to head of free solid list */
01265         char                    *dgo_rt_cmd[RT_MAXARGS];
01266         int                     dgo_rt_cmd_len;
01267         struct bu_observer      dgo_observers;
01268         struct run_rt           dgo_headRunRt;  /**< @brief  head of forked rt processes */
01269         struct bu_vls           dgo_qray_basename;      /**< @brief  basename of query ray vlist */
01270         struct bu_vls           dgo_qray_script;        /**< @brief  query ray script */
01271         char                    dgo_qray_effects;       /**< @brief  t for text, g for graphics or b for both */
01272         int                     dgo_qray_cmd_echo;      /**< @brief  0 - don't echo command, 1 - echo command */
01273         struct dg_qray_fmt      *dgo_qray_fmts;
01274         struct dg_qray_color    dgo_qray_odd_color;
01275         struct dg_qray_color    dgo_qray_even_color;
01276         struct dg_qray_color    dgo_qray_void_color;
01277         struct dg_qray_color    dgo_qray_overlap_color;
01278         int                     dgo_shaded_mode;        /**< @brief  1 - draw bots shaded by default */
01279         char                    *dgo_outputHandler;     /**< @brief  tcl script for handling output */
01280         int                     dgo_uplotOutputMode;    /**< @brief  output mode for unix plots */
01281 };
01282 RT_EXPORT extern struct dg_obj HeadDGObj;               /**< @brief  head of drawable geometry object list */
01283 #define RT_DGO_NULL             ((struct dg_obj *)NULL)
01284 
01285 /**
01286  *                      V I E W _ O B J
01287  *
01288  * A view object maintains state for controlling a view.
01289  */
01290 struct view_obj {
01291         struct bu_list  l;
01292         struct bu_vls           vo_name;                /**< @brief  view object name/cmd */
01293         fastf_t                 vo_scale;
01294         fastf_t                 vo_size;                /**< @brief  2.0 * scale */
01295         fastf_t                 vo_invSize;             /**< @brief  1.0 / size */
01296         fastf_t                 vo_perspective;         /**< @brief  perspective angle */
01297         fastf_t                 vo_local2base;          /**< @brief  scale local units to base units (i.e. mm) */
01298         fastf_t                 vo_base2local;          /**< @brief  scale base units (i.e. mm) to local units */
01299         vect_t                  vo_aet;
01300         vect_t                  vo_eye_pos;             /**< @brief  eye position */
01301         vect_t                  vo_keypoint;
01302         char                    vo_coord;               /**< @brief  coordinate system */
01303         char                    vo_rotate_about;        /**< @brief  indicates what point rotations are about */
01304         mat_t                   vo_rotation;
01305         mat_t                   vo_center;
01306         mat_t                   vo_model2view;
01307         mat_t                   vo_pmodel2view;
01308         mat_t                   vo_view2model;
01309         mat_t                   vo_pmat;                /**< @brief  perspective matrix */
01310         struct bu_observer      vo_observers;
01311         void                    (*vo_callback)();       /**< @brief  called in vo_update with vo_clientData and vop */
01312         genptr_t                vo_clientData;          /**< @brief  passed to vo_callback */
01313         int                     vo_zclip;
01314 };
01315 RT_EXPORT extern struct view_obj HeadViewObj;           /**< @brief  head of view object list */
01316 #define RT_VIEW_OBJ_NULL                ((struct view_obj *)NULL)
01317 #define RT_MINVIEWSIZE 0.0001
01318 #define RT_MINVIEWSCALE 0.00005
01319 
01320 /**
01321  *                      A N I M A T E
01322  *
01323  *  Each one of these structures specifies an arc in the tree that
01324  *  is to be operated on for animation purposes.  More than one
01325  *  animation operation may be applied at any given arc.  The directory
01326  *  structure points to a linked list of animate structures
01327  *  (built by rt_anim_add()), and the operations are processed in the
01328  *  order given.
01329  */
01330 struct anim_mat {
01331         int             anm_op;                 /**< @brief  ANM_RSTACK, ANM_RARC... */
01332         mat_t           anm_mat;                /**< @brief  Matrix */
01333 };
01334 #define ANM_RSTACK      1                       /**< @brief  Replace stacked matrix */
01335 #define ANM_RARC        2                       /**< @brief  Replace arc matrix */
01336 #define ANM_LMUL        3                       /**< @brief  Left (root side) mul */
01337 #define ANM_RMUL        4                       /**< @brief  Right (leaf side) mul */
01338 #define ANM_RBOTH       5                       /**< @brief  Replace stack, arc=Idn */
01339 
01340 struct rt_anim_property {
01341         long            magic;
01342         int             anp_op;                 /**< @brief  RT_ANP_REPLACE, etc */
01343         struct bu_vls   anp_shader;             /**< @brief  Update string */
01344 };
01345 #define RT_ANP_REPLACE  1                       /**< @brief  Replace shader string */
01346 #define RT_ANP_APPEND   2                       /**< @brief  Append to shader string */
01347 #define RT_ANP_MAGIC    0x41507270              /**< @brief  'APrp' */
01348 #define RT_CK_ANP(_p)   BU_CKMAG((_p), RT_ANP_MAGIC, "rt_anim_property")
01349 
01350 struct rt_anim_color {
01351         int             anc_rgb[3];             /**< @brief  New color */
01352 };
01353 
01354 struct animate {
01355         long            magic;                  /**< @brief  magic number */
01356         struct animate  *an_forw;               /**< @brief  forward link */
01357         struct db_full_path an_path;            /**< @brief  (sub)-path pattern */
01358         int             an_type;                /**< @brief  AN_MATRIX, AN_COLOR... */
01359         union animate_specific {
01360                 struct anim_mat         anu_m;
01361                 struct rt_anim_property anu_p;
01362                 struct rt_anim_color    anu_c;
01363                 float                   anu_t;
01364         }               an_u;
01365 };
01366 #define RT_AN_MATRIX    1                       /**< @brief  Matrix animation */
01367 #define RT_AN_MATERIAL  2                       /**< @brief  Material property anim */
01368 #define RT_AN_COLOR     3                       /**< @brief  Material color anim */
01369 #define RT_AN_SOLID     4                       /**< @brief  Solid parameter anim */
01370 #define RT_AN_TEMPERATURE 5                     /**< @brief  Region temperature */
01371 
01372 #define ANIM_NULL       ((struct animate *)0)
01373 #define ANIMATE_MAGIC   0x414e4963              /* 1095649635 */
01374 #define RT_CK_ANIMATE(_p)       BU_CKMAG((_p), ANIMATE_MAGIC, "animate")
01375 
01376 /**
01377  *                      R T _ H T B L
01378  *
01379  *  Support for variable length arrays of "struct hit".
01380  *  Patterned after the libbu/ptbl.c idea.
01381  */
01382 struct rt_htbl {
01383         struct bu_list  l;      /**< @brief  linked list for caller's use */
01384         int             end;    /**< @brief  index of first available location */
01385         int             blen;   /**< @brief  # of struct's of storage at *hits */
01386         struct hit      *hits;  /**< @brief  hits[blen] data storage area */
01387 };
01388 #define RT_HTBL_MAGIC           0x6874626c              /**< @brief  "htbl" */
01389 #define RT_CK_HTBL(_p)          BU_CKMAG(_p, RT_HTBL_MAGIC, "rt_htbl")
01390 
01391 /**
01392  *                      R T _ P I E C E S T A T E
01393  *
01394  *  Holds onto memory re-used by rt_shootray() from shot to shot.
01395  *  One of these for each solid which uses pieces.
01396  *  There is a separate array of these for each cpu.
01397  *  Storage for the bit vectors is pre-allocated at prep time.
01398  *  The array is subscripted by st_piecestate_num.
01399  *  The bit vector is subscripted by values found in rt_piecelist pieces[].
01400  */
01401 struct rt_piecestate  {
01402         long            magic;
01403         long            ray_seqno;      /**< @brief  res_nshootray */
01404         struct soltab   *stp;
01405         struct bu_bitv  *shot;
01406         fastf_t         mindist;        /**< @brief  dist ray enters solids bounding volume */
01407         fastf_t         maxdist;        /**< @brief  dist ray leaves solids bounding volume */
01408         struct rt_htbl  htab;           /**< @brief  accumulating hits here */
01409         const union cutter *cutp;               /**< @brief  current bounding volume */
01410 };
01411 #define RT_PIECESTATE_MAGIC     0x70637374      /**< @brief  pcst */
01412 #define RT_CK_PIECESTATE(_p)    BU_CKMAG(_p, RT_PIECESTATE_MAGIC, "struct rt_piecestate")
01413 
01414 /**
01415  *                      R T _ P I E C E L I S T
01416  *
01417  *  For each space partitioning cell,
01418  *  there is one of these for each solid in that cell which uses pieces.
01419  *  Storage for the array is allocated at cut time, and never changes.
01420  *
01421  *  It is expected that the indices allocated by any solid range from
01422  *  0..(npieces-1).
01423  *
01424  *  The piece indices are used as a subscript into a solid-specific table,
01425  *  and also into the 'shot' bitv of the corresponding rt_piecestate.
01426  *
01427  *  The values (subscripts) in pieces[] are specific to a single solid (stp).
01428  */
01429 struct rt_piecelist  {
01430         long            magic;
01431         long            npieces;        /**< @brief  number of pieces in pieces[] array */
01432         long            *pieces;        /**< @brief  pieces[npieces], piece indices */
01433         struct soltab   *stp;           /**< @brief  ref back to solid */
01434 };
01435 #define RT_PIECELIST_MAGIC      0x70636c73      /**< @brief  pcls */
01436 #define RT_CK_PIECELIST(_p)     BU_CKMAG(_p, RT_PIECELIST_MAGIC, "struct rt_piecelist")
01437 
01438 /* Used to set globals declared in g_bot.c */
01439 #define RT_DEFAULT_MINPIECES            32
01440 #define RT_DEFAULT_TRIS_PER_PIECE       4
01441 
01442 /**
01443  *                      R E S O U R C E
01444  *
01445  *  Per-CPU statistics and resources.
01446  *
01447  *  One of these structures is allocated per processor.
01448  *  To prevent excessive competition for free structures,
01449  *  memory is now allocated on a per-processor basis.
01450  *  The application structure a_resource element specifies
01451  *  the resource structure to be used;  if uniprocessing,
01452  *  a null a_resource pointer results in using the internal global
01453  *  structure (&rt_uniresource),
01454  *  making initial application development simpler.
01455  *
01456  *  Applications are responsible for calling rt_init_resource()
01457  *  for each resource structure before letting LIBRT use them.
01458  *
01459  *  Note that if multiple models are being used, the partition and bitv
01460  *  structures (which are variable length) will require there to be
01461  *  ncpus * nmodels resource structures, the selection of which will
01462  *  be the responsibility of the application.
01463  *
01464  *  Per-processor statistics are initially collected in here,
01465  *  and then posted to rt_i by rt_add_res_stats().
01466  */
01467 struct resource {
01468         long            re_magic;       /**< @brief  Magic number */
01469         int             re_cpu;         /**< @brief  processor number, for ID */
01470         struct bu_list  re_seg;         /**< @brief  Head of segment freelist */
01471         struct bu_ptbl  re_seg_blocks;  /**< @brief  Table of malloc'ed blocks of segs */
01472         long            re_seglen;
01473         long            re_segget;
01474         long            re_segfree;
01475         struct bu_list  re_parthead;    /**< @brief  Head of freelist */
01476         long            re_partlen;
01477         long            re_partget;
01478         long            re_partfree;
01479         struct bu_list  re_solid_bitv;  /**< @brief  head of freelist */
01480         struct bu_list  re_region_ptbl; /**< @brief  head of freelist */
01481         struct bu_list  re_nmgfree;     /**< @brief  head of NMG hitmiss freelist */
01482         union tree      **re_boolstack; /**< @brief  Stack for rt_booleval() */
01483         long            re_boolslen;    /**< @brief  # elements in re_boolstack[] */
01484         float           *re_randptr;    /**< @brief  ptr into random number table */
01485         /* Statistics.  Only for examination by rt_add_res_stats() */
01486         long            re_nshootray;   /**< @brief  Calls to rt_shootray() */
01487         long            re_nmiss_model; /**< @brief  Rays pruned by model RPP */
01488         /* Solid nshots = shot_hit + shot_miss */
01489         long            re_shots;       /**< @brief  # calls to ft_shot() */
01490         long            re_shot_hit;    /**< @brief  ft_shot() returned a miss */
01491         long            re_shot_miss;   /**< @brief  ft_shot() returned a hit */
01492         /* Optimizations.  Rays not shot at solids */
01493         long            re_prune_solrpp;/**< @brief  shot missed solid RPP, ft_shot skipped */
01494         long            re_ndup;        /**< @brief  ft_shot() calls skipped for already-ft_shot() solids */
01495         long            re_nempty_cells; /**< @brief  number of empty NUgrid cells passed through */
01496         /* Data for accelerating "pieces" of solids */
01497         struct rt_piecestate *re_pieces; /**< @brief  array [rti_nsolids_with_pieces] */
01498         long            re_piece_ndup;  /**< @brief  ft_piece_shot() calls skipped for already-ft_shot() solids */
01499         long            re_piece_shots; /**< @brief  # calls to ft_piece_shot() */
01500         long            re_piece_shot_hit;      /**< @brief  ft_piece_shot() returned a miss */
01501         long            re_piece_shot_miss;     /**< @brief  ft_piece_shot() returned a hit */
01502         struct bu_ptbl  re_pieces_pending; /**< @brief  pieces with an odd hit pending */
01503         /* Per-processor cache of tree unions, to accelerate "tops" and treewalk */
01504         union tree      *re_tree_hd;  /**< @brief  Head of free trees */
01505         long            re_tree_get;
01506         long            re_tree_malloc;
01507         long            re_tree_free;
01508         struct directory *re_directory_hd;
01509         struct bu_ptbl  re_directory_blocks;    /**< @brief  Table of malloc'ed blocks */
01510 };
01511 RT_EXPORT extern struct resource        rt_uniresource; /**< @brief  default.  Defined in librt/shoot.c */
01512 #define RESOURCE_NULL   ((struct resource *)0)
01513 #define RESOURCE_MAGIC  0x83651835
01514 #define RT_CK_RESOURCE(_p)      BU_CKMAG(_p, RESOURCE_MAGIC, "struct resource")
01515 
01516 /** More malloc-efficient replacement for BU_GETUNION(tp, tree) */
01517 #define RT_GET_TREE(_tp,_res)   { \
01518         if( ((_tp) = (_res)->re_tree_hd) != TREE_NULL )  { \
01519                 (_res)->re_tree_hd = (_tp)->tr_b.tb_left; \
01520                 (_tp)->tr_b.tb_left = TREE_NULL; \
01521                 (_res)->re_tree_get++; \
01522         } else { \
01523                 GETUNION( _tp, tree ); \
01524                 (_res)->re_tree_malloc++; \
01525         }\
01526         }
01527 #define RT_FREE_TREE(_tp,_res)  { \
01528                 (_tp)->tr_b.tb_left = (_res)->re_tree_hd; \
01529                 (_tp)->tr_b.tb_right = TREE_NULL; \
01530                 (_res)->re_tree_hd = (_tp); \
01531                 (_tp)->tr_b.tb_op = OP_FREE; \
01532                 (_res)->re_tree_free++; \
01533         }
01534 
01535 
01536 /**                     R T _ R E P R E P _ O B J _ L I S T
01537  *
01538  *      Structure used by the "reprep" routines
01539  */
01540 struct rt_reprep_obj_list {
01541         int ntopobjs;           /**< @brief  number of objects in the original call to gettrees */
01542         char **topobjs;         /**< @brief  list of the above object names */
01543         int nunprepped;         /**< @brief  number of objects to be unprepped and re-prepped */
01544         char **unprepped;       /**< @brief  list of the above objects */
01545         /* Above here must be filled in by application */
01546         /* Below here is used by dynamic geometry routines, should be zeroed by application before use */
01547         struct bu_ptbl paths;   /**< @brief  list of all paths from topobjs to unprepped objects */
01548         struct db_tree_state **tsp;     /**< @brief  tree state used by tree walker in "reprep" routines */
01549         struct bu_ptbl unprep_regions;  /**< @brief  list of region structures that will be "unprepped" */
01550         long old_nsolids;               /**< @brief  rtip->nsolids before unprep */
01551         long old_nregions;              /**< @brief  rtip->nregions before unprep */
01552         long nsolids_unprepped;         /**< @brief  number of soltab structures eliminated by unprep */
01553         long nregions_unprepped;        /**< @brief  number of region structures eliminated by unprep */
01554 };
01555 
01556 
01557 
01558 
01559 /**
01560  *                      P I X E L _ E X T
01561  *
01562  *  This structure is intended to descrbe the area and/or volume represented
01563  *  by a ray.  In the case of the "rt" program it represents the extent in
01564  *  model coordinates of the prism behind the pixel being rendered.
01565  *
01566  *  The r_pt values of the rays indicate the dimensions and location in model
01567  *  space of the ray origin (usually the pixel to be rendered).
01568  *  The r_dir vectors indicate the edges (and thus the shape) of the prism
01569  *  which is formed from the projection of the pixel into space.
01570  */
01571 #define CORNER_PTS 4
01572 struct pixel_ext {
01573         unsigned long   magic;
01574         struct xray     corner[CORNER_PTS];
01575 };
01576 /* This should have had an RT_ prefix */
01577 #define PIXEL_EXT_MAGIC 0x50787400      /* "Pxt" */
01578 #define BU_CK_PIXEL_EXT(_p)     BU_CKMAG(_p, PIXEL_EXT_MAGIC, "struct pixel_ext")
01579 
01580 /**
01581  *                      A P P L I C A T I O N
01582  *@brief
01583  *  This structure is the only parameter to rt_shootray().
01584  *  The entire structure should be zeroed (e.g. by memset(,0,) ) before it
01585  *  is used the first time.
01586  *
01587  *  When calling rt_shootray(), these fields are mandatory:
01588  *      - a_ray.r_pt    Starting point of ray to be fired
01589  *      - a_ray.r_dir   UNIT VECTOR with direction to fire in (dir cosines)
01590  *      - a_hit()               Routine to call when something is hit
01591  *      - a_miss()      Routine to call when ray misses everything
01592  *      - a_rt_i                Must be set to the value returned by rt_dirbuild().
01593  *
01594  *  In addition, these fields are used by the library.  If they are
01595  *  set to zero, default behavior will be used.
01596  *      - a_resource    Pointer to CPU-specific resources.  Multi-CPU only.
01597  *      - a_overlap()   DEPRECATED, set a_multioverlap() instead.
01598  *                      If non-null, this routine will be called to
01599  *                      handle overlap conditions.  See librt/bool.c
01600  *                      for calling sequence.
01601  *                      Return of 0 eliminates partition with overlap entirely
01602  *                      Return of !0 retains one partition in output
01603  *      - a_multioverlap() Called when two or more regions overlap in a partition.
01604  *                      Default behavior used if pointer not set.
01605  *                      See librt/bool.c for calling sequence.
01606  *      - a_level               Printed by librt on errors, but otherwise not used.
01607  *      - a_x           Printed by librt on errors, but otherwise not used.
01608  *      - a_y           Printed by librt on errors, but otherwise not used.
01609  *      - a_purpose     Printed by librt on errors, but otherwise not used.
01610  *      - a_rbeam               Used to compute beam coverage on geometry,
01611  *      - a_diverge     for spline subdivision & many UV mappings.
01612  *
01613  *  Note that rt_shootray() returns the (int) return of the a_hit()/a_miss()
01614  *  function called, as well as placing it in a_return.
01615  *  A future "multiple rays at a time" interface will only provide a_return.
01616  *
01617  *  Note that the organization of this structure, and the details of
01618  *  the non-mandatory elements are subject to change in every release.
01619  *  Therefore, rather than using compile-time structure
01620  *  initialization, you should create a zeroed-out structure, and then
01621  *  assign the intended values at runtime.  A zeroed structure can be
01622  *  obtained at compile time with "static struct application
01623  *  zero_ap;", or at run time by using "memset( (char *)ap, 0,
01624  *  sizeof(struct application) );" or bu_calloc( 1, sizeof(struct
01625  *  application), "application" ); While this practice may not work on
01626  *  machines where "all bits off" does not signify a floating point
01627  *  zero, BRL-CAD does not support any such machines, so this is a
01628  *  moot issue.
01629  */
01630 struct application  {
01631         long            a_magic;
01632         /* THESE ELEMENTS ARE MANDATORY */
01633         struct xray     a_ray;          /**< @brief  Actual ray to be shot */
01634         int             (*a_hit)BU_ARGS( (struct application *, struct partition *, struct seg *));     /**< @brief  called when shot hits model */
01635         int             (*a_miss)BU_ARGS( (struct application *));      /**< @brief  called when shot misses */
01636         int             a_onehit;       /**< @brief  flag to stop on first hit */
01637         fastf_t         a_ray_length;   /**< @brief  distance from ray start to end intersections */
01638         struct rt_i     *a_rt_i;        /**< @brief  this librt instance */
01639         int             a_zero1;        /**< @brief  must be zero (sanity check) */
01640         /* THESE ELEMENTS ARE USED BY THE LIBRARY, BUT MAY BE LEFT ZERO */
01641         struct resource *a_resource;    /**< @brief  dynamic memory resources */
01642         int             (*a_overlap)(); /**< @brief  DEPRECATED */
01643         void            (*a_multioverlap)BU_ARGS( (struct application *,        /**< @brief  called to resolve overlaps */
01644                                                    struct partition *,
01645                                                    struct bu_ptbl *,
01646                                                    struct partition *) );
01647         void            (*a_logoverlap)BU_ARGS( (struct application *,  /**< @brief  called to log overlaps */
01648                                                  const struct partition *,
01649                                                  const struct bu_ptbl *,
01650                                                  const struct partition *) );
01651         int             a_level;        /**< @brief  recursion level (for printing) */
01652         int             a_x;            /**< @brief  Screen X of ray, if applicable */
01653         int             a_y;            /**< @brief  Screen Y of ray, if applicable */
01654         char            *a_purpose;     /**< @brief  Debug string:  purpose of ray */
01655         fastf_t         a_rbeam;        /**< @brief  initial beam radius (mm) */
01656         fastf_t         a_diverge;      /**< @brief  slope of beam divergance/mm */
01657         int             a_return;       /**< @brief  Return of a_hit()/a_miss() */
01658         int             a_no_booleans;  /**< @brief  1= partitions==segs, no booleans */
01659         char            **attrs;        /**< @brief  null terminated list of attributes
01660                                          * This list should be the same as passed to
01661                                          * rt_gettrees_and_attrs() */
01662         /* THESE ELEMENTS ARE USED BY THE PROGRAM "rt" AND MAY BE USED BY */
01663         /* THE LIBRARY AT SOME FUTURE DATE */
01664         /* AT THIS TIME THEY MAY BE LEFT ZERO */
01665         struct pixel_ext *a_pixelext;   /**< @brief  locations of pixel corners */
01666         /* THESE ELEMENTS ARE WRITTEN BY THE LIBRARY, AND MAY BE READ IN a_hit() */
01667         struct seg      *a_finished_segs_hdp;
01668         struct partition *a_Final_Part_hdp;
01669         vect_t          a_inv_dir;      /**< @brief  filled in by rt_shootray(), inverse of ray direction cosines */
01670         /* THE FOLLOWING ELEMENTS ARE MAINLINE & APPLICATION SPECIFIC. */
01671         /* THEY ARE NEVER EXAMINED BY THE LIBRARY. */
01672         int             a_user;         /**< @brief  application-specific value */
01673         genptr_t        a_uptr;         /**< @brief  application-specific pointer */
01674         struct bn_tabdata *a_spectrum;  /**< @brief  application-specific bn_tabdata prointer */
01675         fastf_t         a_color[3];     /**< @brief  application-specific color */
01676         fastf_t         a_dist;         /**< @brief  application-specific distance */
01677         vect_t          a_uvec;         /**< @brief  application-specific vector */
01678         vect_t          a_vvec;         /**< @brief  application-specific vector */
01679         fastf_t         a_refrac_index; /**< @brief  current index of refraction */
01680         fastf_t         a_cumlen;       /**< @brief  cumulative length of ray */
01681         int             a_flag;         /**< @brief  application-specific flag */
01682         int             a_zero2;        /**< @brief  must be zero (sanity check) */
01683 };
01684 #define RT_AFN_NULL     ((int (*)())0)
01685 #define RT_AP_MAGIC     0x4170706c      /**< @brief  "Appl" */
01686 #define RT_CK_AP(_p)    BU_CKMAG(_p,RT_AP_MAGIC,"struct application")
01687 #define RT_CK_APPLICATION(_p)   BU_CKMAG(_p,RT_AP_MAGIC,"struct application")
01688 #define RT_CK_AP_TCL(_interp,_p)        BU_CKMAG_TCL(_interp,_p,RT_AP_MAGIC,"struct application")
01689 #define RT_APPLICATION_INIT(_p) { \
01690                 memset( (char *)(_p), 0, sizeof(struct application) ); \
01691                 (_p)->a_magic = RT_AP_MAGIC; \
01692         }
01693 
01694 
01695 #ifdef NO_BOMBING_MACROS
01696 #  define RT_AP_CHECK(_ap)
01697 #else
01698 #  define RT_AP_CHECK(_ap)      \
01699         {if((_ap)->a_zero1||(_ap)->a_zero2) \
01700                 rt_bomb("corrupt application struct"); }
01701 #endif
01702 
01703 /**
01704  *                      R T _ G
01705  *
01706  *  Definitions for librt.a which are global to the library
01707  *  regardless of how many different models are being worked on
01708  */
01709 struct rt_g {
01710         int             debug;          /**< @brief  !0 for debug, see librt/debug.h */
01711         /* XXX rtg_parallel is not used by LIBRT any longer */
01712         int             rtg_parallel;   /**< @brief  !0 = trying to use multi CPUs */
01713         struct bu_list  rtg_vlfree;     /**< @brief  head of bn_vlist freelist */
01714         int             NMG_debug;      /**< @brief  debug bits for NMG's see nmg.h */
01715         struct rt_wdb   rtg_headwdb;    /**< @brief  head of database object list */
01716 };
01717 RT_EXPORT extern struct rt_g rt_g;
01718 
01719 /* Normally set when in production mode, setting the RT_G_DEBUG define to 0
01720  * will allow chucks of code to poof away at compile time (since they are
01721  * truth-functionally constant (false))  This can boost raytrace performance
01722  * considerably (~10%).
01723  */
01724 #ifdef NO_DEBUG_CHECKING
01725 #       define  RT_G_DEBUG      0
01726 #else
01727 #       define  RT_G_DEBUG      rt_g.debug
01728 #endif
01729 
01730 /**
01731  *                      S E M A P H O R E S
01732  *
01733  *  Definition of global parallel-processing semaphores.
01734  *
01735  * res_syscall is now   BU_SEM_SYSCALL
01736  */
01737 #define RT_SEM_TREE0    (BU_SEM_LAST)
01738 #define RT_SEM_TREE1    (RT_SEM_TREE0+1)
01739 #define RT_SEM_TREE2    (RT_SEM_TREE1+1)
01740 #define RT_SEM_TREE3    (RT_SEM_TREE2+1)
01741 #define RT_SEM_WORKER   (RT_SEM_TREE3+1)
01742 #define RT_SEM_STATS    (RT_SEM_WORKER+1)
01743 #define RT_SEM_RESULTS  (RT_SEM_STATS+1)
01744 #define RT_SEM_MODEL    (RT_SEM_RESULTS+1)
01745 
01746 #define RT_SEM_LAST     (RT_SEM_MODEL+1)        /**< @brief  Call bu_semaphore_init( RT_SEM_LAST ); */
01747 
01748 
01749 /**
01750  *                      R T _ I
01751  *
01752  *  Definitions for librt which are specific to the
01753  *  particular model being processed, one copy for each model.
01754  *  Initially, a pointer to this is returned from rt_dirbuild().
01755  *
01756  *  During gettree processing, the most time consuming step is
01757  *  searching the list of existing solids to see if a new solid is
01758  *  actually an identical instance of a previous solid.
01759  *  Therefore, the list has been divided into several lists.
01760  *  The same macros & hash value that accesses the dbi_Head[] array
01761  *  are used here.  The hash value is computed by db_dirhash().
01762  */
01763 struct rt_i {
01764         long            rti_magic;      /**< @brief  magic # for integrity check */
01765         /* THESE ITEMS ARE AVAILABLE FOR APPLICATIONS TO READ & MODIFY */
01766         int             useair;         /**< @brief  1="air" regions are retained while prepping */
01767         int             rti_save_overlaps; /**< @brief  1=fill in pt_overlap_reg, change boolweave behavior */
01768         int             rti_dont_instance; /**< @brief  1=Don't compress instances of solids into 1 while prepping */
01769         int             rti_hasty_prep; /**< @brief  1=hasty prep, slower ray-trace */
01770         int             rti_nlights;    /**< @brief  number of light sources */
01771         int             rti_prismtrace; /**< @brief  add support for pixel prism trace */
01772         char            *rti_region_fix_file; /**< @brief  rt_regionfix() file or NULL */
01773         int             rti_space_partition;  /**< @brief  space partitioning method */
01774         int             rti_nugrid_dimlimit;  /**< @brief  limit on nugrid dimensions */
01775         struct bn_tol   rti_tol;        /**< @brief  Math tolerances for this model */
01776         struct rt_tess_tol rti_ttol;    /**< @brief  Tessellation tolerance defaults */
01777         fastf_t         rti_max_beam_radius; /**< @brief  Max threat radius for FASTGEN cline solid */
01778         /* THESE ITEMS ARE AVAILABLE FOR APPLICATIONS TO READ */
01779         point_t         mdl_min;        /**< @brief  min corner of model bounding RPP */
01780         point_t         mdl_max;        /**< @brief  max corner of model bounding RPP */
01781         point_t         rti_pmin;       /**< @brief  for plotting, min RPP */
01782         point_t         rti_pmax;       /**< @brief  for plotting, max RPP */
01783         double          rti_radius;     /**< @brief  radius of model bounding sphere */
01784         struct db_i     *rti_dbip;      /**< @brief  prt to Database instance struct */
01785         /* THESE ITEMS SHOULD BE CONSIDERED OPAQUE, AND SUBJECT TO CHANGE */
01786         int             needprep;       /**< @brief  needs rt_prep */
01787         struct region   **Regions;      /**< @brief  ptrs to regions [reg_bit] */
01788         struct bu_list  HeadRegion;     /**< @brief  ptr of list of regions in model */
01789         genptr_t        Orca_hash_tbl;  /**< @brief  Hash table in matrices for ORCA */
01790         struct bu_ptbl  delete_regs;    /**< @brief  list of region pointers to delete after light_init() */
01791         /* Ray-tracing statistics */
01792         long            nregions;       /**< @brief  total # of regions participating */
01793         long            nsolids;        /**< @brief  total # of solids participating */
01794         long            rti_nrays;      /**< @brief  # calls to rt_shootray() */
01795         long            nmiss_model;    /**< @brief  rays missed model RPP */
01796         long            nshots;         /**< @brief  # of calls to ft_shot() */
01797         long            nmiss;          /**< @brief  solid ft_shot() returned a miss */
01798         long            nhits;          /**< @brief  solid ft_shot() returned a hit */
01799         long            nmiss_tree;     /**< @brief  shots missed sub-tree RPP */
01800         long            nmiss_solid;    /**< @brief  shots missed solid RPP */
01801         long            ndup;           /**< @brief  duplicate shots at a given solid */
01802         long            nempty_cells;   /**< @brief  number of empty NUgrid cells */
01803         union cutter    rti_CutHead;    /**< @brief  Head of cut tree */
01804         union cutter    rti_inf_box;    /**< @brief  List of infinite solids */
01805         union cutter    *rti_CutFree;   /**< @brief  cut Freelist */
01806         struct bu_ptbl  rti_busy_cutter_nodes; /**< @brief  List of "cutter" mallocs */
01807         struct bu_ptbl  rti_cuts_waiting;
01808         int             rti_cut_maxlen; /**< @brief  max len RPP list in 1 cut bin */
01809         int             rti_ncut_by_type[CUT_MAXIMUM+1];        /**< @brief  number of cuts by type */
01810         int             rti_cut_totobj; /**< @brief  # objs in all bins, total */
01811         int             rti_cut_maxdepth;/**< @brief  max depth of cut tree */
01812         struct soltab   **rti_sol_by_type[ID_MAX_SOLID+1];
01813         int             rti_nsol_by_type[ID_MAX_SOLID+1];
01814         int             rti_maxsol_by_type;
01815         int             rti_air_discards;/**< @brief  # of air regions discarded */
01816         struct bu_hist rti_hist_cellsize; /**< @brief  occupancy of cut cells */
01817         struct bu_hist rti_hist_cell_pieces; /**< @brief  solid pieces per cell */
01818         struct bu_hist rti_hist_cutdepth; /**< @brief  depth of cut tree */
01819         struct soltab   **rti_Solids;   /**< @brief  ptrs to soltab [st_bit] */
01820         struct bu_list  rti_solidheads[RT_DBNHASH]; /**< @brief  active solid lists */
01821         struct bu_ptbl  rti_resources;  /**< @brief  list of 'struct resource'es encountered */
01822         double          rti_nu_gfactor; /**< @brief  constant in numcells computation */
01823         int             rti_cutlen;     /**< @brief  goal for # solids per boxnode */
01824         int             rti_cutdepth;   /**< @brief  goal for depth of NUBSPT cut tree */
01825         /* Parameters required for rt_submodel */
01826         char            *rti_treetop;   /**< @brief  bu_strduped, for rt_submodel rti's only */
01827         int             rti_uses;       /**< @brief  for rt_submodel */
01828         /* Parameters for accelerating "pieces" of solids */
01829         int             rti_nsolids_with_pieces; /**< @brief  # solids using pieces */
01830         /* Parameters for dynamic geometry */
01831         int             rti_add_to_new_solids_list;
01832         struct bu_ptbl  rti_new_solids;
01833 };
01834 
01835 #define RT_NU_GFACTOR_DEFAULT   1.5      /**< @brief  see rt_cut_it() for a description
01836                                             of this */
01837 
01838 #define RTI_NULL        ((struct rt_i *)0)
01839 #define RTI_MAGIC       0x99101658      /**< @brief  magic # for integrity check */
01840 
01841 #define RT_CHECK_RTI(_p)                BU_CKMAG(_p,RTI_MAGIC,"struct rt_i")
01842 #define RT_CHECK_RTI_TCL(_interp,_p)    BU_CKMAG_TCL(_interp,_p,RTI_MAGIC,"struct rt_i")
01843 #define RT_CK_RTI(_p)                   RT_CHECK_RTI(_p)
01844 #define RT_CK_RTI_TCL(_interp,_p)       RT_CHECK_RTI_TCL(_interp,_p)
01845 
01846 #define RT_PART_NUBSPT  0
01847 #define RT_PART_NUGRID  1
01848 
01849 /**
01850  *  Macros to painlessly visit all the active solids.  Serving suggestion:
01851  *
01852  *      RT_VISIT_ALL_SOLTABS_START( stp, rtip )  {
01853  *              rt_pr_soltab( stp );
01854  *      } RT_VISIT_ALL_SOLTABS_END
01855  */
01856 #define RT_VISIT_ALL_SOLTABS_START(_s, _rti)    { \
01857         register struct bu_list *_head = &((_rti)->rti_solidheads[0]); \
01858         for( ; _head < &((_rti)->rti_solidheads[RT_DBNHASH]); _head++ ) \
01859                 for( BU_LIST_FOR( _s, soltab, _head ) )  {
01860 
01861 #define RT_VISIT_ALL_SOLTABS_END        } }
01862 
01863 /**
01864  *  Applications that are going to use RT_ADD_VLIST and RT_GET_VLIST
01865  *  are required to execute this macro once, first:
01866  *              BU_LIST_INIT( &rt_g.rtg_vlfree );
01867  *
01868  * Note that RT_GET_VLIST and RT_FREE_VLIST are non-PARALLEL.
01869  */
01870 #define RT_GET_VLIST(p)         BN_GET_VLIST(&rt_g.rtg_vlfree, p)
01871 
01872 /** Place an entire chain of bn_vlist structs on the freelist */
01873 #define RT_FREE_VLIST(hd)       BN_FREE_VLIST(&rt_g.rtg_vlfree, hd)
01874 
01875 #define RT_ADD_VLIST(hd,pnt,draw)  BN_ADD_VLIST(&rt_g.rtg_vlfree,hd,pnt,draw)
01876 
01877 
01878 
01879 /*
01880  *  Replacements for definitions from vmath.h
01881  */
01882 #undef V2PRINT
01883 #undef VPRINT
01884 #undef HPRINT
01885 #define V2PRINT(a,b)    bu_log("%s (%g, %g)\n", a, (b)[0], (b)[1] );
01886 #define VPRINT(a,b)     bu_log("%s (%g, %g, %g)\n", a, (b)[0], (b)[1], (b)[2])
01887 #define HPRINT(a,b)     bu_log("%s (%g, %g, %g, %g)\n", a, (b)[0], (b)[1], (b)[2], (b)[3])
01888 
01889 /**
01890  *                      C O M M A N D _ T A B
01891  *
01892  *  Table for driving generic command-parsing routines
01893  */
01894 struct command_tab {
01895         char    *ct_cmd;
01896         char    *ct_parms;
01897         char    *ct_comment;
01898         int     (*ct_func)();
01899         int     ct_min;         /**< @brief  min number of words in cmd */
01900         int     ct_max;         /**< @brief  max number of words in cmd */
01901 };
01902 
01903 /**
01904  *                      R T _ P O I N T _ L A B E L S
01905  *
01906  *  Used by MGED for labeling vertices of a solid.
01907  */
01908 struct rt_point_labels {
01909         char    str[8];
01910         point_t pt;
01911 };
01912 
01913 /**
01914  *                      R T _ P T _ N O D E
01915  *
01916  *  Used by g_rpc.c and others to contain forward-linked lists of points.
01917  */
01918 struct rt_pt_node {
01919         point_t                 p;      /**< @brief  a point */
01920         struct rt_pt_node       *next;  /**< @brief  ptr to next pt */
01921 };
01922 
01923 
01924 /**
01925  *                      L I N E _ S E G,  C A R C _ S E G,  N U R B _ S E G
01926  *      used by the sketch and solid of extrusion
01927  */
01928 
01929 struct line_seg         /**< @brief  line segment */
01930 {
01931         long                    magic;
01932         int                     start, end;     /**< @brief  indices into sketch's array of vertices */
01933 };
01934 #define CURVE_LSEG_MAGIC     0x6c736567         /**< @brief  lseg */
01935 
01936 struct carc_seg         /**< @brief  circular arc segment */
01937 {
01938         long                    magic;
01939         int                     start, end;     /**< @brief  indices */
01940         fastf_t                 radius;         /**< @brief  radius < 0.0 -> full circle with start point on
01941                                                  * circle and "end" at center */
01942         int                     center_is_left; /**< @brief  flag indicating where center of curvature is.
01943                                                  * If non-zero, then center is to left of vector
01944                                                  * from start to end */
01945         int                     orientation;    /**< @brief  0 -> ccw, !0 -> cw */
01946         int                     center;         /**< @brief  index of vertex at center of arc (only used by rt_extrude_prep and rt_extrude_shot) */
01947 };
01948 #define CURVE_CARC_MAGIC     0x63617263         /**< @brief  carc */
01949 
01950 struct nurb_seg         /**< @brief  NURB curve segment */
01951 {
01952         long                    magic;
01953         int                     order;          /**< @brief  order of NURB curve (degree - 1) */
01954         int                     pt_type;        /**< @brief  type of NURB curve */
01955         struct knot_vector      k;              /**< @brief  knot vector for NURB curve */
01956         int                     c_size;         /**< @brief  number of control points */
01957         int                     *ctl_points;    /**< @brief  array of indicies for control points */
01958         fastf_t                 *weights;       /**< @brief  array of weights for control points (NULL if non_rational) */
01959 };
01960 #define CURVE_NURB_MAGIC     0x6e757262         /**< @brief  nurb */
01961 
01962 struct bezier_seg       /**< @brief  Bezier curve segment */
01963 {
01964         long                    magic;
01965         int                     degree;         /**< @brief  degree of curve (number of control points - 1) */
01966         int                     *ctl_points;    /**< @brief  array of indices for control points */
01967 };
01968 #define CURVE_BEZIER_MAGIC      0x62657a69      /**< @brief  bezi */
01969 
01970 /**
01971  *                      R T _ F U N C T A B
01972  *
01973  *  Object-oriented interface to BRL-CAD geometry.
01974  *
01975  *  These are the methods for a notional object class "brlcad_solid".
01976  *  The data for each instance is found separately in struct soltab.
01977  *  This table is indexed by ID_xxx value of particular solid
01978  *  found in st_id, or directly pointed at by st_meth.
01979  *
01980  *  This needs to be at the end of the raytrace.h header file,
01981  *  so that all the structure names are known.
01982  *  The "union record" and "struct nmgregion" pointers are problematic,
01983  *  so generic pointers are used when those header files have not yet
01984  *  been seen.
01985  *
01986  *  XXX On SGI, can not use identifiers in prototypes inside structure!
01987  */
01988 struct rt_functab {
01989         long    magic;
01990         char    ft_name[16];
01991         char    ft_label[8];
01992         int     ft_use_rpp;
01993         int     (*ft_prep) BU_ARGS((struct soltab * /**< @brief stp*/,
01994                         struct rt_db_internal * /**< @brief ip*/,
01995                         struct rt_i * /**< @brief rtip*/ ));
01996         int     (*ft_shot) BU_ARGS((struct soltab * /**< @brief stp*/,
01997                         struct xray * /**< @brief rp*/,
01998                         struct application * /**< @brief ap*/,  /**< @brief  has resource */
01999                         struct seg * /**< @brief seghead*/ ));
02000         void    (*ft_print) BU_ARGS((const struct soltab * /**< @brief stp*/));
02001         void    (*ft_norm) BU_ARGS((struct hit * /**< @brief hitp*/,
02002                         struct soltab * /**< @brief stp*/,
02003                         struct xray * /**< @brief rp*/));
02004         int     (*ft_piece_shot) BU_ARGS((
02005                         struct rt_piecestate * /**< @brief psp*/,
02006                         struct rt_piecelist * /**< @brief plp*/,
02007                         double /**< @brief  dist_correction to apply to hit distances */,
02008                         struct xray * /**< @brief  ray transformed to be near cut cell */,
02009                         struct application * /**< @brief ap*/,  /**< @brief  has resource */
02010                         struct seg * /**< @brief seghead*/));   /**< @brief  used only for PLATE mode hits */
02011         void    (*ft_piece_hitsegs) BU_ARGS((
02012                         struct rt_piecestate * /**< @brief psp*/,
02013                         struct seg * /**< @brief seghead*/,
02014                         struct application * /**< @brief ap*/));        /**< @brief  has resource */
02015         void    (*ft_uv) BU_ARGS((struct application * /**< @brief ap*/,        /**< @brief  has resource */
02016                         struct soltab * /**< @brief stp*/,
02017                         struct hit * /**< @brief hitp*/,
02018                         struct uvcoord * /**< @brief uvp*/));
02019         void    (*ft_curve) BU_ARGS((struct curvature * /**< @brief cvp*/,
02020                         struct hit * /**< @brief hitp*/,
02021                         struct soltab * /**< @brief stp*/));
02022         int     (*ft_classify) BU_ARGS((
02023                         const struct soltab * /*stp*/,
02024                         const vect_t /*min*/,
02025                         const vect_t /*max*/,
02026                         const struct bn_tol * /*tol*/));
02027         void    (*ft_free) BU_ARGS((struct soltab * /*stp*/));
02028         int     (*ft_plot) BU_ARGS((
02029                         struct bu_list * /*vhead*/,
02030                         struct rt_db_internal * /*ip*/,
02031                         const struct rt_tess_tol * /*ttol*/,
02032                         const struct bn_tol * /*tol*/));
02033         void    (*ft_vshot) BU_ARGS((struct soltab * /*stp*/[],
02034                         struct xray *[] /*rp*/,
02035                         struct seg [] /*segp*/, int /*n*/,
02036                         struct application * /*ap*/ ));
02037         int     (*ft_tessellate) BU_ARGS((
02038                         struct nmgregion ** /*r*/,
02039                         struct model * /*m*/,
02040                         struct rt_db_internal * /*ip*/,
02041                         const struct rt_tess_tol * /*ttol*/,
02042                         const struct bn_tol * /*tol*/));
02043         int     (*ft_tnurb) BU_ARGS((
02044                         struct nmgregion ** /*r*/,
02045                         struct model * /*m*/,
02046                         struct rt_db_internal * /*ip*/,
02047                         const struct bn_tol * /*tol*/));
02048         int     (*ft_import5) BU_ARGS((struct rt_db_internal * /*ip*/,
02049                         const struct bu_external * /*ep*/,
02050                         const mat_t /*mat*/,
02051                         const struct db_i * /*dbip*/,
02052                         struct resource * /*resp*/,
02053                         const int minor_type));
02054         int     (*ft_export5) BU_ARGS((struct bu_external * /*ep*/,
02055                         const struct rt_db_internal * /*ip*/,
02056                         double /*local2mm*/,
02057                         const struct db_i * /*dbip*/,
02058                         struct resource * /*resp*/,
02059                         const int minor_type));
02060         int     (*ft_import) BU_ARGS((struct rt_db_internal * /*ip*/,
02061                         const struct bu_external * /*ep*/,
02062                         const mat_t /*mat*/,
02063                         const struct db_i * /*dbip*/,
02064                         struct resource * /*resp*/));
02065         int     (*ft_export) BU_ARGS((struct bu_external * /*ep*/,
02066                         const struct rt_db_internal * /*ip*/,
02067                         double /*local2mm*/,
02068                         const struct db_i * /*dbip*/,
02069                         struct resource * /*resp*/));
02070         void    (*ft_ifree) BU_ARGS((struct rt_db_internal * /*ip*/,
02071                         struct resource * /*resp*/));
02072         int     (*ft_describe) BU_ARGS((struct bu_vls * /*str*/,
02073                         const struct rt_db_internal * /*ip*/,
02074                         int /*verbose*/,
02075                         double /*mm2local*/,
02076                         struct resource * /*resp*/,
02077                         struct db_i *));
02078         int     (*ft_xform) BU_ARGS((struct rt_db_internal * /*op*/,
02079                         const mat_t /*mat*/, struct rt_db_internal * /*ip*/,
02080                         int /*free*/, struct db_i * /*dbip*/,
02081                         struct resource * /*resp*/));
02082         const struct bu_structparse *ft_parsetab;       /**< @brief  rt_xxx_parse */
02083         size_t  ft_internal_size;       /**< @brief  sizeof(struct rt_xxx_internal) */
02084         unsigned long   ft_internal_magic;      /**< @brief  RT_XXX_INTERNAL_MAGIC */
02085 #if defined(TCL_OK)
02086         int     (*ft_tclget) BU_ARGS((Tcl_Interp *,
02087                         const struct rt_db_internal *, const char *item));
02088         int     (*ft_tcladjust) BU_ARGS((Tcl_Interp *,
02089                         struct rt_db_internal *,
02090                         int /*argc*/, char ** /*argv*/,
02091                         struct resource * /*resp*/));
02092         int     (*ft_tclform) BU_ARGS((const struct rt_functab *,
02093                         Tcl_Interp *));
02094 #else
02095         int     (*ft_tclget) BU_ARGS((genptr_t /*interp*/,
02096                         const struct rt_db_internal *, const char *item));
02097         int     (*ft_tcladjust) BU_ARGS((genptr_t /*interp*/,
02098                         struct rt_db_internal *,
02099                         int /*argc*/, char ** /*argv*/,
02100                         struct resource * /*resp*/));
02101         int     (*ft_tclform) BU_ARGS((const struct rt_functab *,
02102                         genptr_t /*interp*/));
02103 #endif
02104         void    (*ft_make) BU_ARGS((const struct rt_functab *,
02105                         struct rt_db_internal *, double /*diameter*/));
02106 };
02107 RT_EXPORT extern const struct rt_functab rt_functab[];
02108 RT_EXPORT extern const int rt_nfunctab;
02109 #define RT_FUNCTAB_MAGIC                0x46754e63      /* FuNc */
02110 #define RT_CK_FUNCTAB(_p)       BU_CKMAG(_p, RT_FUNCTAB_MAGIC, "functab" );
02111 
02112 #define RT_CLASSIFY_UNIMPLEMENTED       BN_CLASSIFY_UNIMPLEMENTED
02113 #define RT_CLASSIFY_INSIDE              BN_CLASSIFY_INSIDE
02114 #define RT_CLASSIFY_OVERLAPPING         BN_CLASSIFY_OVERLAPPING
02115 #define RT_CLASSIFY_OUTSIDE             BN_CLASSIFY_OUTSIDE
02116 
02117 /**
02118  *                      R T _ S H O O T R A Y _ S T A T U S
02119  *
02120  *  Internal to shoot.c and bundle.c
02121  */
02122 struct rt_shootray_status {
02123         fastf_t                 dist_corr;      /**< @brief  correction distance */
02124         fastf_t                 odist_corr;
02125         fastf_t                 box_start;
02126         fastf_t                 obox_start;
02127         fastf_t                 box_end;
02128         fastf_t                 obox_end;
02129         fastf_t                 model_start;
02130         fastf_t                 model_end;
02131         struct xray             newray;         /**< @brief  closer ray start */
02132         struct application      *ap;
02133         struct resource         *resp;
02134         vect_t                  inv_dir;      /**< @brief  inverses of ap->a_ray.r_dir */
02135         vect_t                  abs_inv_dir;  /**< @brief  absolute values of inv_dir */
02136         int                     rstep[3];     /**< @brief  -/0/+ dir of ray in axis */
02137         const union cutter      *lastcut, *lastcell;
02138         const union cutter      *curcut;
02139         point_t                 curmin, curmax;
02140         int                     igrid[3];     /**< @brief  integer cell coordinates */
02141         vect_t                  tv;           /**< @brief  next t intercept values */
02142         int                     out_axis;     /**< @brief  axis ray will leave through */
02143         struct rt_shootray_status       *old_status;
02144         int                     box_num;        /**< @brief  which cell along ray */
02145 };
02146 
02147 #define NUGRID_T_SETUP(_ax,_cval,_cno) \
02148         if( ssp->rstep[_ax] > 0 ) { \
02149                 ssp->tv[_ax] = t0 + (nu_axis[_ax][_cno].nu_epos - _cval) * \
02150                                             ssp->inv_dir[_ax]; \
02151         } else if( ssp->rstep[_ax] < 0 ) { \
02152                 ssp->tv[_ax] = t0 + (nu_axis[_ax][_cno].nu_spos - _cval) * \
02153                                             ssp->inv_dir[_ax]; \
02154         } else { \
02155                 ssp->tv[_ax] = INFINITY; \
02156         }
02157 #define NUGRID_T_ADV(_ax,_cno) \
02158         if( ssp->rstep[_ax] != 0 )  { \
02159                 ssp->tv[_ax] += nu_axis[_ax][_cno].nu_width * \
02160                         ssp->abs_inv_dir[_ax]; \
02161         }
02162 
02163 #define BACKING_DIST    (-2.0)          /**< @brief  mm to look behind start point */
02164 #define OFFSET_DIST     0.01            /**< @brief  mm to advance point into box */
02165 
02166 /*********************************************************************************
02167  *      The following section is an exact copy of what was previously "nmg_rt.h" *
02168  *      (with minor changes to GET_HITMISS and NMG_FREE_HITLIST                  *
02169  *      moved here to use rt_g.rtg_nmgfree freelist for hitmiss structs.         *
02170  *********************************************************************************
02171  *                      N M G _ R T . H
02172  *
02173  *  @author
02174  *      Lee A. Butler
02175  *
02176  *  @par Source -
02177  *      The U. S. Army Research Laboratory
02178  *      Aberdeen Proving Ground, Maryland  21005-5068  USA
02179  *
02180  *  $Header: /cvsroot/brlcad/brlcad/include/raytrace.h,v 14.45 2006/09/18 05:24:07 lbutler Exp $
02181  */
02182 
02183 /* defining the following flag will improve NMG raytrace speed by eliminating some checking
02184  * Use with CAUTION!!! */
02185 #define FAST_NMG        1
02186 
02187 #define NMG_HIT_LIST    0
02188 #define NMG_MISS_LIST   1
02189 #define NMG_RT_HIT_MAGIC 0x48697400     /**< @brief  "Hit" */
02190 #define NMG_RT_HIT_SUB_MAGIC 0x48696d00 /**< @brief  "Him" */
02191 #define NMG_RT_MISS_MAGIC 0x4d697300    /**< @brief  "Mis" */
02192 
02193 
02194 /* These values are for the hitmiss "in_out" variable and indicate the
02195  * nature of the hit when known
02196  */
02197 #define HMG_INBOUND_STATE(_hm) (((_hm)->in_out & 0x0f0) >> 4)
02198 #define HMG_OUTBOUND_STATE(_hm) ((_hm)->in_out & 0x0f)
02199 
02200 
02201 #define NMG_RAY_STATE_INSIDE    1
02202 #define NMG_RAY_STATE_ON        2
02203 #define NMG_RAY_STATE_OUTSIDE   4
02204 #define NMG_RAY_STATE_ANY       8
02205 
02206 #define HMG_HIT_IN_IN   0x11    /**< @brief  hit internal structure */
02207 #define HMG_HIT_IN_OUT  0x14    /**< @brief  breaking out */
02208 #define HMG_HIT_OUT_IN  0x41    /**< @brief  breaking in */
02209 #define HMG_HIT_OUT_OUT 0x44    /**< @brief  edge/vertex graze */
02210 #define HMG_HIT_IN_ON   0x12
02211 #define HMG_HIT_ON_IN   0x21
02212 #define HMG_HIT_ON_ON   0x22
02213 #define HMG_HIT_OUT_ON  0x42
02214 #define HMG_HIT_ON_OUT  0x24
02215 #define HMG_HIT_ANY_ANY 0x88    /**< @brief  hit on non-3-mainifold */
02216 
02217 #define NMG_VERT_ENTER 1
02218 #define NMG_VERT_ENTER_LEAVE 0
02219 #define NMG_VERT_LEAVE -1
02220 #define NMG_VERT_UNKNOWN -2
02221 
02222 #define NMG_HITMISS_SEG_IN 0x696e00     /**< @brief  "in" */
02223 #define NMG_HITMISS_SEG_OUT 0x6f757400  /**< @brief  "out" */
02224 
02225 struct hitmiss {
02226         struct bu_list  l;
02227         struct hit      hit;
02228         fastf_t         dist_in_plane;  /**< @brief  distance from plane intersect */
02229         int             in_out;         /**< @brief  status of ray as it transitions
02230                                          * this hit point.
02231                                          */
02232         long            *inbound_use;
02233         vect_t          inbound_norm;
02234         long            *outbound_use;
02235         vect_t          outbound_norm;
02236         int             start_stop;     /**< @brief  is this a seg_in or seg_out */
02237         struct hitmiss  *other;         /**< @brief  for keeping track of the other
02238                                          * end of the segment when we know
02239                                          * it
02240                                          */
02241 };
02242 
02243 #define NMG_CK_HITMISS(hm) {\
02244         switch (hm->l.magic) { \
02245         case NMG_RT_HIT_MAGIC: \
02246         case NMG_RT_HIT_SUB_MAGIC: \
02247         case NMG_RT_MISS_MAGIC: \
02248                 break; \
02249         case NMG_MISS_LIST: \
02250                 bu_log("%s[%d]: struct hitmiss has  NMG_MISS_LIST magic #\n",\
02251                         __FILE__, __LINE__); \
02252                 rt_bomb("NMG_CK_HITMISS: going down in flames\n"); \
02253         case NMG_HIT_LIST: \
02254                 bu_log("%s[%d]: struct hitmiss has  NMG_MISS_LIST magic #\n",\
02255                         __FILE__, __LINE__); \
02256                 rt_bomb("NMG_CK_HITMISS: going down in flames\n"); \
02257         default: \
02258                 bu_log("%s[%d]: bad struct hitmiss magic: %d:(0x%08x)\n", \
02259                         __FILE__, __LINE__, hm->l.magic, hm->l.magic); \
02260                 rt_bomb("NMG_CK_HITMISS: going down in flames\n"); \
02261         }\
02262         if (!hm->hit.hit_private) { \
02263                 bu_log("%s[%d]: NULL hit_private in hitmiss struct\n", \
02264                         __FILE__, __LINE__); \
02265                 rt_bomb("NMG_CK_HITMISS: going down in flames\n"); \
02266         } \
02267 }
02268 
02269 #define NMG_CK_HITMISS_LISTS(a_hit, rd) { \
02270     for (BU_LIST_FOR(a_hit, hitmiss, &rd->rd_hit)){NMG_CK_HITMISS(a_hit);} \
02271     for (BU_LIST_FOR(a_hit, hitmiss, &rd->rd_miss)){NMG_CK_HITMISS(a_hit);} }
02272 
02273 
02274 /*      Ray Data structure
02275  *
02276  * A)   the hitmiss table has one element for each nmg structure in the
02277  *      nmgmodel.  The table keeps track of which elements have been
02278  *      processed before and which haven't.  Elements in this table
02279  *      will either be:
02280  *              (NULL)          item not previously processed
02281  *              hitmiss ptr     item previously processed
02282  *
02283  *      the 0th item in the array is a pointer to the head of the "hit"
02284  *      list.  The 1th item in the array is a pointer to the head of the
02285  *      "miss" list.
02286  *
02287  * B)   If plane_pt is non-null then we are currently processing a face
02288  *      intersection.  The plane_dist and ray_dist_to_plane are valid.
02289  *      The ray/edge intersector should check the distance from the plane
02290  *      intercept to the edge and update "plane_closest" if the current
02291  *      edge is closer to the intercept than the previous closest object.
02292  */
02293 #define NMG_PCA_EDGE    1
02294 #define NMG_PCA_EDGE_VERTEX 2
02295 #define NMG_PCA_VERTEX 3
02296 #define NMG_RAY_DATA_MAGIC 0x1651771
02297 #define NMG_CK_RD(_rd) NMG_CKMAG(_rd, NMG_RAY_DATA_MAGIC, "ray data");
02298 struct ray_data {
02299         long magic;
02300         struct model            *rd_m;
02301         char                    *manifolds; /**< @brief   structure 1-3manifold table */
02302         vect_t                  rd_invdir;
02303         struct xray             *rp;
02304         struct application      *ap;
02305         struct seg              *seghead;
02306         struct soltab           *stp;
02307         const struct bn_tol     *tol;
02308         struct hitmiss  **hitmiss;      /**< @brief  1 struct hitmiss ptr per elem. */
02309         struct bu_list  rd_hit;         /**< @brief  list of hit elements */
02310         struct bu_list  rd_miss;        /**< @brief  list of missed/sub-hit elements */
02311 
02312 /* The following are to support isect_ray_face() */
02313 
02314     /** plane_pt is the intercept point of the ray with the plane of the
02315          * face.
02316          */
02317         point_t plane_pt;       /**< @brief  ray/plane(face) intercept point */
02318 
02319     /** ray_dist_to_plane is the parametric distance along the ray from
02320          * the ray origin (rd->rp->r_pt) to the ray/plane intercept point
02321          */
02322         fastf_t         ray_dist_to_plane; /**< @brief  ray parametric dist to plane */
02323 
02324     /** the "face_subhit" element is a boolean used by isect_ray_face
02325          * and [e|v]u_touch_func to record the fact that the ray/(plane/face)
02326          * intercept point was within tolerance of an edge/vertex of the face.
02327          * In such instances, isect_ray_face does NOT need to generate a hit
02328          * point for the face, as the hit point for the edge/vertex will
02329          * suffice.
02330          */
02331         int             face_subhit;
02332 
02333     /** the "classifying_ray" flag indicates that this ray is being used to
02334          * classify a point, so that the "eu_touch" and "vu_touch" functions
02335          * should not be called.
02336          */
02337         int             classifying_ray;
02338 };
02339 
02340 
02341 #ifdef FAST_NMG
02342 #define GET_HITMISS(_p, _ap) { \
02343         (_p) = BU_LIST_FIRST( hitmiss, &((_ap)->a_resource->re_nmgfree) ); \
02344         if( BU_LIST_IS_HEAD( (_p), &((_ap)->a_resource->re_nmgfree ) ) ) \
02345                 (_p) = (struct hitmiss *)bu_calloc(1, sizeof( struct hitmiss ), "hitmiss" ); \
02346         else \
02347                 BU_LIST_DEQUEUE( &((_p)->l) ); \
02348         }
02349 
02350 #define NMG_FREE_HITLIST(_p, _ap) { \
02351         BU_CK_LIST_HEAD( (_p) ); \
02352         BU_LIST_APPEND_LIST( &((_ap)->a_resource->re_nmgfree), (_p) ); \
02353         }
02354 #else
02355 #define GET_HITMISS(_p) { \
02356         char str[64]; \
02357         (void)sprintf(str, "GET_HITMISS %s %d", __FILE__, __LINE__); \
02358         (_p) = (struct hitmiss *)bu_calloc(1, sizeof(struct hitmiss), str); \
02359         }
02360 
02361 #define FREE_HITMISS(_p) { \
02362         char str[64]; \
02363         (void)sprintf(str, "FREE_HITMISS %s %d", __FILE__, __LINE__); \
02364         (void)bu_free( (char *)_p,  str); \
02365         }
02366 
02367 #define NMG_FREE_HITLIST(_p) { \
02368         struct hitmiss *_hit; \
02369         while ( BU_LIST_WHILE(_hit, hitmiss, _p)) { \
02370                 NMG_CK_HITMISS(_hit); \
02371                 BU_LIST_DEQUEUE( &_hit->l ); \
02372                 FREE_HITMISS( _hit ); \
02373         } }
02374 
02375 #endif
02376 
02377 #define HIT 1   /**< @brief  a hit on a face */
02378 #define MISS 0  /**< @brief  a miss on the face */
02379 
02380 
02381 #ifdef NO_BOMBING_MACROS
02382 #  define nmg_rt_bomb(rd, str)
02383 #else
02384 #  define nmg_rt_bomb(rd, str) { \
02385         bu_log("%s", str); \
02386         if (rt_g.NMG_debug & DEBUG_NMGRT) rt_bomb("End of diagnostics"); \
02387         BU_LIST_INIT(&rd->rd_hit); \
02388         BU_LIST_INIT(&rd->rd_miss); \
02389         rt_g.NMG_debug |= DEBUG_NMGRT; \
02390         nmg_isect_ray_model(rd); \
02391         (void) nmg_ray_segs(rd); \
02392         rt_bomb("Should have bombed before this\n"); }
02393 #endif
02394 
02395 
02396 struct nmg_radial {
02397         struct bu_list  l;
02398         struct edgeuse  *eu;
02399         struct faceuse  *fu;            /**< @brief  Derrived from eu */
02400         struct shell    *s;             /**< @brief  Derrived from eu */
02401         int             existing_flag;  /**< @brief  !0 if this eu exists on dest edge */
02402         int             is_crack;       /**< @brief  This eu is part of a crack. */
02403         int             is_outie;       /**< @brief  This crack is an "outie" */
02404         int             needs_flip;     /**< @brief  Insert eumate, not eu */
02405         fastf_t         ang;            /**< @brief  angle, in radians.  0 to 2pi */
02406 };
02407 #define NMG_RADIAL_MAGIC        0x52614421      /**< @brief  RaD! */
02408 #define NMG_CK_RADIAL(_p)       NMG_CKMAG(_p, NMG_RADIAL_MAGIC, "nmg_radial")
02409 
02410 struct nmg_inter_struct {
02411         long            magic;
02412         struct bu_ptbl  *l1;            /**< @brief  vertexuses on the line of */
02413         struct bu_ptbl *l2;             /**< @brief  intersection between planes */
02414         fastf_t         *mag1;          /**< @brief  Distances along intersection line */
02415         fastf_t         *mag2;          /**< @brief  for each vertexuse in l1 and l2. */
02416         int             mag_len;        /**< @brief  Array size of mag1 and mag2 */
02417         struct shell    *s1;
02418         struct shell    *s2;
02419         struct faceuse  *fu1;           /**< @brief  null if l1 comes from a wire */
02420         struct faceuse  *fu2;           /**< @brief  null if l2 comes from a wire */
02421         struct bn_tol   tol;
02422         int             coplanar;       /**< @brief  a flag */
02423         struct edge_g_lseg      *on_eg;         /**< @brief  edge_g for line of intersection */
02424         point_t         pt;             /**< @brief  3D line of intersection */
02425         vect_t          dir;
02426         point_t         pt2d;           /**< @brief  2D projection of isect line */
02427         vect_t          dir2d;
02428         fastf_t         *vert2d;        /**< @brief  Array of 2d vertex projections [index] */
02429         int             maxindex;       /**< @brief  size of vert2d[] */
02430         mat_t           proj;           /**< @brief  Matrix to project onto XY plane */
02431         const long      *twod;          /**< @brief  ptr to face/edge of 2d projection */
02432 };
02433 #define NMG_INTER_STRUCT_MAGIC  0x99912120
02434 #define NMG_CK_INTER_STRUCT(_p) NMG_CKMAG(_p, NMG_INTER_STRUCT_MAGIC, "nmg_inter_struct")
02435 
02436 /*****************************************************************
02437  *                                                               *
02438  *          Applications interface to the RT library             *
02439  *                                                               *
02440  *****************************************************************/
02441                                         /* Read named MGED db, build toc */
02442 RT_EXPORT BU_EXTERN(struct rt_i *rt_dirbuild,
02443                     (const char *filename,
02444                      char *buf,
02445                      int len));
02446 /* Prepare for raytracing */
02447 RT_EXPORT BU_EXTERN(struct rt_i *rt_new_rti,
02448                     (struct db_i *dbip));
02449 RT_EXPORT BU_EXTERN(void rt_free_rti,
02450                     (struct rt_i *rtip));
02451 RT_EXPORT BU_EXTERN(void rt_prep,
02452                     (struct rt_i *rtip));
02453 RT_EXPORT BU_EXTERN(void rt_prep_parallel,
02454                     (struct rt_i *rtip,
02455                      int ncpu));
02456 /* DEPRECATED, set a_logoverlap */
02457 RT_EXPORT BU_EXTERN(int rt_overlap_quietly,
02458                     (struct application *ap,
02459                      struct partition *pp,
02460                      struct region *reg1,
02461                      struct region *reg2,
02462                      struct partition *pheadp));
02463 RT_EXPORT BU_EXTERN(void rt_default_multioverlap,
02464                     (struct application *ap,
02465                      struct partition *pp,
02466                      struct bu_ptbl *regiontable,
02467                      struct partition *InputHdp));
02468 RT_EXPORT BU_EXTERN(void rt_silent_logoverlap,
02469                     (struct application *ap,
02470                      const struct partition *pp,
02471                      const struct bu_ptbl *regiontable,
02472                      const struct partition *InputHdp));
02473 RT_EXPORT BU_EXTERN(void rt_default_logoverlap,
02474                     (struct application *ap,
02475                      const struct partition *pp,
02476                      const struct bu_ptbl *regiontable,
02477                      const struct partition *InputHdp));
02478 /* Shoot a ray */
02479 RT_EXPORT BU_EXTERN(int rt_shootray,
02480                     (struct application *ap));
02481 /* Get expr tree for object */
02482 RT_EXPORT BU_EXTERN(const char *rt_basename,
02483                     (const char *str));
02484 RT_EXPORT BU_EXTERN(void rt_free_soltab,
02485                     (struct soltab   *stp));
02486 RT_EXPORT BU_EXTERN(int rt_gettree,
02487                     (struct rt_i *rtip,
02488                      const char *node));
02489 RT_EXPORT BU_EXTERN(int rt_gettrees,
02490                     (struct rt_i *rtip,
02491                      int argc,
02492                      const char **argv, int ncpus));
02493 RT_EXPORT BU_EXTERN(int rt_gettrees_and_attrs,
02494                     (struct rt_i *rtip,
02495                      const char **attrs,
02496                      int argc,
02497                      const char **argv, int ncpus));
02498 RT_EXPORT BU_EXTERN(int rt_gettrees_muves,
02499                     (struct rt_i *rtip,
02500                      const char **attrs,
02501                      int argc,
02502                      const char **argv,
02503                      int ncpus));
02504 RT_EXPORT BU_EXTERN(int rt_load_attrs,
02505                     (struct rt_i *rtip,
02506                      char **attrs));
02507 /* Print seg struct */
02508 RT_EXPORT BU_EXTERN(void rt_pr_seg,
02509                     (const struct seg *segp));
02510 /* Print the partitions */
02511 RT_EXPORT BU_EXTERN(void rt_pr_partitions,
02512                     (const struct rt_i *rtip,
02513                      const struct partition *phead,
02514                      const char *title));
02515 /* Find solid by leaf name */
02516 RT_EXPORT BU_EXTERN(struct soltab *rt_find_solid,
02517                     (const struct rt_i *rtip,
02518                      const char *name));
02519 /* Start the timer */
02520 RT_EXPORT BU_EXTERN(void rt_prep_timer,
02521                     (void));
02522 /* Read timer, return time + str */
02523 RT_EXPORT BU_EXTERN(double rt_get_timer,
02524                     (struct bu_vls *vp,
02525                      double *elapsed));
02526 /* Return CPU time, text, & wall clock time */
02527 RT_EXPORT BU_EXTERN(double rt_read_timer,
02528                     (char *str, int len));
02529 /* Plot a solid */
02530 int rt_plot_solid(
02531         FILE                    *fp,
02532         struct rt_i             *rtip,
02533         const struct soltab     *stp,
02534         struct resource         *resp);
02535 /* Release storage assoc with rt_i */
02536 RT_EXPORT BU_EXTERN(void rt_clean,
02537                     (struct rt_i *rtip));
02538 RT_EXPORT BU_EXTERN(int rt_del_regtree,
02539                     (struct rt_i *rtip,
02540                      struct region *delregp,
02541                      struct resource *resp));
02542 /* Check in-memory data structures */
02543 RT_EXPORT BU_EXTERN(void rt_ck,
02544                     (struct rt_i *rtip));
02545 RT_EXPORT BU_EXTERN(void rt_pr_library_version,
02546                     ());
02547 /* apply a matrix transformation */
02548 RT_EXPORT BU_EXTERN(int rt_matrix_transform,
02549                     (struct rt_db_internal *output, const mat_t matrix, struct rt_db_internal *input, int free, struct db_i *dbip, struct resource *resource));
02550 
02551 
02552 /*****************************************************************
02553  *                                                               *
02554  *  Internal routines in the RT library.                         *
02555  *  These routines are *not* intended for Applications to use.   *
02556  *  The interface to these routines may change significantly     *
02557  *  from release to release of this software.                    *
02558  *                                                               *
02559  *****************************************************************/
02560 
02561                                         /* Weave segs into partitions */
02562 RT_EXPORT BU_EXTERN(void rt_boolweave,
02563                     (struct seg *out_hd,
02564                      struct seg *in_hd,
02565                      struct partition *PartHeadp,
02566                      struct application *ap));
02567 /* Eval booleans over partitions */
02568 RT_EXPORT BU_EXTERN(int rt_boolfinal,
02569                     (struct partition *InputHdp,
02570                      struct partition *FinalHdp,
02571                      fastf_t startdist,
02572                      fastf_t enddist,
02573                      struct bu_ptbl *regionbits,
02574                      struct application *ap,
02575                      const struct bu_bitv *solidbits));
02576 
02577 RT_EXPORT BU_EXTERN(void rt_grow_boolstack,
02578                     (struct resource *res));
02579 /* Approx Floating compare */
02580 RT_EXPORT BU_EXTERN(int rt_fdiff,
02581                     (double a, double b));
02582 /* Relative Difference */
02583 RT_EXPORT BU_EXTERN(double rt_reldiff,
02584                     (double a, double b));
02585 /* Print a soltab */
02586 RT_EXPORT BU_EXTERN(void rt_pr_soltab,
02587                     (const struct soltab *stp));
02588 /* Print a region */
02589 RT_EXPORT BU_EXTERN(void rt_pr_region,
02590                     (const struct region *rp));
02591 /* Print an expr tree */
02592 RT_EXPORT BU_EXTERN(void rt_pr_tree,
02593                     (const union tree *tp,
02594                      int lvl));
02595 /* Print value of tree for a partition */
02596 RT_EXPORT BU_EXTERN(void rt_pr_tree_val,
02597                     (const union tree *tp,
02598                      const struct partition *partp,
02599                      int pr_name, int lvl));
02600 /* Print a partition */
02601 RT_EXPORT BU_EXTERN(void rt_pr_pt,
02602                     (const struct rt_i *rtip,
02603                      const struct partition *pp));
02604 /* Print a bit vector */
02605 RT_EXPORT BU_EXTERN(void rt_pr_hit,
02606                     (const char *str,
02607                      const struct hit *hitp));
02608 
02609 /* rt_fastf_float, rt_mat_dbmat, rt_dbmat_mat
02610  * declarations moved to db.h */
02611 
02612 /* storage obtainers */
02613 RT_EXPORT BU_EXTERN(void rt_get_seg,
02614                     (struct resource *res));
02615 RT_EXPORT BU_EXTERN(void rt_cut_it,
02616                     (struct rt_i *rtip,
02617                      int ncpu));
02618 /* print cut node */
02619 RT_EXPORT BU_EXTERN(void rt_pr_cut,
02620                     (const union cutter *cutp,
02621                      int lvl));
02622 /* free a cut tree */
02623 RT_EXPORT BU_EXTERN(void rt_fr_cut,
02624                     (struct rt_i *rtip,
02625                      union cutter *cutp));
02626 /* regionid-driven color override */
02627 
02628 /* bool.c */
02629 RT_EXPORT BU_EXTERN(void rt_rebuild_overlaps,
02630                     (struct partition   *PartHdp,
02631                      struct application *ap,
02632                      int                rebuild_fastgen_plates_only));
02633 RT_EXPORT BU_EXTERN(int rt_partition_len,
02634                     (const struct partition *partheadp));
02635 RT_EXPORT BU_EXTERN(int rt_defoverlap,
02636                     (struct application *ap,
02637                      struct partition *pp,
02638                      struct region *reg1,
02639                      struct region *reg2,
02640                      struct partition *pheadp));
02641 
02642 
02643 
02644 /* mater.c */
02645 
02646 RT_EXPORT BU_EXTERN(void rt_region_color_map,
02647                     (struct region *regp));
02648 /* process ID_MATERIAL record */
02649 RT_EXPORT BU_EXTERN(void rt_color_addrec,
02650                     (int low,
02651                      int hi,
02652                      int r,
02653                      int g,
02654                      int b,
02655                      long addr));
02656 RT_EXPORT BU_EXTERN(void rt_color_free,
02657                     ());
02658 
02659 /* extend a cut box */
02660 
02661 /* cut.c */
02662 RT_EXPORT BU_EXTERN(void rt_pr_cut_info,
02663                     (const struct rt_i  *rtip,
02664                      const char         *str));
02665 RT_EXPORT BU_EXTERN(void remove_from_bsp,
02666                     (struct soltab *stp,
02667                      union cutter *cutp,
02668                      struct bn_tol *tol));
02669 RT_EXPORT BU_EXTERN(void insert_in_bsp,
02670                     (struct soltab *stp,
02671                      union cutter *cutp));
02672 RT_EXPORT BU_EXTERN(void fill_out_bsp,
02673                     (struct rt_i *rtip,
02674                      union cutter *cutp,
02675                      struct resource *resp,
02676                      fastf_t bb[6]));
02677 RT_EXPORT BU_EXTERN(void rt_cut_extend,
02678                     (union cutter *cutp,
02679                      struct soltab *stp,
02680                      const struct rt_i *rtip));
02681 /* find RPP of one region */
02682 RT_EXPORT BU_EXTERN(int rt_rpp_region,
02683                     (struct rt_i *rtip,
02684                      const char *reg_name,
02685                      fastf_t *min_rpp,
02686                      fastf_t *max_rpp));
02687 RT_EXPORT BU_EXTERN(void rt_bomb,
02688                     (const char *s));
02689 RT_EXPORT BU_EXTERN(int rt_in_rpp,
02690                     (struct xray *rp,
02691                      const fastf_t *invdir,
02692                      const fastf_t *min,
02693                      const fastf_t *max));
02694 RT_EXPORT BU_EXTERN(const union cutter *rt_cell_n_on_ray,
02695                     (struct application *ap,
02696                      int n));
02697 RT_EXPORT BU_EXTERN(void rt_cut_clean,
02698                     (struct rt_i *rtip));
02699 
02700 /* cmd.c */
02701 /* Read semi-colon terminated line */
02702 RT_EXPORT BU_EXTERN(char *rt_read_cmd,
02703                     (FILE *fp));
02704 RT_EXPORT BU_EXTERN(int rt_split_cmd,
02705                     (char **argv,
02706                      int lim,
02707                      char *lp));
02708 /* do cmd from string via cmd table */
02709 RT_EXPORT BU_EXTERN(int rt_do_cmd,
02710                     (struct rt_i *rtip,
02711                      const char *ilp,
02712                      const struct command_tab *tp));
02713 
02714 
02715 /* The database library */
02716 
02717 /* wdb.c */
02718 RT_EXPORT BU_EXTERN(struct rt_wdb *wdb_fopen,
02719                     (const char *filename));
02720 RT_EXPORT BU_EXTERN(struct rt_wdb *wdb_fopen_v,
02721                     (const char *filename,
02722                      int version));
02723 RT_EXPORT BU_EXTERN(struct rt_wdb *wdb_dbopen,
02724                     (struct db_i *dbip,
02725                      int mode));
02726 RT_EXPORT BU_EXTERN(int wdb_import,
02727                     (struct rt_wdb *wdbp,
02728                      struct rt_db_internal *internp,
02729                      const char *name,
02730                      const mat_t mat));
02731 RT_EXPORT BU_EXTERN(int wdb_export_external,
02732                     (struct rt_wdb *wdbp,
02733                      struct bu_external *ep,
02734                      const char *name,
02735                      int flags,
02736                      unsigned char minor_type));
02737 RT_EXPORT BU_EXTERN(int wdb_put_internal,
02738                     (struct rt_wdb *wdbp,
02739                      const char *name,
02740                      struct rt_db_internal *ip,
02741                      double local2mm));
02742 RT_EXPORT BU_EXTERN(int wdb_export,
02743                     (struct rt_wdb *wdbp,
02744                      const char *name,
02745                      genptr_t gp,
02746                      int id,
02747                      double local2mm));
02748 RT_EXPORT BU_EXTERN(void wdb_close,
02749                     (struct rt_wdb *wdbp));
02750 
02751 /* db_anim.c */
02752 RT_EXPORT BU_EXTERN(struct animate *db_parse_1anim,
02753                     (struct db_i     *dbip,
02754                      int             argc,
02755                      const char      **argv));
02756 
02757 RT_EXPORT BU_EXTERN(int db_parse_anim,
02758                     (struct db_i     *dbip,
02759                      int             argc,
02760                      const char      **argv));
02761 
02762 
02763 
02764 RT_EXPORT BU_EXTERN(int db_add_anim,
02765                     (struct db_i *dbip,
02766                      struct animate *anp,
02767                      int root));
02768 RT_EXPORT BU_EXTERN(int db_do_anim,
02769                     (struct animate *anp,
02770                      mat_t stack,
02771                      mat_t arc,
02772                      struct mater_info *materp));
02773 RT_EXPORT BU_EXTERN(void db_free_anim,
02774                     (struct db_i *dbip));
02775 RT_EXPORT BU_EXTERN(void db_write_anim,
02776                     (FILE *fop,
02777                      struct animate *anp));
02778 RT_EXPORT BU_EXTERN(struct animate *db_parse_1anim,
02779                     (struct db_i *dbip,
02780                      int argc,
02781                      const char **argv));
02782 RT_EXPORT BU_EXTERN(void db_free_1anim,
02783                     (struct animate *anp));
02784 
02785 /* db_path.c */
02786 RT_EXPORT BU_EXTERN(void db_full_path_init,
02787                     (struct db_full_path *pathp));
02788 RT_EXPORT BU_EXTERN(void db_add_node_to_full_path,
02789                     (struct db_full_path *pp,
02790                      struct directory *dp));
02791 RT_EXPORT BU_EXTERN(void db_dup_full_path,
02792                     (struct db_full_path *newp,
02793                      const struct db_full_path *oldp));
02794 RT_EXPORT BU_EXTERN(void db_extend_full_path,
02795                     (struct db_full_path *pathp,
02796                      int incr));
02797 RT_EXPORT BU_EXTERN(void db_append_full_path,
02798                     (struct db_full_path *dest,
02799                      const struct db_full_path *src));
02800 RT_EXPORT BU_EXTERN(void db_dup_path_tail,
02801                     (struct db_full_path        *newp,
02802                      const struct db_full_path  *oldp,
02803                      int                        start));
02804 RT_EXPORT BU_EXTERN(char *db_path_to_string,
02805                     (const struct db_full_path *pp));
02806 RT_EXPORT BU_EXTERN(void db_path_to_vls,
02807                     (struct bu_vls *str,
02808                      const struct db_full_path *pp));
02809 RT_EXPORT BU_EXTERN(void db_pr_full_path,
02810                     (const char *msg,
02811                      const struct db_full_path *pathp));
02812 RT_EXPORT BU_EXTERN(int db_string_to_path,
02813                     (struct db_full_path *pp,
02814                      const struct db_i *dbip,
02815                      const char *str));
02816 RT_EXPORT BU_EXTERN(int db_argv_to_path,
02817                     (register struct db_full_path       *pp,
02818                      struct db_i                        *dbip,
02819                      int                                argc,
02820                      const char                 *const*argv));
02821 RT_EXPORT BU_EXTERN(void db_free_full_path,
02822                     (struct db_full_path *pp));
02823 RT_EXPORT BU_EXTERN(int db_identical_full_paths,
02824                     ( const struct db_full_path *a,
02825                       const struct db_full_path *b));
02826 RT_EXPORT BU_EXTERN(int db_full_path_subset,
02827                     (const struct db_full_path *a,
02828                      const struct db_full_path *b));
02829 RT_EXPORT BU_EXTERN(int db_full_path_search,
02830                     (const struct db_full_path *a,
02831                      const struct directory *dp));
02832 
02833 
02834 /* db_open.c */
02835 RT_EXPORT BU_EXTERN(void db_sync,
02836                     (struct db_i        *dbip));
02837 
02838 /* open an existing model database */
02839 RT_EXPORT BU_EXTERN(struct db_i *db_open,
02840                     (const char *name,
02841                      const char *mode));
02842 /* create a new model database */
02843 RT_EXPORT BU_EXTERN(struct db_i *db_create,
02844                     (const char *name,
02845                      int version));
02846 /* close a model database */
02847 RT_EXPORT BU_EXTERN(void db_close_client,
02848                     (struct db_i *dbip,
02849                      long *client));
02850 RT_EXPORT BU_EXTERN(void db_close,
02851                     (struct db_i *dbip));
02852 /* dump a full copy of a database */
02853 RT_EXPORT BU_EXTERN(int db_dump,
02854                     (struct rt_wdb *wdbp,
02855                      struct db_i *dbip));
02856 RT_EXPORT BU_EXTERN(struct db_i *db_clone_dbi,
02857                     (struct db_i *dbip,
02858                      long *client));
02859 /* db5_alloc.c */
02860 
02861 RT_EXPORT BU_EXTERN(int db5_write_free,
02862                     (struct db_i *dbip,
02863                      struct directory *dp,
02864                      long length));
02865 RT_EXPORT BU_EXTERN(int db5_realloc,
02866                     (struct db_i *dbip,
02867                      struct directory *dp,
02868                      struct bu_external *ep));
02869 
02870 /* db5_io.c */
02871 RT_EXPORT BU_EXTERN(void db5_export_object3,
02872                     (struct bu_external *out,
02873                      int                        dli,
02874                      const char                 *name,
02875                      const unsigned char        hidden,
02876                      const struct bu_external   *attrib,
02877                      const struct bu_external   *body,
02878                      int                        major,
02879                      int                        minor,
02880                      int                        a_zzz,
02881                      int                        b_zzz));
02882 RT_EXPORT BU_EXTERN(int rt_db_cvt_to_external5,
02883                     (struct bu_external *ext,
02884                      const char *name,
02885                      const struct rt_db_internal *ip,
02886                      double conv2mm,
02887                      struct db_i *dbip,
02888                      struct resource *resp,
02889                      const int major));
02890 
02891 RT_EXPORT BU_EXTERN(int db_wrap_v5_external,
02892                     (struct bu_external *ep,
02893                      const char *name));
02894 
02895 RT_EXPORT BU_EXTERN(int rt_db_get_internal5,
02896                     (struct rt_db_internal      *ip,
02897                      const struct directory     *dp,
02898                      const struct db_i  *dbip,
02899                      const mat_t                mat,
02900                      struct resource            *resp));
02901 RT_EXPORT BU_EXTERN(int rt_db_put_internal5,
02902                     (struct directory   *dp,
02903                      struct db_i                *dbip,
02904                      struct rt_db_internal      *ip,
02905                      struct resource            *resp,
02906                      const int          major));
02907 
02908 RT_EXPORT BU_EXTERN(void db5_make_free_object_hdr,
02909                     (struct bu_external *ep,
02910                      long length));
02911 RT_EXPORT BU_EXTERN(void db5_make_free_object,
02912                     (struct bu_external *ep,
02913                      long length));
02914 RT_EXPORT BU_EXTERN(int db5_decode_signed,
02915                     (long                       *lenp,
02916                      const unsigned char        *cp,
02917                      int                        format));
02918 
02919 RT_EXPORT BU_EXTERN(int db5_decode_length,
02920                     (long                       *lenp,
02921                      const unsigned char        *cp,
02922                      int                        format));
02923 
02924 RT_EXPORT BU_EXTERN(int db5_select_length_encoding,
02925                     (long len));
02926 
02927 RT_EXPORT BU_EXTERN(void db5_import_color_table,
02928                     (char *cp));
02929 
02930 RT_EXPORT BU_EXTERN(int db5_import_attributes,
02931                     (struct bu_attribute_value_set *avs,
02932                      const struct bu_external *ap));
02933 
02934 RT_EXPORT BU_EXTERN(void db5_export_attributes,
02935                     (struct bu_external *ap,
02936                      const struct bu_attribute_value_set *avs));
02937 
02938 RT_EXPORT BU_EXTERN(int db5_get_raw_internal_fp,
02939                     (struct db5_raw_internal    *rip,
02940                      FILE                       *fp));
02941 
02942 RT_EXPORT BU_EXTERN(int db5_header_is_valid,
02943                     (const unsigned char *hp));
02944 #define rt_fwrite_internal5     +++__deprecated_rt_fwrite_internal5__+++
02945 RT_EXPORT BU_EXTERN(int db5_fwrite_ident,
02946                     (FILE *,
02947                      const char *,
02948                      double));
02949 
02950 RT_EXPORT BU_EXTERN(int db5_put_color_table,
02951                     (struct db_i *dbip));
02952 RT_EXPORT BU_EXTERN(int db5_update_ident,
02953                     (struct db_i *dbip,
02954                      const char *title,
02955                      double local2mm));
02956 RT_EXPORT BU_EXTERN(int db_put_external5,
02957                     (struct bu_external *ep,
02958                      struct directory *dp,
02959                      struct db_i *dbip));
02960 RT_EXPORT BU_EXTERN(int db5_update_attributes,
02961                     (struct directory *dp,
02962                      struct bu_attribute_value_set *avsp,
02963                      struct db_i *dbip));
02964 RT_EXPORT BU_EXTERN(int db5_update_attribute,
02965                     (const char *obj_name,
02966                      const char *aname,
02967                      const char *value,
02968                      struct db_i *dbip));
02969 RT_EXPORT BU_EXTERN(int db5_replace_attributes,
02970                     (struct directory *dp,
02971                      struct bu_attribute_value_set *avsp,
02972                      struct db_i *dbip));
02973 RT_EXPORT BU_EXTERN(int db5_get_attributes,
02974                     (const struct db_i *dbip,
02975                      struct bu_attribute_value_set *avs,
02976                      const struct directory *dp));
02977 
02978 /* db_comb.c */
02979 RT_EXPORT BU_EXTERN(int db_tree_nleaves,
02980                     (const union tree *tp));
02981 RT_EXPORT BU_EXTERN(struct rt_tree_array *db_flatten_tree,
02982                     (struct rt_tree_array       *rt_tree_array,
02983                      union tree                 *tp,
02984                      int                        op,
02985                      int                        avail,
02986                      struct resource            *resp));
02987 RT_EXPORT BU_EXTERN(int rt_comb_import4,
02988                     (struct rt_db_internal      *ip,
02989                      const struct bu_external   *ep,
02990                      const mat_t                matrix,         /* NULL if identity */
02991                      const struct db_i          *dbip,
02992                      struct resource            *resp));
02993 RT_EXPORT BU_EXTERN(int rt_comb_export4,
02994                     (struct bu_external                 *ep,
02995                      const struct rt_db_internal        *ip,
02996                      double                             local2mm,
02997                      const struct db_i                  *dbip,
02998                      struct resource                    *resp));
02999 RT_EXPORT BU_EXTERN(void db_tree_flatten_describe,
03000                     (struct bu_vls      *vls,
03001                      const union tree   *tp,
03002                      int                indented,
03003                      int                lvl,
03004                      double             mm2local,
03005                      struct resource    *resp));
03006 RT_EXPORT BU_EXTERN(void db_tree_describe,
03007                     (struct bu_vls      *vls,
03008                      const union tree   *tp,
03009                      int                indented,
03010                      int                lvl,
03011                      double             mm2local));
03012 RT_EXPORT BU_EXTERN(void db_comb_describe,
03013                     (struct bu_vls      *str,
03014                      const struct rt_comb_internal      *comb,
03015                      int                verbose,
03016                      double             mm2local,
03017                      struct resource    *resp));
03018 RT_EXPORT BU_EXTERN(void rt_comb_ifree,
03019                     (struct rt_db_internal *ip,
03020                      struct resource *resp));
03021 RT_EXPORT BU_EXTERN(int rt_comb_describe,
03022                     (struct bu_vls      *str,
03023                      const struct rt_db_internal *ip,
03024                      int                verbose,
03025                      double             mm2local,
03026                      struct resource *resp,
03027                      struct db_i *db_i));
03028 RT_EXPORT BU_EXTERN(void db_wrap_v4_external,
03029                     (struct bu_external *op,
03030                      const char *name));
03031 RT_EXPORT BU_EXTERN(int db_ck_left_heavy_tree,
03032                     (const union tree   *tp,
03033                      int                no_unions));
03034 RT_EXPORT BU_EXTERN(int db_ck_v4gift_tree,
03035                     (const union tree *tp));
03036 RT_EXPORT BU_EXTERN(union tree *db_mkbool_tree,
03037                     (struct rt_tree_array *rt_tree_array,
03038                      int                howfar,
03039                      struct resource    *resp));
03040 RT_EXPORT BU_EXTERN(union tree *db_mkgift_tree,
03041                     (struct rt_tree_array       *trees,
03042                      int                        subtreecount,
03043                      struct resource            *resp));
03044 
03045 /* g_tgc.c */
03046 RT_EXPORT BU_EXTERN(void rt_pt_sort,
03047                     (register fastf_t t[],
03048                      int npts));
03049 
03050 /* g_ell.c */
03051 RT_EXPORT BU_EXTERN(void rt_ell_16pts,
03052                     (register fastf_t *ov,
03053                      register fastf_t *V,
03054                      fastf_t *A,
03055                      fastf_t *B));
03056 
03057 
03058 /* roots.c */
03059 RT_EXPORT BU_EXTERN(int rt_poly_roots,
03060                     (bn_poly_t *eqn,
03061                      bn_complex_t roots[],
03062                      const char *name));
03063 
03064 
03065 /* db_io.c */
03066 RT_EXPORT BU_EXTERN(int db_write,
03067                     (struct db_i        *dbip,
03068                      const genptr_t     addr,
03069                      long               count,
03070                      long               offset));
03071 RT_EXPORT BU_EXTERN(int db_fwrite_external,
03072                     (FILE                       *fp,
03073                      const char         *name,
03074                      struct bu_external *ep));
03075 
03076 
03077 /* It is normal to test for __STDC__ when using *_DEFINED tests but in
03078  * in this case "union record" is used for db_getmrec's return type.  This
03079  * requires that the "union_record *db_getmrec" be used whenever
03080  * RECORD_DEFINED is defined.
03081  */
03082 #if defined(RECORD_DEFINED)
03083 /* malloc & read records */
03084 RT_EXPORT BU_EXTERN(union record *db_getmrec,
03085                     (const struct db_i *,
03086                      const struct directory *dp ));
03087 /* get several records from db */
03088 RT_EXPORT BU_EXTERN(int db_get,
03089                     (const struct db_i *,
03090                      const struct directory *dp,
03091                      union record *where,
03092                      int offset,
03093                      int len));
03094 /* put several records into db */
03095 RT_EXPORT BU_EXTERN(int db_put,
03096                     (struct db_i *,
03097                      const struct directory *dp,
03098                      union record *where,
03099                      int offset, int len));
03100 #else /* RECORD_DEFINED */
03101 /* malloc & read records */
03102 RT_EXPORT BU_EXTERN(genptr_t db_getmrec,
03103                     (const struct db_i *,
03104                      const struct directory *dp));
03105 /* get several records from db */
03106 RT_EXPORT BU_EXTERN(int db_get,
03107                     (const struct db_i *,
03108                      const struct directory *dp,
03109                      genptr_t where,
03110                      int offset,
03111                      int len));
03112 /* put several records into db */
03113 RT_EXPORT BU_EXTERN(int db_put,
03114                     (const struct db_i *,
03115                      const struct directory *dp,
03116                      genptr_t where,
03117                      int offset,
03118                      int len));
03119 #endif /* RECORD_DEFINED */
03120 RT_EXPORT BU_EXTERN(int db_get_external,
03121                     (struct bu_external *ep,
03122                      const struct directory *dp,
03123                      const struct db_i *dbip));
03124 RT_EXPORT BU_EXTERN(int db_put_external,
03125                     (struct bu_external *ep,
03126                      struct directory *dp,
03127                      struct db_i *dbip));
03128 RT_EXPORT BU_EXTERN(void db_free_external,
03129                     (struct bu_external *ep));
03130 
03131 /* db_scan.c */
03132 /* read db (to build directory) */
03133 RT_EXPORT BU_EXTERN(int db_scan,
03134                     (struct db_i *,
03135                      int (*handler)BU_ARGS((struct db_i *,
03136                                             const char *name,
03137                                             long addr,
03138                                             int nrec,
03139                                             int flags,
03140                                             genptr_t client_data)),
03141                      int do_old_matter,
03142                      genptr_t client_data));
03143                                         /* update db unit conversions */
03144 #define db_ident(a,b,c)         +++error+++
03145 RT_EXPORT BU_EXTERN(int db_update_ident,
03146                     (struct db_i *dbip,
03147                      const char *title,
03148                      double local2mm));
03149 RT_EXPORT BU_EXTERN(int db_fwrite_ident,
03150                     (FILE *fp,
03151                      const char *title,
03152                      double local2mm));
03153 RT_EXPORT BU_EXTERN(void db_conversions,
03154                     (struct db_i *,
03155                      int units));
03156 RT_EXPORT BU_EXTERN(int db_v4_get_units_code,
03157                     (const char *str));
03158 
03159 /* db5_scan.c */
03160 RT_EXPORT BU_EXTERN(int db_dirbuild,
03161                     (struct db_i *dbip));
03162 RT_EXPORT BU_EXTERN(struct directory *db5_diradd,
03163                     (struct db_i *dbip,
03164                      const struct db5_raw_internal *rip,
03165                      long laddr,
03166                      genptr_t client_data));
03167 RT_EXPORT BU_EXTERN(int db_get_version,
03168                     (struct db_i *dbip));
03169 RT_EXPORT BU_EXTERN(int db5_scan,
03170                     (struct db_i *dbip,
03171                      void (*handler)(struct db_i *,
03172                                      const struct db5_raw_internal *,
03173                                      long addr,
03174                                      genptr_t client_data),
03175                      genptr_t client_data));
03176 
03177 /* db5_comb.c */
03178 RT_EXPORT BU_EXTERN(int rt_comb_import5,
03179                     (struct rt_db_internal   *ip,
03180                      const struct bu_external *ep,
03181                      const mat_t             mat,
03182                      const struct db_i       *dbip,
03183                      struct resource         *resp,
03184                      const int          minor_type));
03185 
03186 /* g_extrude.c */
03187 RT_EXPORT BU_EXTERN(int rt_extrude_import5,
03188                     (struct rt_db_internal      *ip,
03189                      const struct bu_external   *ep,
03190                      register const mat_t       mat,
03191                      const struct db_i          *dbip,
03192                      struct resource            *resp,
03193                      const int                  minor_type));
03194 
03195 
03196 /* db_inmem.c */
03197 RT_EXPORT BU_EXTERN(struct db_i * db_open_inmem, (void));
03198 
03199 RT_EXPORT BU_EXTERN(struct db_i * db_create_inmem, (void));
03200 
03201 RT_EXPORT BU_EXTERN(void db_inmem,
03202                     (struct directory   *dp,
03203                      struct bu_external *ext,
03204                      int                flags,
03205                      struct db_i        *dbip));
03206 
03207 /* db_lookup.c */
03208 RT_EXPORT BU_EXTERN(int db_get_directory_size,
03209                     (const struct db_i  *dbip));
03210 RT_EXPORT BU_EXTERN(void db_ck_directory,
03211                     (const struct db_i *dbip));
03212 
03213 RT_EXPORT BU_EXTERN(int db_is_directory_non_empty,
03214                     (const struct db_i  *dbip));
03215 
03216 RT_EXPORT BU_EXTERN(int db_dirhash,
03217                     (const char *str));
03218 RT_EXPORT BU_EXTERN(int db_dircheck,
03219                     (struct db_i *dbip,
03220                      struct bu_vls *ret_name,
03221                      int noisy,
03222                      struct directory ***headp));
03223 /* convert name to directory ptr */
03224 RT_EXPORT BU_EXTERN(struct directory *db_lookup,
03225                     (const struct db_i *,
03226                      const char *name,
03227                      int noisy));
03228 /* lookup directory entries based on attributes */
03229 RT_EXPORT BU_EXTERN(struct bu_ptbl *db_lookup_by_attr,
03230                     (struct db_i *dbip,
03231                      int dir_flags,
03232                      struct bu_attribute_value_set *avs,
03233                      int op));
03234 /* add entry to directory */
03235 RT_EXPORT BU_EXTERN(struct directory *db_diradd,
03236                     (struct db_i *,
03237                      const char *name,
03238                      long laddr,
03239                      int len,
03240                      int flags,
03241                      genptr_t ptr));
03242 RT_EXPORT BU_EXTERN(struct directory *db_diradd5,
03243                     (struct db_i *dbip,
03244                      const char *name,
03245                      long                               laddr,
03246                      unsigned char                      major_type,
03247                      unsigned char                      minor_type,
03248                      unsigned char                      name_hidden,
03249                      long                               object_length,
03250                      struct bu_attribute_value_set      *avs));
03251 
03252                                         /* delete entry from directory */
03253 RT_EXPORT BU_EXTERN(int db_dirdelete,
03254                     (struct db_i *,
03255                      struct directory *dp));
03256 RT_EXPORT BU_EXTERN(int db_fwrite_ident,
03257                     (FILE *,
03258                      const char *,
03259                      double));
03260 RT_EXPORT BU_EXTERN(void db_pr_dir,
03261                     (const struct db_i *dbip));
03262 RT_EXPORT BU_EXTERN(int db_rename,
03263                     (struct db_i *,
03264                      struct directory *,
03265                      const char *newname));
03266 
03267 
03268 /* db_match.c */
03269 RT_EXPORT BU_EXTERN(void db_update_nref,
03270                     (struct db_i *dbip,
03271                      struct resource *resp));
03272 
03273 RT_EXPORT BU_EXTERN(int db_regexp_match,
03274                     (const char *pattern,
03275                      const char *string));
03276 RT_EXPORT BU_EXTERN(int db_regexp_match_all,
03277                     (struct bu_vls *dest,
03278                      struct db_i *dbip,
03279                      const char *pattern));
03280 
03281 /* db_flags.c */
03282 RT_EXPORT BU_EXTERN(int db_flags_internal,
03283                     (const struct rt_db_internal *intern));
03284 
03285 RT_EXPORT BU_EXTERN(int db_flags_raw_internal,
03286                     (const struct db5_raw_internal *intern));
03287 
03288 /* db_alloc.c */
03289 
03290 /* allocate "count" granules */
03291 RT_EXPORT BU_EXTERN(int db_alloc,
03292                     (struct db_i *,
03293                      struct directory *dp,
03294                      int count));
03295 /* delete "recnum" from entry */
03296 RT_EXPORT BU_EXTERN(int db_delrec,
03297                     (struct db_i *,
03298                      struct directory *dp,
03299                      int recnum));
03300 /* delete all granules assigned dp */
03301 RT_EXPORT BU_EXTERN(int db_delete,
03302                     (struct db_i *,
03303                      struct directory *dp));
03304 /* write FREE records from 'start' */
03305 RT_EXPORT BU_EXTERN(int db_zapper,
03306                     (struct db_i *,
03307                      struct directory *dp,
03308                      int start));
03309 
03310 /* db_tree.c */
03311 RT_EXPORT BU_EXTERN(void db_dup_db_tree_state,
03312                     (struct db_tree_state *otsp,
03313                      const struct db_tree_state *itsp));
03314 RT_EXPORT BU_EXTERN(void db_free_db_tree_state,
03315                     (struct db_tree_state *tsp));
03316 RT_EXPORT BU_EXTERN(void db_init_db_tree_state,
03317                     (struct db_tree_state *tsp,
03318                      struct db_i *dbip,
03319                      struct resource *resp));
03320 RT_EXPORT BU_EXTERN(struct combined_tree_state *db_new_combined_tree_state,
03321                     (const struct db_tree_state *tsp,
03322                      const struct db_full_path *pathp));
03323 RT_EXPORT BU_EXTERN(struct combined_tree_state *db_dup_combined_tree_state,
03324                     (const struct combined_tree_state *old));
03325 RT_EXPORT BU_EXTERN(void db_free_combined_tree_state,
03326                     (struct combined_tree_state *ctsp));
03327 RT_EXPORT BU_EXTERN(void db_pr_tree_state,
03328                     (const struct db_tree_state *tsp));
03329 RT_EXPORT BU_EXTERN(void db_pr_combined_tree_state,
03330                     (const struct combined_tree_state *ctsp));
03331 RT_EXPORT BU_EXTERN(int db_apply_state_from_comb,
03332                     (struct db_tree_state *tsp,
03333                      const struct db_full_path *pathp,
03334                      const struct rt_comb_internal *comb));
03335 RT_EXPORT BU_EXTERN(int db_apply_state_from_memb,
03336                     (struct db_tree_state *tsp,
03337                      struct db_full_path *pathp,
03338                      const union tree *tp));
03339 RT_EXPORT BU_EXTERN(int db_apply_state_from_one_member,
03340                     (struct db_tree_state *tsp,
03341                      struct db_full_path *pathp,
03342                      const char *cp,
03343                      int sofar,
03344                      const union tree *tp));
03345 RT_EXPORT BU_EXTERN(union tree *db_find_named_leaf,
03346                     (union tree *tp, const char *cp));
03347 RT_EXPORT BU_EXTERN(union tree *db_find_named_leafs_parent,
03348                     (int *side,
03349                      union tree *tp,
03350                      const char *cp));
03351 RT_EXPORT BU_EXTERN(void db_tree_del_lhs,
03352                     (union tree *tp,
03353                      struct resource *resp));
03354 RT_EXPORT BU_EXTERN(void db_tree_del_rhs,
03355                     (union tree *tp,
03356                      struct resource *resp));
03357 RT_EXPORT BU_EXTERN(int db_tree_del_dbleaf,
03358                     (union tree **tp,
03359                      const char *cp,
03360                      struct resource *resp));
03361 RT_EXPORT BU_EXTERN(void db_tree_mul_dbleaf,
03362                     (union tree *tp,
03363                      const mat_t mat));
03364 RT_EXPORT BU_EXTERN(void db_tree_funcleaf,
03365                     (struct db_i                *dbip,
03366                      struct rt_comb_internal    *comb,
03367                      union tree         *comb_tree,
03368                      void               (*leaf_func)(),
03369                      genptr_t           user_ptr1,
03370                      genptr_t           user_ptr2,
03371                      genptr_t           user_ptr3));
03372 RT_EXPORT BU_EXTERN(int db_follow_path,
03373                     (struct db_tree_state       *tsp,
03374                      struct db_full_path        *total_path,
03375                      const struct db_full_path  *new_path,
03376                      int                        noisy,
03377                      int                        depth));
03378 RT_EXPORT BU_EXTERN(int db_follow_path_for_state,
03379                     (struct db_tree_state *tsp,
03380                      struct db_full_path *pathp,
03381                      const char *orig_str, int noisy));
03382 RT_EXPORT BU_EXTERN(union tree *db_recurse,
03383                     (struct db_tree_state       *tsp,
03384                      struct db_full_path *pathp,
03385                      struct combined_tree_state **region_start_statepp,
03386                      genptr_t client_data));
03387 RT_EXPORT BU_EXTERN(union tree *db_dup_subtree,
03388                     (const union tree *tp,
03389                      struct resource *resp));
03390 RT_EXPORT BU_EXTERN(void db_ck_tree,
03391                     (const union tree *tp));
03392 RT_EXPORT BU_EXTERN(void db_free_tree,
03393                     (union tree *tp,
03394                      struct resource *resp));
03395 RT_EXPORT BU_EXTERN(void db_left_hvy_node,
03396                     (union tree *tp));
03397 RT_EXPORT BU_EXTERN(void db_non_union_push,
03398                     (union tree *tp,
03399                      struct resource *resp));
03400 RT_EXPORT BU_EXTERN(int db_count_tree_nodes,
03401                     (const union tree *tp,
03402                      int count));
03403 RT_EXPORT BU_EXTERN(int db_is_tree_all_unions,
03404                     (const union tree *tp));
03405 RT_EXPORT BU_EXTERN(int db_count_subtree_regions,
03406                     (const union tree *tp));
03407 RT_EXPORT BU_EXTERN(int db_tally_subtree_regions,
03408                     (union tree *tp,
03409                      union tree **reg_trees,
03410                      int                cur,
03411                      int                lim,
03412                      struct resource *resp));
03413 RT_EXPORT BU_EXTERN(int db_walk_tree,
03414                     (struct db_i *dbip,
03415                      int argc,
03416                      const char **argv,
03417                      int ncpu,
03418                      const struct db_tree_state *init_state,
03419                      int (*reg_start_func) (struct db_tree_state * /*tsp*/,
03420                                             struct db_full_path * /*pathp*/,
03421                                             const struct rt_comb_internal * /* combp */,
03422                                             genptr_t client_data),
03423                      union tree *(*reg_end_func) (struct db_tree_state * /*tsp*/,
03424                                                   struct db_full_path * /*pathp*/,
03425                                                   union tree * /*curtree*/,
03426                                                   genptr_t client_data),
03427                      union tree *(*leaf_func) (struct db_tree_state * /*tsp*/,
03428                                                struct db_full_path * /*pathp*/,
03429                                                struct rt_db_internal * /*ip*/,
03430                                                genptr_t client_data ),
03431                      genptr_t client_data ));
03432 RT_EXPORT BU_EXTERN(int db_path_to_mat,
03433                     (struct db_i                *dbip,
03434                      struct db_full_path        *pathp,
03435                      mat_t                      mat,            /* result */
03436                      int                        depth,          /* number of arcs */
03437                      struct resource            *resp));
03438 RT_EXPORT BU_EXTERN(void db_apply_anims,
03439                     (struct db_full_path *pathp,
03440                      struct directory *dp,
03441                      mat_t stck,
03442                      mat_t arc,
03443                      struct mater_info *materp));
03444 /* XXX db_shader_mat, should be called rt_shader_mat */
03445 RT_EXPORT BU_EXTERN(int db_region_mat,
03446                     (mat_t              m,              /* result */
03447                      struct db_i        *dbip,
03448                      const char *name,
03449                      struct resource *resp));
03450 RT_EXPORT BU_EXTERN(int db_shader_mat,
03451                     (mat_t                      model_to_shader,        /* result */
03452                      const struct rt_i  *rtip,
03453                      const struct region        *rp,
03454                      point_t                    p_min,  /* input/output: shader/region min point */
03455                      point_t                    p_max,  /* input/output: shader/region max point */
03456                      struct resource            *resp));
03457 
03458 /* dir.c */
03459 RT_EXPORT BU_EXTERN(struct rt_i *rt_dirbuild,
03460                     (const char *filename,
03461                      char *buf, int len));
03462 RT_EXPORT BU_EXTERN(int rt_db_get_internal,
03463                     (struct rt_db_internal      *ip,
03464                      const struct directory     *dp,
03465                      const struct db_i  *dbip,
03466                      const mat_t                mat,
03467                      struct resource            *resp));
03468 RT_EXPORT BU_EXTERN(int rt_db_put_internal,
03469                     (struct directory   *dp,
03470                      struct db_i                *dbip,
03471                      struct rt_db_internal      *ip,
03472                      struct resource            *resp));
03473 RT_EXPORT BU_EXTERN(int rt_fwrite_internal,
03474                     (FILE *fp,
03475                      const char *name,
03476                      const struct rt_db_internal *ip,
03477                      double conv2mm));
03478 RT_EXPORT BU_EXTERN(void rt_db_free_internal,
03479                     (struct rt_db_internal *ip,
03480                      struct resource *resp));
03481 RT_EXPORT BU_EXTERN(int rt_db_lookup_internal,
03482                     (struct db_i *dbip,
03483                      const char *obj_name,
03484                      struct directory **dpp,
03485                      struct rt_db_internal *ip,
03486                      int noisy,
03487                      struct resource *resp));
03488 RT_EXPORT BU_EXTERN(void rt_optim_tree,
03489                     (register union tree *tp,
03490                      struct resource *resp));
03491 RT_EXPORT BU_EXTERN(void db_get_directory,
03492                     (register struct resource *resp));
03493 
03494 /* db_walk.c */
03495 RT_EXPORT BU_EXTERN(void db_functree,
03496                     (struct db_i *dbip,
03497                      struct directory *dp,
03498                      void (*comb_func)(struct db_i *,
03499                                        struct directory *,
03500                                        genptr_t),
03501                      void (*leaf_func)(struct db_i *,
03502                                        struct directory *,
03503                                        genptr_t),
03504                      struct resource *resp,
03505                      genptr_t client_data));
03506 
03507 /*
03508 RT_EXPORT BU_EXTERN(void db_preorder_traverse,
03509                     (struct directory *dp,
03510                     struct db_traverse *dtp));
03511 */
03512 
03513 /* g_arb.c */
03514 RT_EXPORT BU_EXTERN(int rt_arb_get_cgtype,
03515                     ());                /* needs rt_arb_internal for arg list */
03516 RT_EXPORT BU_EXTERN(int rt_arb_std_type,
03517                     (const struct rt_db_internal *ip,
03518                      const struct bn_tol *tol));
03519 RT_EXPORT BU_EXTERN(void rt_arb_centroid,
03520                     ());                /* needs rt_arb_internal for arg list */
03521 RT_EXPORT BU_EXTERN(int rt_arb_calc_points,
03522                     ());                /* needs wdb.h for arg list */
03523 RT_EXPORT BU_EXTERN(int rt_arb_3face_intersect,
03524                     (point_t                    point,
03525                      const plane_t              planes[6],
03526                      int                        type,           /* 4..8 */
03527                      int                        loc));
03528 #ifdef SEEN_RTGEOM_H
03529 RT_EXPORT BU_EXTERN(int rt_arb_calc_planes,
03530                     (Tcl_Interp                 *interp,
03531                      struct rt_arb_internal     *arb,
03532                      int                        type,
03533                      plane_t                    planes[6],
03534                      const struct bn_tol        *tol));
03535 RT_EXPORT BU_EXTERN(int rt_arb_move_edge,
03536                     (Tcl_Interp         *interp,
03537                      struct rt_arb_internal     *arb,
03538                      vect_t                     thru,
03539                      int                        bp1,
03540                      int                        bp2,
03541                      int                        end1,
03542                      int                        end2,
03543                      const vect_t               dir,
03544                      plane_t                    planes[6],
03545                      const struct bn_tol        *tol));
03546 RT_EXPORT BU_EXTERN(int rt_arb_edit,
03547                     (Tcl_Interp                 *interp,
03548                      struct rt_arb_internal     *arb,
03549                      int                        arb_type,
03550                      int                        edit_type,
03551                      vect_t                     pos_model,
03552                      plane_t                    planes[6],
03553                      const struct bn_tol        *tol));
03554 #endif
03555 RT_EXPORT extern const int rt_arb_faces[5][24];
03556 RT_EXPORT extern short earb8[12][18];
03557 RT_EXPORT extern short earb7[12][18];
03558 RT_EXPORT extern short earb6[10][18];
03559 RT_EXPORT extern short earb5[9][18];
03560 RT_EXPORT extern short earb4[5][18];
03561 
03562 /* g_epa.c */
03563 RT_EXPORT BU_EXTERN(void rt_ell,
03564                     (fastf_t *ov,
03565                      const fastf_t *V,
03566                      const fastf_t *A,
03567                      const fastf_t *B,
03568                      int sides));
03569 
03570 /* g_pipe.c */
03571 RT_EXPORT BU_EXTERN(void rt_vls_pipept,
03572                     (struct bu_vls *vp,
03573                      int seg_no,
03574                      const struct rt_db_internal *ip,
03575                      double mm2local));
03576 RT_EXPORT BU_EXTERN(void rt_pipept_print,
03577                     ());                /* needs wdb_pipept for arg */
03578 RT_EXPORT BU_EXTERN(int rt_pipe_ck,
03579                     (const struct bu_list *headp));
03580 
03581 /* g_rpc.c */
03582 RT_EXPORT BU_EXTERN(int rt_mk_parabola,
03583                     (struct rt_pt_node *pts,
03584                      fastf_t r,
03585                      fastf_t b,
03586                      fastf_t dtol,
03587                      fastf_t ntol));
03588 RT_EXPORT BU_EXTERN(struct rt_pt_node *rt_ptalloc,
03589                     ());
03590 
03591 /* memalloc.c -- non PARALLEL routines */
03592 RT_EXPORT BU_EXTERN(unsigned long rt_memalloc,
03593                     (struct mem_map **pp,
03594                      unsigned size));
03595 RT_EXPORT BU_EXTERN(struct mem_map * rt_memalloc_nosplit,
03596                     (struct mem_map **pp,
03597                      unsigned size));
03598 RT_EXPORT BU_EXTERN(unsigned long rt_memget,
03599                     (struct mem_map **pp,
03600                      unsigned int size,
03601                      unsigned int place));
03602 RT_EXPORT BU_EXTERN(void rt_memfree,
03603                     (struct mem_map **pp,
03604                      unsigned size,
03605                      unsigned long addr));
03606 RT_EXPORT BU_EXTERN(void rt_mempurge,
03607                     (struct mem_map **pp));
03608 RT_EXPORT BU_EXTERN(void rt_memprint,
03609                     (struct mem_map **pp));
03610 RT_EXPORT BU_EXTERN(void rt_memclose,
03611                     ());
03612 
03613 RT_EXPORT BU_EXTERN(struct bn_vlblock *rt_vlblock_init,
03614                     ());
03615 RT_EXPORT BU_EXTERN(void rt_vlblock_free,
03616                     (struct bn_vlblock *vbp));
03617 RT_EXPORT BU_EXTERN(struct bu_list *rt_vlblock_find,
03618                     (struct bn_vlblock *vbp,
03619                      int r,
03620                      int g,
03621                      int b));
03622 
03623 /* g_ars.c */
03624 RT_EXPORT BU_EXTERN(void rt_hitsort,
03625                     (struct hit h[],
03626                      int nh));
03627 
03628 /* g_pg.c */
03629 RT_EXPORT BU_EXTERN(int rt_pg_to_bot,
03630                     (struct rt_db_internal *ip,
03631                      const struct bn_tol *tol,
03632                      struct resource *resp0));
03633 RT_EXPORT BU_EXTERN(int rt_pg_plot,
03634                     (struct bu_list             *vhead,
03635                      struct rt_db_internal      *ip,
03636                      const struct rt_tess_tol *ttol,
03637                      const struct bn_tol        *tol));
03638 RT_EXPORT BU_EXTERN(int rt_pg_plot_poly,
03639                     (struct bu_list             *vhead,
03640                      struct rt_db_internal      *ip,
03641                      const struct rt_tess_tol   *ttol,
03642                      const struct bn_tol        *tol));
03643 
03644 /* g_hf.c */
03645 RT_EXPORT BU_EXTERN(int rt_hf_to_dsp,
03646                     (struct rt_db_internal *db_intern,
03647                      struct resource *resp));
03648 
03649 /* g_dsp.c */
03650 RT_EXPORT BU_EXTERN(int dsp_pos,
03651                     (point_t out,
03652                      struct soltab *stp,
03653                      point_t p));
03654 
03655 /* pr.c */
03656 RT_EXPORT BU_EXTERN(void rt_pr_soltab,
03657                     (const struct soltab *stp));
03658 RT_EXPORT BU_EXTERN(void rt_pr_region,
03659                     (const struct region *rp));
03660 RT_EXPORT BU_EXTERN(void rt_pr_partitions,
03661                     (const struct rt_i *rtip,
03662                      const struct partition     *phead,
03663                      const char *title));
03664 RT_EXPORT BU_EXTERN(void rt_pr_pt_vls,
03665                     (struct bu_vls *v,
03666                      const struct rt_i *rtip,
03667                      const struct partition *pp));
03668 RT_EXPORT BU_EXTERN(void rt_pr_pt,
03669                     (const struct rt_i *rtip,
03670                      const struct partition *pp));
03671 RT_EXPORT BU_EXTERN(void rt_pr_seg_vls,
03672                     (struct bu_vls *,
03673                      const struct seg *));
03674 RT_EXPORT BU_EXTERN(void rt_pr_seg,
03675                     (const struct seg *segp));
03676 RT_EXPORT BU_EXTERN(void rt_pr_hit,
03677                     (const char *str,
03678                      const struct hit   *hitp));
03679 RT_EXPORT BU_EXTERN(void rt_pr_hit_vls,
03680                     (struct bu_vls *v,
03681                      const char *str,
03682                      const struct hit *hitp));
03683 RT_EXPORT BU_EXTERN(void rt_pr_hitarray_vls,
03684                     (struct bu_vls *v,
03685                      const char *str,
03686                      const struct hit *hitp,
03687                      int count));
03688 RT_EXPORT BU_EXTERN(void rt_pr_tree,
03689                     (const union tree *tp,
03690                      int lvl));
03691 RT_EXPORT BU_EXTERN(void rt_pr_tree_vls,
03692                     (struct bu_vls *vls,
03693                      const union tree *tp));
03694 RT_EXPORT BU_EXTERN(char *rt_pr_tree_str,
03695                     (const union tree *tree));
03696 RT_EXPORT BU_EXTERN(void rt_pr_tree_val,
03697                     (const union tree *tp,
03698                      const struct partition *partp,
03699                      int pr_name,
03700                      int lvl));
03701 RT_EXPORT BU_EXTERN(void rt_pr_fallback_angle,
03702                     (struct bu_vls *str,
03703                      const char *prefix,
03704                      const double angles[5]));
03705 RT_EXPORT BU_EXTERN(void rt_find_fallback_angle,
03706                     (double angles[5],
03707                      const vect_t vec));
03708 RT_EXPORT BU_EXTERN(void rt_pr_tol,
03709                     (const struct bn_tol *tol));
03710 
03711 /* regionfix.c */
03712 RT_EXPORT BU_EXTERN(void rt_regionfix,
03713                     (struct rt_i *rtip));
03714 
03715 /* table.c */
03716 RT_EXPORT BU_EXTERN(int rt_id_solid,
03717                     (struct bu_external *ep));
03718 RT_EXPORT BU_EXTERN(const struct rt_functab *rt_get_functab_by_label,
03719                     (const char *label));
03720 RT_EXPORT BU_EXTERN(int rt_generic_xform,
03721                     (struct rt_db_internal      *op,
03722                      const mat_t                mat,
03723                      struct rt_db_internal      *ip,
03724                      int                        avail,
03725                      struct db_i                *dbip,
03726                      struct resource            *resp));
03727 
03728 RT_EXPORT BU_EXTERN(void rt_nul_make,
03729                     (const struct rt_functab *ftp,
03730                      struct rt_db_internal *intern,
03731                      double diameter));
03732 
03733 /* prep.c */
03734 RT_EXPORT BU_EXTERN(void rt_plot_all_bboxes,
03735                     (FILE *fp,
03736                      struct rt_i *rtip));
03737 RT_EXPORT BU_EXTERN(void rt_plot_all_solids,
03738                     (FILE               *fp,
03739                      struct rt_i        *rtip,
03740                      struct resource    *resp));
03741 RT_EXPORT BU_EXTERN(void rt_init_resource,
03742                     (struct resource *resp,
03743                      int                cpu_num,
03744                      struct rt_i        *rtip));
03745 RT_EXPORT BU_EXTERN(void rt_clean_resource,
03746                     (struct rt_i *rtip,
03747                      struct resource *resp));
03748 RT_EXPORT BU_EXTERN(int rt_unprep,
03749                     (struct rt_i *rtip,
03750                      struct rt_reprep_obj_list *objs,
03751                      struct resource *resp));
03752 RT_EXPORT BU_EXTERN(int rt_reprep,
03753                     (struct rt_i *rtip,
03754                      struct rt_reprep_obj_list *objs,
03755                      struct resource *resp));
03756 RT_EXPORT BU_EXTERN(int re_prep_solids,
03757                     (struct rt_i *rtip,
03758                      int num_solids,
03759                      char **solid_names,
03760                      struct resource *resp));
03761 RT_EXPORT BU_EXTERN(int rt_find_paths,
03762                     (struct db_i *dbip,
03763                      struct directory *start,
03764                      struct directory *end,
03765                      struct bu_ptbl *paths,
03766                      struct resource *resp));
03767 RT_EXPORT BU_EXTERN(struct bu_bitv *get_solidbitv,
03768                     (long nbits,
03769                      struct resource *resp));
03770 
03771 /* shoot.c */
03772 RT_EXPORT BU_EXTERN(void rt_add_res_stats,
03773                     (struct rt_i *rtip,
03774                      struct resource *resp));
03775                     /* Tally stats into struct rt_i */
03776 RT_EXPORT BU_EXTERN(void rt_zero_res_stats,
03777                     (struct resource *resp));
03778 RT_EXPORT BU_EXTERN(void rt_res_pieces_clean,
03779                     (struct resource *resp,
03780                      struct rt_i *rtip));
03781 RT_EXPORT BU_EXTERN(void rt_res_pieces_init,
03782                     (struct resource *resp,
03783                      struct rt_i *rtip));
03784 RT_EXPORT BU_EXTERN(void rt_vstub,
03785                     (struct soltab *stp[],
03786                      struct xray *rp[],
03787                      struct  seg segp[],
03788                      int n,
03789                      struct application *ap));
03790 
03791 
03792 /* tree.c */
03793 RT_EXPORT BU_EXTERN(int rt_bound_tree,
03794                     (const union tree   *tp,
03795                      vect_t             tree_min,
03796                      vect_t             tree_max));
03797 RT_EXPORT BU_EXTERN(int rt_tree_elim_nops,
03798                     (union tree *,
03799                      struct resource *resp));
03800 
03801 
03802 /* vlist.c */
03803 /* XXX Has some stuff mixed in here that should go in LIBBN */
03804 RT_EXPORT BU_EXTERN(struct bn_vlblock *bn_vlblock_init,
03805                     (struct bu_list     *free_vlist_hd,         /* where to get/put free vlists */
03806                      int                max_ent));
03807 RT_EXPORT BU_EXTERN(struct bn_vlblock * rt_vlblock_init,
03808                     ());
03809 RT_EXPORT BU_EXTERN(void rt_vlblock_free,
03810                     (struct bn_vlblock *vbp));
03811 RT_EXPORT BU_EXTERN(struct bu_list *rt_vlblock_find,
03812                     (struct bn_vlblock *vbp,
03813                      int r,
03814                      int g,
03815                      int b));
03816 RT_EXPORT BU_EXTERN(int rt_ck_vlist,
03817                     (const struct bu_list *vhead));
03818 RT_EXPORT BU_EXTERN(void rt_vlist_copy,
03819                     (struct bu_list *dest,
03820                      const struct bu_list *src));
03821 RT_EXPORT BU_EXTERN(void bn_vlist_cleanup,
03822                     (struct bu_list *hd));
03823 RT_EXPORT BU_EXTERN(void rt_vlist_cleanup,
03824                     ());
03825 RT_EXPORT BU_EXTERN(void bn_vlist_rpp,
03826                     (struct bu_list *hd,
03827                      const point_t minn,
03828                      const point_t maxx));
03829 RT_EXPORT BU_EXTERN(void rt_vlist_export,
03830                     (struct bu_vls *vls,
03831                      struct bu_list *hp,
03832                      const char *name));
03833 RT_EXPORT BU_EXTERN(void rt_vlist_import,
03834                     (struct bu_list *hp,
03835                      struct bu_vls *namevls,
03836                      const unsigned char *buf));
03837 RT_EXPORT BU_EXTERN(void rt_plot_vlblock,
03838                     (FILE *fp,
03839                      const struct bn_vlblock *vbp));
03840 RT_EXPORT BU_EXTERN(void rt_vlist_to_uplot,
03841                     (FILE *fp,
03842                      const struct bu_list *vhead));
03843 RT_EXPORT BU_EXTERN(int rt_process_uplot_value,
03844                     (struct bu_list **vhead,
03845                      struct bn_vlblock *vbp,
03846                      FILE *fp,
03847                      int c,
03848                      double char_size,
03849                      int mode));
03850 RT_EXPORT BU_EXTERN(int rt_uplot_to_vlist,
03851                     (struct bn_vlblock *vbp,
03852                      FILE *fp,
03853                      double char_size,
03854                      int mode));
03855 RT_EXPORT BU_EXTERN(void rt_label_vlist_verts,
03856                     (struct bn_vlblock *vbp,
03857                      struct bu_list *src,
03858                      mat_t mat,
03859                      double sz,
03860                      double mm2local));
03861 
03862 #ifdef SEEN_RTGEOM_H
03863 /* g_sketch.c */
03864 RT_EXPORT BU_EXTERN(void rt_sketch_ifree,
03865                     (struct rt_db_internal      *ip));
03866 RT_EXPORT BU_EXTERN(int curve_to_vlist,
03867                     (struct bu_list             *vhead,
03868                      const struct rt_tess_tol   *ttol,
03869                      point_t                    V,
03870                      vect_t                     u_vec,
03871                      vect_t                     v_vec,
03872                      struct rt_sketch_internal *sketch_ip,
03873                      struct curve               *crv));
03874 
03875 RT_EXPORT BU_EXTERN(int rt_check_curve,
03876                     (struct curve *crv,
03877                      struct rt_sketch_internal *skt,
03878                      int noisey));
03879 
03880 RT_EXPORT BU_EXTERN(void rt_curve_reverse_segment,
03881                     (long *lng));
03882 RT_EXPORT BU_EXTERN(void rt_curve_order_segments,
03883                     (struct curve *crv));
03884 
03885 RT_EXPORT BU_EXTERN(void rt_copy_curve,
03886                     (struct curve *crv_out,
03887                      const struct curve *crv_in));
03888 
03889 RT_EXPORT BU_EXTERN(int rt_check_curve,
03890                     (struct curve *crv,
03891                      struct rt_sketch_internal *skt,
03892                      int noisey));
03893 RT_EXPORT BU_EXTERN(void rt_curve_free,
03894                     (struct curve *crv));
03895 RT_EXPORT BU_EXTERN(void rt_copy_curve,
03896                     (struct curve *crv_out,
03897                      const struct curve *crv_in));
03898 RT_EXPORT BU_EXTERN(struct rt_sketch_internal *rt_copy_sketch,
03899                     (const struct rt_sketch_internal *sketch_ip));
03900 RT_EXPORT BU_EXTERN(int curve_to_tcl_list,
03901                     (struct bu_vls *vls,
03902                      struct curve *crv));
03903 #endif
03904 
03905 /* htbl.c */
03906 RT_EXPORT BU_EXTERN(void rt_htbl_init,
03907                     (struct rt_htbl *b,
03908                      int len,
03909                      const char *str));
03910 RT_EXPORT BU_EXTERN(void rt_htbl_reset,
03911                     (struct rt_htbl *b));
03912 RT_EXPORT BU_EXTERN(void rt_htbl_free,
03913                     (struct rt_htbl *b));
03914 RT_EXPORT BU_EXTERN(struct hit *rt_htbl_get,
03915                     (struct rt_htbl *b));
03916 
03917 /************************************************************************
03918  *                                                                      *
03919  *                      N M G Support Function Declarations             *
03920  *                                                                      *
03921  ************************************************************************/
03922 #if defined(NMG_H)
03923 
03924 /* From file nmg_mk.c */
03925 /*      MAKE routines */
03926 RT_EXPORT BU_EXTERN(struct model *nmg_mm,
03927                     ());
03928 RT_EXPORT BU_EXTERN(struct model *nmg_mmr,
03929                     ());
03930 RT_EXPORT BU_EXTERN(struct nmgregion *nmg_mrsv,
03931                     (struct model *m));
03932 RT_EXPORT BU_EXTERN(struct shell *nmg_msv,
03933                     (struct nmgregion *r_p));
03934 RT_EXPORT BU_EXTERN(struct faceuse *nmg_mf,
03935                     (struct loopuse *lu1));
03936 RT_EXPORT BU_EXTERN(struct loopuse *nmg_mlv,
03937                     (long *magic,
03938                      struct vertex *v,
03939                      int orientation));
03940 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_me,
03941                     (struct vertex *v1,
03942                      struct vertex *v2,
03943                      struct shell *s));
03944 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_meonvu,
03945                     (struct vertexuse *vu));
03946 RT_EXPORT BU_EXTERN(struct loopuse *nmg_ml,
03947                     (struct shell *s));
03948 /*      KILL routines */
03949 RT_EXPORT BU_EXTERN(int nmg_keg,
03950                     (struct edgeuse *eu));
03951 RT_EXPORT BU_EXTERN(int nmg_kvu,
03952                     (struct vertexuse *vu));
03953 RT_EXPORT BU_EXTERN(int nmg_kfu,
03954                     (struct faceuse *fu1));
03955 RT_EXPORT BU_EXTERN(int nmg_klu,
03956                     (struct loopuse *lu1));
03957 RT_EXPORT BU_EXTERN(int nmg_keu,
03958                     (struct edgeuse *eu));
03959 RT_EXPORT BU_EXTERN(int nmg_ks,
03960                     (struct shell *s));
03961 RT_EXPORT BU_EXTERN(int nmg_kr,
03962                     (struct nmgregion *r));
03963 RT_EXPORT BU_EXTERN(void nmg_km,
03964                     (struct model *m));
03965 /*      Geometry and Attribute routines */
03966 RT_EXPORT BU_EXTERN(void nmg_vertex_gv,
03967                     (struct vertex *v,
03968                      const point_t pt));
03969 RT_EXPORT BU_EXTERN(void nmg_vertex_g,
03970                     (struct vertex *v,
03971                      fastf_t x,
03972                      fastf_t y,
03973                      fastf_t z));
03974 RT_EXPORT BU_EXTERN(void nmg_vertexuse_nv,
03975                     (struct vertexuse *vu,
03976                      const vect_t norm));
03977 RT_EXPORT BU_EXTERN(void nmg_vertexuse_a_cnurb,
03978                     (struct vertexuse *vu,
03979                      const fastf_t *uvw));
03980 RT_EXPORT BU_EXTERN(void nmg_edge_g,
03981                     (struct edgeuse *eu));
03982 RT_EXPORT BU_EXTERN(void nmg_edge_g_cnurb,
03983                     (struct edgeuse *eu,
03984                      int order,
03985                      int n_knots,
03986                      fastf_t *kv,
03987                      int n_pts,
03988                      int pt_type,
03989                      fastf_t *points));
03990 RT_EXPORT BU_EXTERN(void nmg_edge_g_cnurb_plinear,
03991                     (struct edgeuse *eu));
03992 RT_EXPORT BU_EXTERN(int nmg_use_edge_g,
03993                     (struct edgeuse *eu,
03994                      long *eg));
03995 RT_EXPORT BU_EXTERN(void nmg_loop_g,
03996                     (struct loop *l,
03997                      const struct bn_tol *tol));
03998 RT_EXPORT BU_EXTERN(void nmg_face_g,
03999                     (struct faceuse *fu,
04000                      const plane_t p));
04001 RT_EXPORT BU_EXTERN(void nmg_face_new_g,
04002                     (struct faceuse *fu,
04003                      const plane_t pl));
04004 RT_EXPORT BU_EXTERN(void nmg_face_g_snurb,
04005                     (struct faceuse *fu,
04006                      int u_order,
04007                      int v_order,
04008                      int n_u_knots,
04009                      int n_v_knots,
04010                      fastf_t *ukv,
04011                      fastf_t *vkv,
04012                      int n_rows,
04013                      int n_cols,
04014                      int pt_type,
04015                      fastf_t *mesh));
04016 RT_EXPORT BU_EXTERN(void nmg_face_bb,
04017                     (struct face *f,
04018                      const struct bn_tol *tol));
04019 RT_EXPORT BU_EXTERN(void nmg_shell_a,
04020                     (struct shell *s,
04021                      const struct bn_tol *tol));
04022 RT_EXPORT BU_EXTERN(void nmg_region_a,
04023                     (struct nmgregion *r,
04024                      const struct bn_tol *tol));
04025 /*      DEMOTE routines */
04026 RT_EXPORT BU_EXTERN(int nmg_demote_lu,
04027                     (struct loopuse *lu));
04028 RT_EXPORT BU_EXTERN(int nmg_demote_eu,
04029                     (struct edgeuse *eu));
04030 /*      MODIFY routines */
04031 RT_EXPORT BU_EXTERN(void nmg_movevu,
04032                     (struct vertexuse *vu,
04033                      struct vertex *v));
04034 #define nmg_moveeu(a,b)         nmg_je(a,b)
04035 RT_EXPORT BU_EXTERN(void nmg_je,
04036                     (struct edgeuse *eudst,
04037                      struct edgeuse *eusrc));
04038 RT_EXPORT BU_EXTERN(void nmg_unglueedge,
04039                     (struct edgeuse *eu));
04040 RT_EXPORT BU_EXTERN(void nmg_jv,
04041                     (struct vertex *v1,
04042                      struct vertex *v2));
04043 RT_EXPORT BU_EXTERN(void nmg_jfg,
04044                     (struct face *f1,
04045                      struct face *f2));
04046 RT_EXPORT BU_EXTERN(void nmg_jeg,
04047                     (struct edge_g_lseg *dest_eg,
04048                      struct edge_g_lseg *src_eg));
04049 
04050 /* From nmg_mod.c */
04051 /*      REGION Routines */
04052 RT_EXPORT BU_EXTERN(void nmg_merge_regions,
04053                     (struct nmgregion *r1,
04054                      struct nmgregion *r2,
04055                      const struct bn_tol *tol));
04056 
04057 /*      SHELL Routines */
04058 RT_EXPORT BU_EXTERN(void nmg_shell_coplanar_face_merge,
04059                     (struct shell *s,
04060                      const struct bn_tol *tol,
04061                      const int simplify));
04062 RT_EXPORT BU_EXTERN(int nmg_simplify_shell,
04063                     (struct shell *s));
04064 RT_EXPORT BU_EXTERN(void nmg_rm_redundancies,
04065                     (struct shell *s,
04066                      const struct bn_tol *tol));
04067 RT_EXPORT BU_EXTERN(void nmg_sanitize_s_lv,
04068                     (struct shell *s,
04069                      int orient));
04070 RT_EXPORT BU_EXTERN(void nmg_s_split_touchingloops,
04071                     (struct shell *s,
04072                      const struct bn_tol *tol));
04073 RT_EXPORT BU_EXTERN(void nmg_s_join_touchingloops,
04074                     (struct shell               *s,
04075                      const struct bn_tol        *tol));
04076 RT_EXPORT BU_EXTERN(void nmg_js,
04077                     (struct shell       *s1,
04078                      struct shell       *s2,
04079                      const struct bn_tol        *tol));
04080 RT_EXPORT BU_EXTERN(void nmg_invert_shell,
04081                     (struct shell               *s,
04082                      const struct bn_tol        *tol));
04083 
04084 /*      FACE Routines */
04085 RT_EXPORT BU_EXTERN(struct faceuse *nmg_cmface,
04086                     (struct shell *s,
04087                      struct vertex **vt[],
04088                      int n));
04089 RT_EXPORT BU_EXTERN(struct faceuse *nmg_cface,
04090                     (struct shell *s,
04091                      struct vertex **vt,
04092                      int n));
04093 RT_EXPORT BU_EXTERN(struct faceuse *nmg_add_loop_to_face,
04094                     (struct shell *s,
04095                      struct faceuse *fu,
04096                      struct vertex **verts,
04097                      int n,
04098                      int dir));
04099 RT_EXPORT BU_EXTERN(int nmg_fu_planeeqn,
04100                     (struct faceuse *fu,
04101                      const struct bn_tol *tol));
04102 RT_EXPORT BU_EXTERN(void nmg_gluefaces,
04103                     (struct faceuse *fulist[],
04104                      int n,
04105                      const struct bn_tol *tol));
04106 RT_EXPORT BU_EXTERN(int nmg_simplify_face,
04107                     (struct faceuse *fu));
04108 RT_EXPORT BU_EXTERN(void nmg_reverse_face,
04109                     (struct faceuse *fu));
04110 RT_EXPORT BU_EXTERN(void nmg_mv_fu_between_shells,
04111                     (struct shell *dest,
04112                      struct shell *src,
04113                      struct faceuse *fu));
04114 RT_EXPORT BU_EXTERN(void nmg_jf,
04115                     (struct faceuse *dest_fu,
04116                      struct faceuse *src_fu));
04117 RT_EXPORT BU_EXTERN(struct faceuse *nmg_dup_face,
04118                     (struct faceuse *fu,
04119                      struct shell *s));
04120 /*      LOOP Routines */
04121 RT_EXPORT BU_EXTERN(void nmg_jl,
04122                     (struct loopuse *lu,
04123                      struct edgeuse *eu));
04124 RT_EXPORT BU_EXTERN(struct vertexuse *nmg_join_2loops,
04125                     (struct vertexuse *vu1,
04126                      struct vertexuse *vu2));
04127 RT_EXPORT BU_EXTERN(struct vertexuse *nmg_join_singvu_loop,
04128                     (struct vertexuse *vu1,
04129                      struct vertexuse *vu2));
04130 RT_EXPORT BU_EXTERN(struct vertexuse *nmg_join_2singvu_loops,
04131                     (struct vertexuse *vu1,
04132                      struct vertexuse *vu2));
04133 RT_EXPORT BU_EXTERN(struct loopuse *nmg_cut_loop,
04134                     (struct vertexuse *vu1,
04135                      struct vertexuse *vu2));
04136 RT_EXPORT BU_EXTERN(struct loopuse *nmg_split_lu_at_vu,
04137                     (struct loopuse *lu,
04138                      struct vertexuse *vu));
04139 RT_EXPORT BU_EXTERN(struct vertexuse *nmg_find_repeated_v_in_lu,
04140                     (struct vertexuse *vu));
04141 RT_EXPORT BU_EXTERN(void nmg_split_touchingloops,
04142                     (struct loopuse *lu,
04143                      const struct bn_tol *tol));
04144 RT_EXPORT BU_EXTERN(int nmg_join_touchingloops,
04145                     (struct loopuse *lu));
04146 RT_EXPORT BU_EXTERN(int nmg_get_touching_jaunts,
04147                     (const struct loopuse *lu,
04148                      struct bu_ptbl *tbl,
04149                      int *need_init));
04150 RT_EXPORT BU_EXTERN(void nmg_kill_accordions,
04151                     (struct loopuse *lu));
04152 RT_EXPORT BU_EXTERN(int nmg_loop_split_at_touching_jaunt,
04153                     (struct loopuse             *lu,
04154                      const struct bn_tol        *tol));
04155 RT_EXPORT BU_EXTERN(void nmg_simplify_loop,
04156                     (struct loopuse *lu));
04157 RT_EXPORT BU_EXTERN(int nmg_kill_snakes,
04158                     (struct loopuse *lu));
04159 RT_EXPORT BU_EXTERN(void nmg_mv_lu_between_shells,
04160                     (struct shell *dest,
04161                      struct shell *src,
04162                      struct loopuse *lu));
04163 RT_EXPORT BU_EXTERN(void nmg_moveltof,
04164                     (struct faceuse *fu,
04165                      struct shell *s));
04166 RT_EXPORT BU_EXTERN(struct loopuse *nmg_dup_loop,
04167                     (struct loopuse *lu,
04168                      long *parent,
04169                      long **trans_tbl));
04170 RT_EXPORT BU_EXTERN(void nmg_set_lu_orientation,
04171                     (struct loopuse *lu,
04172                      int is_opposite));
04173 RT_EXPORT BU_EXTERN(void nmg_lu_reorient,
04174                     (struct loopuse *lu));
04175 /*      EDGE Routines */
04176 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_eusplit,
04177                     (struct vertex *v,
04178                      struct edgeuse *oldeu,
04179                      int share_geom));
04180 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_esplit,
04181                     (struct vertex *v,
04182                      struct edgeuse *eu,
04183                      int share_geom));
04184 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_ebreak,
04185                     (struct vertex *v,
04186                      struct edgeuse *eu));
04187 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_ebreaker,
04188                     (struct vertex *v,
04189                      struct edgeuse *eu,
04190                      const struct bn_tol *tol));
04191 RT_EXPORT BU_EXTERN(struct vertex *nmg_e2break,
04192                     (struct edgeuse *eu1,
04193                      struct edgeuse *eu2));
04194 RT_EXPORT BU_EXTERN(int nmg_unbreak_edge,
04195                     (struct edgeuse *eu1_first));
04196 RT_EXPORT BU_EXTERN(int nmg_unbreak_shell_edge_unsafe,
04197                     (struct edgeuse *eu1_first));
04198 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_eins,
04199                     (struct edgeuse *eu));
04200 RT_EXPORT BU_EXTERN(void nmg_mv_eu_between_shells,
04201                     (struct shell *dest,
04202                      struct shell *src,
04203                      struct edgeuse *eu));
04204 /*      VERTEX Routines */
04205 RT_EXPORT BU_EXTERN(void nmg_mv_vu_between_shells,
04206                     (struct shell *dest,
04207                      struct shell *src,
04208                      struct vertexuse *vu));
04209 
04210 /* From nmg_info.c */
04211         /* Model routines */
04212 RT_EXPORT BU_EXTERN(struct model *nmg_find_model,
04213                     (const long *magic_p));
04214                     RT_EXPORT BU_EXTERN(void nmg_model_bb,
04215                     (point_t min_pt,
04216                      point_t max_pt,
04217                      const struct model *m));
04218 
04219 
04220                     /* Shell routines */
04221 RT_EXPORT BU_EXTERN(int nmg_shell_is_empty,
04222                     (const struct shell *s));
04223 RT_EXPORT BU_EXTERN(struct shell *nmg_find_s_of_lu,
04224                     (const struct loopuse *lu));
04225 RT_EXPORT BU_EXTERN(struct shell *nmg_find_s_of_eu,
04226                     (const struct edgeuse *eu));
04227 RT_EXPORT BU_EXTERN(struct shell *nmg_find_s_of_vu,
04228                     (const struct vertexuse *vu));
04229 
04230         /* Face routines */
04231 RT_EXPORT BU_EXTERN(struct faceuse *nmg_find_fu_of_eu,
04232                     (const struct edgeuse *eu));
04233 RT_EXPORT BU_EXTERN(struct faceuse *nmg_find_fu_of_lu,
04234                     (const struct loopuse *lu));
04235 RT_EXPORT BU_EXTERN(struct faceuse *nmg_find_fu_of_vu,
04236                     (const struct vertexuse *vu));
04237 RT_EXPORT BU_EXTERN(struct faceuse *nmg_find_fu_with_fg_in_s,
04238                     (const struct shell *s1,
04239                      const struct faceuse *fu2));
04240 RT_EXPORT BU_EXTERN(double nmg_measure_fu_angle,
04241                     (const struct edgeuse *eu,
04242                      const vect_t xvec,
04243                      const vect_t yvec,
04244                      const vect_t zvec));
04245 
04246         /* Loop routines */
04247 RT_EXPORT BU_EXTERN(struct loopuse*nmg_find_lu_of_vu,
04248                     (const struct vertexuse *vu));
04249 RT_EXPORT BU_EXTERN(int nmg_loop_is_a_crack,
04250                     (const struct loopuse *lu));
04251 RT_EXPORT BU_EXTERN(int nmg_loop_is_ccw,
04252                     (const struct loopuse *lu,
04253                      const plane_t norm,
04254                      const struct bn_tol *tol));
04255 RT_EXPORT BU_EXTERN(const struct vertexuse *nmg_loop_touches_self,
04256                     (const struct loopuse *lu));
04257 RT_EXPORT BU_EXTERN(int nmg_2lu_identical,
04258                     (const struct edgeuse *eu1,
04259                      const struct edgeuse *eu2));
04260 
04261         /* Edge routines */
04262 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_find_matching_eu_in_s,
04263                     (const struct edgeuse       *eu1,
04264                      const struct shell *s2));
04265 RT_EXPORT BU_EXTERN(struct edgeuse      *nmg_findeu,
04266                     (const struct vertex *v1,
04267                      const struct vertex *v2,
04268                      const struct shell *s,
04269                      const struct edgeuse *eup,
04270                      int dangling_only));
04271 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_find_eu_in_face,
04272                     (const struct vertex *v1,
04273                      const struct vertex *v2,
04274                      const struct faceuse *fu,
04275                      const struct edgeuse *eup,
04276                      int dangling_only));
04277 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_find_e,
04278                     (const struct vertex *v1,
04279                      const struct vertex *v2,
04280                      const struct shell *s,
04281                      const struct edge *ep));
04282 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_find_eu_of_vu,
04283                     (const struct vertexuse *vu));
04284 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_find_eu_with_vu_in_lu,
04285                     (const struct loopuse *lu,
04286                      const struct vertexuse *vu));
04287 RT_EXPORT BU_EXTERN(const struct edgeuse *nmg_faceradial,
04288                     (const struct edgeuse *eu));
04289 RT_EXPORT BU_EXTERN(const struct edgeuse *nmg_radial_face_edge_in_shell,
04290                     (const struct edgeuse *eu));
04291 RT_EXPORT BU_EXTERN(const struct edgeuse *nmg_find_edge_between_2fu,
04292                     (const struct faceuse *fu1,
04293                      const struct faceuse *fu2,
04294                      const struct bn_tol *tol));
04295 RT_EXPORT BU_EXTERN(struct edge *nmg_find_e_nearest_pt2,
04296                     (long *magic_p,
04297                      const point_t pt2,
04298                      const mat_t mat,
04299                      const struct bn_tol *tol));
04300 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_find_matching_eu_in_s,
04301                     (const struct edgeuse *eu1,
04302                      const struct shell *s2));
04303 RT_EXPORT BU_EXTERN(void nmg_eu_2vecs_perp,
04304                     (vect_t xvec,
04305                      vect_t yvec,
04306                      vect_t zvec,
04307                      const struct edgeuse *eu,
04308                      const struct bn_tol *tol));
04309 RT_EXPORT BU_EXTERN(int nmg_find_eu_leftvec,
04310                     (vect_t left,
04311                      const struct edgeuse *eu));
04312 RT_EXPORT BU_EXTERN(int nmg_find_eu_left_non_unit,
04313                     (vect_t left,
04314                      const struct edgeuse       *eu));
04315 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_find_ot_same_eu_of_e,
04316                     (const struct edge *e));
04317 
04318         /* Vertex routines */
04319 RT_EXPORT BU_EXTERN(struct vertexuse *nmg_find_v_in_face,
04320                     (const struct vertex *,
04321                      const struct faceuse *));
04322 RT_EXPORT BU_EXTERN(struct vertexuse *nmg_find_v_in_shell,
04323                     (const struct vertex *v,
04324                      const struct shell *s,
04325                      int edges_only));
04326 RT_EXPORT BU_EXTERN(struct vertexuse *nmg_find_pt_in_lu,
04327                     (const struct loopuse *lu,
04328                      const point_t pt,
04329                      const struct bn_tol *tol));
04330 RT_EXPORT BU_EXTERN(struct vertexuse *nmg_find_pt_in_face,
04331                     (const struct faceuse *fu,
04332                      const point_t pt,
04333                      const struct bn_tol *tol));
04334 RT_EXPORT BU_EXTERN(struct vertex *nmg_find_pt_in_shell,
04335                     (const struct shell *s,
04336                      const point_t pt,
04337                      const struct bn_tol *tol));
04338 RT_EXPORT BU_EXTERN(struct vertex *nmg_find_pt_in_model,
04339                     (const struct model *m,
04340                      const point_t pt,
04341                      const struct bn_tol *tol));
04342 RT_EXPORT BU_EXTERN(int nmg_is_vertex_in_edgelist,
04343                     (const struct vertex *v,
04344                      const struct bu_list *hd));
04345 RT_EXPORT BU_EXTERN(int nmg_is_vertex_in_looplist,
04346                     (const struct vertex *v,
04347                      const struct bu_list *hd,
04348                      int singletons));
04349 RT_EXPORT BU_EXTERN(struct vertexuse *nmg_is_vertex_in_face,
04350                     (const struct vertex *v,
04351                      const struct face *f));
04352 RT_EXPORT BU_EXTERN(int nmg_is_vertex_a_selfloop_in_shell,
04353                     (const struct vertex *v,
04354                      const struct shell *s));
04355 RT_EXPORT BU_EXTERN(int nmg_is_vertex_in_facelist,
04356                     (const struct vertex *v,
04357                      const struct bu_list *hd));
04358 RT_EXPORT BU_EXTERN(int nmg_is_edge_in_edgelist,
04359                     (const struct edge *e,
04360                      const struct bu_list *hd));
04361 RT_EXPORT BU_EXTERN(int nmg_is_edge_in_looplist,
04362                     (const struct edge *e,
04363                      const struct bu_list *hd));
04364 RT_EXPORT BU_EXTERN(int nmg_is_edge_in_facelist,
04365                     (const struct edge *e,
04366                      const struct bu_list *hd));
04367 RT_EXPORT BU_EXTERN(int nmg_is_loop_in_facelist,
04368                     (const struct loop *l,
04369                      const struct bu_list *fu_hd));
04370 
04371 /* Tabulation routines */
04372 RT_EXPORT BU_EXTERN(void nmg_vertex_tabulate,
04373                     (struct bu_ptbl *tab,
04374                      const long *magic_p));
04375 RT_EXPORT BU_EXTERN(void nmg_vertexuse_normal_tabulate,
04376                     (struct bu_ptbl *tab,
04377                      const long *magic_p));
04378 RT_EXPORT BU_EXTERN(void nmg_edgeuse_tabulate,
04379                     (struct bu_ptbl *tab,
04380                      const long *magic_p));
04381 RT_EXPORT BU_EXTERN(void nmg_edge_tabulate,
04382                     (struct bu_ptbl *tab,
04383                      const long *magic_p));
04384 RT_EXPORT BU_EXTERN(void nmg_edge_g_tabulate,
04385                     (struct bu_ptbl *tab,
04386                      const long *magic_p));
04387 RT_EXPORT BU_EXTERN(void nmg_face_tabulate,
04388                     (struct bu_ptbl *tab,
04389                      const long *magic_p));
04390 RT_EXPORT BU_EXTERN(void nmg_edgeuse_with_eg_tabulate,
04391                     (struct bu_ptbl *tab,
04392                      const struct edge_g_lseg *eg));
04393 RT_EXPORT BU_EXTERN(void nmg_edgeuse_on_line_tabulate,
04394                     (struct bu_ptbl             *tab,
04395                      const long                 *magic_p,
04396                      const point_t              pt,
04397                      const vect_t               dir,
04398                      const struct bn_tol        *tol));
04399 RT_EXPORT BU_EXTERN(void nmg_e_and_v_tabulate,
04400                     (struct bu_ptbl             *eutab,
04401                      struct bu_ptbl             *vtab,
04402                      const long         *magic_p));
04403 RT_EXPORT BU_EXTERN(int nmg_2edgeuse_g_coincident,
04404                     (const struct edgeuse       *eu1,
04405                      const struct edgeuse       *eu2,
04406                      const struct bn_tol        *tol));
04407 
04408 /* From nmg_extrude.c */
04409 RT_EXPORT BU_EXTERN(void nmg_translate_face,
04410                     (struct faceuse *fu,
04411                      const vect_t Vec,
04412                      const struct bn_tol *tol));
04413 RT_EXPORT BU_EXTERN(int nmg_extrude_face,
04414                     (struct faceuse *fu,
04415                      const vect_t Vec,
04416                      const struct bn_tol *tol));
04417 RT_EXPORT BU_EXTERN(struct vertexuse *nmg_find_vertex_in_lu,
04418                     (const struct vertex *v,
04419                      const struct loopuse *lu));
04420 RT_EXPORT BU_EXTERN(void nmg_fix_overlapping_loops,
04421                     (struct shell *s,
04422                      const struct bn_tol *tol));
04423 RT_EXPORT BU_EXTERN(void nmg_break_crossed_loops,
04424                     (struct shell *is,
04425                      const struct bn_tol *tol));
04426 RT_EXPORT BU_EXTERN(struct shell *nmg_extrude_cleanup,
04427                     (struct shell *is,
04428                      const int is_void,
04429                      const struct bn_tol *tol));
04430 RT_EXPORT BU_EXTERN(void nmg_hollow_shell,
04431                     (struct shell *s,
04432                      const fastf_t thick,
04433                      const int approximate,
04434                      const struct bn_tol *tol));
04435 RT_EXPORT BU_EXTERN(struct shell *nmg_extrude_shell,
04436                     (struct shell *s,
04437                      const fastf_t dist,
04438                      const int normal_ward,
04439                      const int approximate,
04440                      const struct bn_tol *tol));
04441 
04442 /* From nmg_pr.c */
04443 RT_EXPORT BU_EXTERN(char *nmg_orientation,
04444                     (int orientation));
04445 RT_EXPORT BU_EXTERN(void nmg_pr_orient,
04446                     (int orientation,
04447                      const char *h));
04448 RT_EXPORT BU_EXTERN(void nmg_pr_m,
04449                     (const struct model *m));
04450 RT_EXPORT BU_EXTERN(void nmg_pr_r,
04451                     (const struct nmgregion *r,
04452                      char *h));
04453 RT_EXPORT BU_EXTERN(void nmg_pr_sa,
04454                     (const struct shell_a *sa,
04455                      char *h));
04456 RT_EXPORT BU_EXTERN(void nmg_pr_lg,
04457                     (const struct loop_g *lg,
04458                      char *h));
04459 RT_EXPORT BU_EXTERN(void nmg_pr_fg,
04460                     (const long *magic,
04461                      char *h));
04462 RT_EXPORT BU_EXTERN(void nmg_pr_s,
04463                     (const struct shell *s,
04464                      char *h));
04465 RT_EXPORT BU_EXTERN(void  nmg_pr_s_briefly,
04466                     (const struct shell *s,
04467                      char *h));
04468 RT_EXPORT BU_EXTERN(void nmg_pr_f,
04469                     (const struct face *f,
04470                      char *h));
04471 RT_EXPORT BU_EXTERN(void nmg_pr_fu,
04472                     (const struct faceuse *fu,
04473                      char *h));
04474 RT_EXPORT BU_EXTERN(void nmg_pr_fu_briefly,
04475                     (const struct faceuse *fu,
04476                      char *h));
04477 RT_EXPORT BU_EXTERN(void nmg_pr_l,
04478                     (const struct loop *l,
04479                      char *h));
04480 RT_EXPORT BU_EXTERN(void nmg_pr_lu,
04481                     (const struct loopuse *lu,
04482                      char *h));
04483 RT_EXPORT BU_EXTERN(void nmg_pr_lu_briefly,
04484                     (const struct loopuse *lu,
04485                      char *h));
04486 RT_EXPORT BU_EXTERN(void nmg_pr_eg,
04487                     (const long *eg,
04488                      char *h));
04489 RT_EXPORT BU_EXTERN(void nmg_pr_e,
04490                     (const struct edge *e,
04491                      char *h));
04492 RT_EXPORT BU_EXTERN(void nmg_pr_eu,
04493                     (const struct edgeuse *eu,
04494                      char *h));
04495 RT_EXPORT BU_EXTERN(void nmg_pr_eu_briefly,
04496                     (const struct edgeuse *eu,
04497                      char *h));
04498 RT_EXPORT BU_EXTERN(void nmg_pr_eu_endpoints,
04499                     (const struct edgeuse *eu,
04500                      char *h));
04501 RT_EXPORT BU_EXTERN(void nmg_pr_vg,
04502                     (const struct vertex_g *vg,
04503                      char *h));
04504 RT_EXPORT BU_EXTERN(void nmg_pr_v,
04505                     (const struct vertex *v,
04506                      char *h));
04507 RT_EXPORT BU_EXTERN(void nmg_pr_vu,
04508                     (const struct vertexuse *vu,
04509                      char *h));
04510 RT_EXPORT BU_EXTERN(void nmg_pr_vu_briefly,
04511                     (const struct vertexuse *vu,
04512                      char *h));
04513 RT_EXPORT BU_EXTERN(void nmg_pr_vua,
04514                     (const long *magic_p,
04515                      char *h));
04516 RT_EXPORT BU_EXTERN(void nmg_euprint,
04517                     (const char *str,
04518                      const struct edgeuse *eu));
04519 RT_EXPORT BU_EXTERN(void nmg_pr_ptbl,
04520                     (const char *title,
04521                      const struct bu_ptbl *tbl,
04522                      int verbose));
04523 RT_EXPORT BU_EXTERN(void nmg_pr_ptbl_vert_list,
04524                     (const char *str,
04525                      const struct bu_ptbl *tbl,
04526                      const fastf_t *mag));
04527 RT_EXPORT BU_EXTERN(void nmg_pr_one_eu_vecs,
04528                     (const struct edgeuse *eu,
04529                      const vect_t xvec,
04530                      const vect_t yvec,
04531                      const vect_t zvec,
04532                      const struct bn_tol *tol));
04533 RT_EXPORT BU_EXTERN(void nmg_pr_fu_around_eu_vecs,
04534                     (const struct edgeuse *eu,
04535                      const vect_t xvec,
04536                      const vect_t yvec,
04537                      const vect_t zvec,
04538                      const struct bn_tol *tol));
04539 RT_EXPORT BU_EXTERN(void nmg_pr_fu_around_eu,
04540                     (const struct edgeuse *eu,
04541                      const struct bn_tol *tol));
04542 RT_EXPORT BU_EXTERN(void nmg_pl_lu_around_eu,
04543                     (const struct edgeuse *eu));
04544 RT_EXPORT BU_EXTERN(void nmg_pr_fus_in_fg,
04545                     (const long *fg_magic));
04546 
04547 /* From nmg_misc.c */
04548 RT_EXPORT BU_EXTERN(struct rt_bot_internal *nmg_bot,
04549                     (struct shell *s,
04550                      const struct bn_tol *tol));
04551 RT_EXPORT BU_EXTERN(int rt_dist_pt3_line3,
04552                     (fastf_t            *dist,
04553                      point_t            pca,
04554                      const point_t      a,
04555                      const point_t      p,
04556                      const vect_t       dir,
04557                      const struct bn_tol *tol));
04558 
04559 RT_EXPORT BU_EXTERN(int rt_dist_line3_line3,
04560                     (fastf_t dist[2],
04561                      const point_t p1,
04562                      const point_t p2,
04563                      const vect_t d1,
04564                      const vect_t d2,
04565                      const struct bn_tol *tol));
04566 
04567 RT_EXPORT BU_EXTERN(int nmg_snurb_calc_lu_uv_orient,
04568                     (const struct loopuse *lu));
04569 RT_EXPORT BU_EXTERN(void nmg_snurb_fu_eval,
04570                     (const struct faceuse *fu,
04571                      const fastf_t u,
04572                      const fastf_t v,
04573                      point_t pt_on_srf));
04574 RT_EXPORT BU_EXTERN(void nmg_snurb_fu_get_norm,
04575                     (const struct faceuse *fu,
04576                      const fastf_t u,
04577                      const fastf_t v,
04578                      vect_t norm));
04579 RT_EXPORT BU_EXTERN(void nmg_snurb_fu_get_norm_at_vu,
04580                     (const struct faceuse *fu,
04581                      const struct vertexuse *vu,
04582                      vect_t norm));
04583 RT_EXPORT BU_EXTERN(void nmg_find_zero_length_edges,
04584                     (const struct model *m));
04585 RT_EXPORT BU_EXTERN(struct face *nmg_find_top_face_in_dir,
04586                     (const struct shell *s,
04587                      int dir, long *flags));
04588 RT_EXPORT BU_EXTERN(struct face *nmg_find_top_face,
04589                     (const struct shell *s,
04590                      int *dir,
04591                      long *flags));
04592 RT_EXPORT BU_EXTERN(int nmg_find_outer_and_void_shells,
04593                     (struct nmgregion *r,
04594                      struct bu_ptbl ***shells,
04595                      const struct bn_tol *tol));
04596 RT_EXPORT BU_EXTERN(int nmg_mark_edges_real,
04597                     (const long *magic_p));
04598 RT_EXPORT BU_EXTERN(void nmg_tabulate_face_g_verts,
04599                     (struct bu_ptbl *tab,
04600                      const struct face_g_plane *fg));
04601 RT_EXPORT BU_EXTERN(void nmg_isect_shell_self,
04602                     (struct shell *s,
04603                      const struct bn_tol *tol));
04604 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_next_radial_eu,
04605                     (const struct edgeuse *eu,
04606                      const struct shell *s,
04607                      const int wires));
04608 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_prev_radial_eu,
04609                     (const struct edgeuse *eu,
04610                      const struct shell *s,
04611                      const int wires));
04612 RT_EXPORT BU_EXTERN(int nmg_radial_face_count,
04613                     (const struct edgeuse *eu,
04614                      const struct shell *s));
04615 RT_EXPORT BU_EXTERN(int nmg_check_closed_shell,
04616                     (const struct shell *s,
04617                      const struct bn_tol *tol));
04618 RT_EXPORT BU_EXTERN(int nmg_move_lu_between_fus,
04619                     (struct faceuse *dest,
04620                      struct faceuse *src,
04621                      struct loopuse *lu));
04622 RT_EXPORT BU_EXTERN(void nmg_loop_plane_newell,
04623                     (const struct loopuse *lu,
04624                      plane_t pl));
04625 RT_EXPORT BU_EXTERN(fastf_t nmg_loop_plane_area,
04626                     (const struct loopuse *lu,
04627                      plane_t pl));
04628 RT_EXPORT BU_EXTERN(int nmg_calc_face_plane,
04629                     (struct faceuse *fu_in,
04630                      plane_t pl));
04631 RT_EXPORT BU_EXTERN(int nmg_calc_face_g,
04632                     (struct faceuse *fu));
04633 RT_EXPORT BU_EXTERN(fastf_t nmg_faceuse_area,
04634                     (const struct faceuse *fu));
04635 RT_EXPORT BU_EXTERN(fastf_t nmg_shell_area,
04636                     (const struct shell *s));
04637 RT_EXPORT BU_EXTERN(fastf_t nmg_region_area,
04638                     (const struct nmgregion *r));
04639 RT_EXPORT BU_EXTERN(fastf_t nmg_model_area,
04640                     (const struct model *m));
04641 /* Some stray rt_ plane functions here */
04642 RT_EXPORT BU_EXTERN(void nmg_purge_unwanted_intersection_points,
04643                     (struct bu_ptbl *vert_list,
04644                      fastf_t *mag,
04645                      const struct faceuse *fu,
04646                      const struct bn_tol *tol));
04647 RT_EXPORT BU_EXTERN(int nmg_in_or_ref,
04648                     (struct vertexuse *vu,
04649                      struct bu_ptbl *b));
04650 RT_EXPORT BU_EXTERN(void nmg_rebound,
04651                     (struct model *m,
04652                      const struct bn_tol *tol));
04653 RT_EXPORT BU_EXTERN(void nmg_count_shell_kids,
04654                     (const struct model *m,
04655                      unsigned long *total_wires,
04656                      unsigned long *total_faces,
04657                      unsigned long *total_points));
04658 RT_EXPORT BU_EXTERN(void nmg_close_shell,
04659                     (struct shell *s,
04660                      const struct bn_tol *tol));
04661 RT_EXPORT BU_EXTERN(struct shell *nmg_dup_shell ,
04662                     (struct shell *s,
04663                      long ***copy_tbl,
04664                      const struct bn_tol *tol));
04665 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_pop_eu,
04666                     (struct bu_ptbl *stack));
04667 RT_EXPORT BU_EXTERN(void nmg_reverse_radials,
04668                     (struct faceuse *fu,
04669                      const struct bn_tol *tol));
04670 RT_EXPORT BU_EXTERN(void nmg_reverse_face_and_radials,
04671                     (struct faceuse *fu,
04672                      const struct bn_tol *tol));
04673 RT_EXPORT BU_EXTERN(int nmg_shell_is_void,
04674                     (const struct shell *s));
04675 RT_EXPORT BU_EXTERN(void nmg_propagate_normals,
04676                     (struct faceuse *fu_in,
04677                      long *flags,
04678                      const struct bn_tol *tol));
04679 RT_EXPORT BU_EXTERN(void nmg_connect_same_fu_orients,
04680                     (struct shell *s));
04681 RT_EXPORT BU_EXTERN(void nmg_fix_decomposed_shell_normals,
04682                     (struct shell *s,
04683                      const struct bn_tol *tol));
04684 RT_EXPORT BU_EXTERN(struct model *nmg_mk_model_from_region,
04685                     (struct nmgregion *r,
04686                      int reindex));
04687 RT_EXPORT BU_EXTERN(void nmg_fix_normals,
04688                     (struct shell *s_orig,
04689                      const struct bn_tol *tol));
04690 RT_EXPORT BU_EXTERN(int nmg_break_long_edges,
04691                     (struct shell *s,
04692                      const struct bn_tol *tol));
04693 RT_EXPORT BU_EXTERN(struct faceuse *nmg_mk_new_face_from_loop,
04694                     (struct loopuse *lu));
04695 RT_EXPORT BU_EXTERN(int nmg_split_loops_into_faces,
04696                     (long *magic_p,
04697                      const struct bn_tol *tol));
04698 RT_EXPORT BU_EXTERN(int nmg_decompose_shell,
04699                     (struct shell *s,
04700                      const struct bn_tol *tol));
04701 RT_EXPORT BU_EXTERN(void nmg_stash_model_to_file,
04702                     (const char *filename,
04703                      const struct model *m,
04704                      const char *title));
04705 RT_EXPORT BU_EXTERN(int nmg_unbreak_region_edges,
04706                     (long *magic_p));
04707 /* rt_dist_pt3_line3 */
04708 RT_EXPORT BU_EXTERN(int nmg_mv_shell_to_region,
04709                     (struct shell *s,
04710                      struct nmgregion *r));
04711 RT_EXPORT BU_EXTERN(int nmg_find_isect_faces,
04712                     (const struct vertex *new_v,
04713                      struct bu_ptbl *faces,
04714                      int *free_edges,
04715                      const struct bn_tol *tol));
04716 RT_EXPORT BU_EXTERN(int nmg_simple_vertex_solve,
04717                     (struct vertex *new_v,
04718                      const struct bu_ptbl *faces,
04719                      const struct bn_tol *tol));
04720 RT_EXPORT BU_EXTERN(int nmg_ck_vert_on_fus,
04721                     (const struct vertex *v,
04722                      const struct bn_tol *tol));
04723 RT_EXPORT BU_EXTERN(void nmg_make_faces_at_vert,
04724                     (struct vertex *new_v,
04725                      struct bu_ptbl *int_faces,
04726                      const struct bn_tol *tol));
04727 RT_EXPORT BU_EXTERN(void nmg_kill_cracks_at_vertex,
04728                     (const struct vertex *vp));
04729 RT_EXPORT BU_EXTERN(int nmg_complex_vertex_solve,
04730                     (struct vertex *new_v,
04731                      const struct bu_ptbl *faces,
04732                      const int free_edges,
04733                      const int approximate,
04734                      const struct bn_tol *tol));
04735 RT_EXPORT BU_EXTERN(int nmg_bad_face_normals,
04736                     (const struct shell *s,
04737                      const struct bn_tol *tol));
04738 RT_EXPORT BU_EXTERN(int nmg_faces_are_radial,
04739                     (const struct faceuse *fu1,
04740                      const struct faceuse *fu2));
04741 RT_EXPORT BU_EXTERN(int nmg_move_edge_thru_pt,
04742                     (struct edgeuse *mv_eu,
04743                      const point_t pt,
04744                      const struct bn_tol *tol));
04745 RT_EXPORT BU_EXTERN(void nmg_vlist_to_wire_edges,
04746                     (struct shell *s,
04747                      const struct bu_list *vhead));
04748 RT_EXPORT BU_EXTERN(void nmg_follow_free_edges_to_vertex,
04749                     (const struct vertex *vpa,
04750                      const struct vertex *vpb,
04751                      struct bu_ptbl *bad_verts,
04752                      const struct shell *s,
04753                      const struct edgeuse *eu,
04754                      struct bu_ptbl *verts,
04755                      int *found));
04756 RT_EXPORT BU_EXTERN(void nmg_glue_face_in_shell,
04757                     (const struct faceuse *fu,
04758                      struct shell *s,
04759                      const struct bn_tol *tol));
04760 RT_EXPORT BU_EXTERN(int nmg_open_shells_connect,
04761                     (struct shell *dst,
04762                      struct shell *src,
04763                      const long **copy_tbl,
04764                      const struct bn_tol *tol));
04765 RT_EXPORT BU_EXTERN(int nmg_in_vert,
04766                     (struct vertex *new_v,
04767                      const int approximate,
04768                      const struct bn_tol *tol));
04769 RT_EXPORT BU_EXTERN(void nmg_mirror_model,
04770                     (struct model *m));
04771 RT_EXPORT BU_EXTERN(int nmg_kill_cracks,
04772                     (struct shell *s));
04773 RT_EXPORT BU_EXTERN(int nmg_kill_zero_length_edgeuses,
04774                     (struct model *m));
04775 RT_EXPORT BU_EXTERN(void nmg_make_faces_within_tol,
04776                     (struct shell *s,
04777                      const struct bn_tol *tol));
04778 RT_EXPORT BU_EXTERN(void nmg_intersect_loops_self,
04779                     (struct shell *s,
04780                      const struct bn_tol *tol));
04781 RT_EXPORT BU_EXTERN(struct edge_g_cnurb *rt_join_cnurbs,
04782                     (struct bu_list *crv_head));
04783 RT_EXPORT BU_EXTERN(struct edge_g_cnurb *rt_arc2d_to_cnurb,
04784                     (point_t i_center,
04785                      point_t i_start,
04786                      point_t i_end,
04787                      int point_type,
04788                      const struct bn_tol *tol));
04789 RT_EXPORT BU_EXTERN(int nmg_break_edge_at_verts,
04790                     (struct edge *e,
04791                      struct bu_ptbl *verts,
04792                      const struct bn_tol *tol));
04793 RT_EXPORT BU_EXTERN(void nmg_isect_shell_self,
04794                     (struct shell *s,
04795                      const struct bn_tol *tol));
04796 RT_EXPORT BU_EXTERN(fastf_t nmg_loop_plane_area,
04797                     (const struct loopuse *lu,
04798                      plane_t pl));
04799 RT_EXPORT BU_EXTERN(int nmg_break_edges,
04800                     (long *magic_p,
04801                      const struct bn_tol *tol));
04802 RT_EXPORT BU_EXTERN(int nmg_lu_is_convex,
04803                     (struct loopuse *lu,
04804                      const struct bn_tol *tol));
04805 #ifdef SEEN_RTGEOM_H
04806 RT_EXPORT BU_EXTERN(int nmg_to_arb,
04807                     (const struct model *m,
04808                      struct rt_arb_internal *arb_int));
04809 RT_EXPORT BU_EXTERN(int nmg_to_tgc,
04810                     (const struct model *m,
04811                      struct rt_tgc_internal *tgc_int,
04812                      const struct bn_tol *tol));
04813 RT_EXPORT BU_EXTERN(int nmg_to_poly,
04814                     (const struct model *m,
04815                      struct rt_pg_internal *poly_int,
04816                      const struct bn_tol *tol));
04817 RT_EXPORT BU_EXTERN(struct rt_bot_internal *nmg_bot,
04818                     (struct shell *s,
04819                      const struct bn_tol *tol));
04820 #endif
04821 
04822 RT_EXPORT BU_EXTERN(int nmg_simplify_shell_edges,
04823                     (struct shell *s,
04824                      const struct bn_tol *tol));
04825 RT_EXPORT BU_EXTERN(int nmg_edge_collapse,
04826                     (struct model *m,
04827                      const struct bn_tol *tol,
04828                      const fastf_t tol_coll,
04829                      const fastf_t min_angle));
04830 
04831 /* g_bot.c */
04832 RT_EXPORT BU_EXTERN(int rt_bot_edge_in_list,
04833                     (const int v1,
04834                      const int v2,
04835                      const int edge_list[],
04836                      const int edge_count0));
04837 RT_EXPORT BU_EXTERN(int rt_bot_plot,
04838                     (struct bu_list             *vhead,
04839                      struct rt_db_internal      *ip,
04840                      const struct rt_tess_tol *ttol,
04841                      const struct bn_tol        *tol));
04842 RT_EXPORT BU_EXTERN(int rt_bot_plot_poly,
04843                     (struct bu_list             *vhead,
04844                      struct rt_db_internal      *ip,
04845                      const struct rt_tess_tol *ttol,
04846                      const struct bn_tol        *tol));
04847 #ifdef SEEN_RTGEOM_H
04848 RT_EXPORT BU_EXTERN(int rt_bot_find_v_nearest_pt2,
04849                     (const struct rt_bot_internal *bot,
04850                      const point_t      pt2,
04851                      const mat_t        mat));
04852 RT_EXPORT BU_EXTERN(int rt_bot_find_e_nearest_pt2,
04853                     (int *vert1,
04854                      int *vert2,
04855                      const struct rt_bot_internal *bot,
04856                      const point_t      pt2,
04857                      const mat_t        mat));
04858 RT_EXPORT BU_EXTERN(int rt_bot_vertex_fuse,
04859                     (struct rt_bot_internal *bot));
04860 RT_EXPORT BU_EXTERN(int rt_bot_face_fuse,
04861                     (struct rt_bot_internal *bot));
04862 RT_EXPORT BU_EXTERN(int rt_bot_condense,
04863                     (struct rt_bot_internal *bot));
04864 RT_EXPORT BU_EXTERN(int rt_smooth_bot,
04865                     (struct rt_bot_internal *bot,
04866                      char *bot_name,
04867                      struct db_i *dbip,
04868                      fastf_t normal_tolerance_angle));
04869 
04870 #endif
04871 RT_EXPORT BU_EXTERN(int rt_bot_same_orientation,
04872                     (const int *a,
04873                      const int *b));
04874 
04875 /* From nmg_tri.c */
04876 RT_EXPORT BU_EXTERN(void nmg_triangulate_shell,
04877                     (struct shell *s,
04878                      const struct bn_tol  *tol));
04879 
04880 
04881 RT_EXPORT BU_EXTERN(void nmg_triangulate_model,
04882                     (struct model *m,
04883                      const struct bn_tol *tol));
04884 RT_EXPORT BU_EXTERN(void nmg_triangulate_fu,
04885                     (struct faceuse *fu,
04886                      const struct bn_tol *tol));
04887 
04888 /* nmg_manif.c */
04889 RT_EXPORT BU_EXTERN(int nmg_dangling_face,
04890                     (const struct faceuse *fu,
04891                      const char *manifolds));
04892 /* static paint_face */
04893 /* static set_edge_sub_manifold */
04894 /* static set_loop_sub_manifold */
04895 /* static set_face_sub_manifold */
04896 RT_EXPORT BU_EXTERN(char *nmg_shell_manifolds,
04897                     (struct shell *sp,
04898                      char *tbl));
04899 RT_EXPORT BU_EXTERN(char *nmg_manifolds,
04900                     (struct model *m));
04901 
04902 /* g_nmg.c */
04903 RT_EXPORT BU_EXTERN(int nmg_ray_segs,
04904                     (struct ray_data    *rd));
04905 
04906 /* g_torus.c */
04907 RT_EXPORT BU_EXTERN(int rt_num_circular_segments,
04908                     (double maxerr,
04909                      double radius));
04910 
04911 /* tcl.c */
04912 RT_EXPORT BU_EXTERN(int rt_tcl_parse_ray,
04913                     (Tcl_Interp *interp,
04914                      struct xray *rp,
04915                      const char *const*argv));
04916 RT_EXPORT BU_EXTERN(void rt_tcl_pr_cutter,
04917                     (Tcl_Interp *interp,
04918                      const union cutter *cutp));
04919 RT_EXPORT BU_EXTERN(int rt_tcl_cutter,
04920                     (ClientData clientData,
04921                      Tcl_Interp *interp,
04922                      int argc,
04923                      const char *const*argv));
04924 RT_EXPORT BU_EXTERN(void rt_tcl_pr_hit,
04925                     (Tcl_Interp *interp,
04926                      struct hit *hitp,
04927                      const struct seg *segp,
04928                      const struct xray *rayp,
04929                      int flipflag));
04930 RT_EXPORT BU_EXTERN(void rt_tcl_setup,
04931                     (Tcl_Interp *interp));
04932 #ifdef BRLCAD_DEBUG
04933 RT_EXPORT BU_EXTERN(int Sysv_d_Init,
04934                     (Tcl_Interp *interp));
04935 RT_EXPORT BU_EXTERN(int Rt_d_Init,
04936                     (Tcl_Interp *interp));
04937 #else
04938 RT_EXPORT BU_EXTERN(int Sysv_Init,
04939                     (Tcl_Interp *interp));
04940 RT_EXPORT BU_EXTERN(int Rt_Init,
04941                     (Tcl_Interp *interp));
04942 #endif
04943 RT_EXPORT BU_EXTERN(void db_full_path_appendresult,
04944                     (Tcl_Interp *interp,
04945                      const struct db_full_path *pp));
04946 RT_EXPORT BU_EXTERN(int tcl_obj_to_int_array,
04947                     (Tcl_Interp *interp,
04948                      Tcl_Obj *list,
04949                      int **array,
04950                      int *array_len));
04951 
04952 
04953 RT_EXPORT BU_EXTERN(int tcl_obj_to_fastf_array,
04954                     (Tcl_Interp *interp,
04955                      Tcl_Obj *list,
04956                      fastf_t **array,
04957                      int *array_len));
04958 
04959 RT_EXPORT BU_EXTERN(int tcl_list_to_int_array,
04960                     (Tcl_Interp *interp,
04961                      char *char_list,
04962                      int **array,
04963                      int *array_len));
04964 
04965 RT_EXPORT BU_EXTERN(int tcl_list_to_fastf_array,
04966                     (Tcl_Interp *interp,
04967                      char *char_list,
04968                      fastf_t **array,
04969                      int *array_len));
04970 
04971 
04972 /* g_rhc.c */
04973 RT_EXPORT BU_EXTERN(int rt_mk_hyperbola,
04974                     (struct rt_pt_node *pts,
04975                      fastf_t r,
04976                      fastf_t b,
04977                      fastf_t c,
04978                      fastf_t dtol,
04979                      fastf_t ntol));
04980 
04981 
04982 
04983 /* nmg_class.c */
04984 RT_EXPORT BU_EXTERN(int nmg_classify_pt_loop,
04985                     (const point_t pt,
04986                      const struct loopuse *lu,
04987                      const struct bn_tol *tol));
04988 
04989 RT_EXPORT BU_EXTERN(int nmg_classify_s_vs_s,
04990                     (struct shell *s,
04991                      struct shell *s2,
04992                      const struct bn_tol *tol));
04993 
04994 RT_EXPORT BU_EXTERN(int nmg_classify_lu_lu,
04995                     (const struct loopuse *lu1,
04996                      const struct loopuse *lu2,
04997                      const struct bn_tol *tol));
04998 
04999 RT_EXPORT BU_EXTERN(int nmg_class_pt_f,
05000                     (const point_t pt,
05001                      const struct faceuse *fu,
05002                      const struct bn_tol *tol));
05003 RT_EXPORT BU_EXTERN(int nmg_class_pt_s,
05004                     (const point_t pt,
05005                      const struct shell *s,
05006                      const int in_or_out_only,
05007                      const struct bn_tol *tol));
05008 
05009 /* From nmg_pt_fu.c */
05010 RT_EXPORT BU_EXTERN(int nmg_eu_is_part_of_crack,
05011                     (const struct edgeuse *eu));
05012 
05013 RT_EXPORT BU_EXTERN(int nmg_class_pt_lu_except,
05014                     (point_t            pt,
05015                      const struct loopuse       *lu,
05016                      const struct edge          *e_p,
05017                      const struct bn_tol        *tol));
05018 
05019 RT_EXPORT BU_EXTERN(int nmg_class_pt_fu_except,
05020                     (const point_t pt,
05021                      const struct faceuse *fu,
05022                      const struct loopuse *ignore_lu,
05023                      void (*eu_func)(), void (*vu_func)(),
05024                      const char *priv,
05025                      const int call_on_hits,
05026                      const int in_or_out_only,
05027                      const struct bn_tol *tol));
05028 
05029 /* From nmg_plot.c */
05030 RT_EXPORT BU_EXTERN(void nmg_pl_shell,
05031                     (FILE *fp,
05032                      const struct shell *s,
05033                      int fancy));
05034 
05035 RT_EXPORT BU_EXTERN(void nmg_vu_to_vlist,
05036                     (struct bu_list *vhead,
05037                      const struct vertexuse     *vu));
05038 RT_EXPORT BU_EXTERN(void nmg_eu_to_vlist,
05039                     (struct bu_list *vhead,
05040                      const struct bu_list       *eu_hd));
05041 RT_EXPORT BU_EXTERN(void nmg_lu_to_vlist,
05042                     (struct bu_list *vhead,
05043                      const struct loopuse       *lu,
05044                      int                        poly_markers,
05045                      const vectp_t              normal));
05046 RT_EXPORT BU_EXTERN(void nmg_snurb_fu_to_vlist,
05047                     (struct bu_list             *vhead,
05048                      const struct faceuse       *fu,
05049                      int                        poly_markers));
05050 RT_EXPORT BU_EXTERN(void nmg_s_to_vlist,
05051                     (struct bu_list             *vhead,
05052                      const struct shell *s,
05053                      int                        poly_markers));
05054 RT_EXPORT BU_EXTERN(void nmg_r_to_vlist,
05055                     (struct bu_list             *vhead,
05056                      const struct nmgregion     *r,
05057                      int                        poly_markers));
05058 RT_EXPORT BU_EXTERN(void nmg_m_to_vlist,
05059                     (struct bu_list     *vhead,
05060                      struct model       *m,
05061                      int                poly_markers));
05062 RT_EXPORT BU_EXTERN(void nmg_offset_eu_vert,
05063                     (point_t                    base,
05064                      const struct edgeuse       *eu,
05065                      const vect_t               face_normal,
05066                      int                        tip));
05067         /* plot */
05068 RT_EXPORT BU_EXTERN(void nmg_pl_v,
05069                     (FILE       *fp,
05070                      const struct vertex *v,
05071                      long *b));
05072 RT_EXPORT BU_EXTERN(void nmg_pl_e,
05073                     (FILE *fp,
05074                      const struct edge *e,
05075                      long *b,
05076                      int red,
05077                      int green,
05078                      int blue));
05079 RT_EXPORT BU_EXTERN(void nmg_pl_eu,
05080                     (FILE *fp,
05081                      const struct edgeuse *eu,
05082                      long *b,
05083                      int red,
05084                      int green,
05085                      int blue));
05086 RT_EXPORT BU_EXTERN(void nmg_pl_lu,
05087                     (FILE *fp,
05088                      const struct loopuse *fu,
05089                      long *b,
05090                      int red,
05091                      int green,
05092                      int blue));
05093 RT_EXPORT BU_EXTERN(void nmg_pl_fu,
05094                     (FILE *fp,
05095                      const struct faceuse *fu,
05096                      long *b,
05097                      int red,
05098                      int green,
05099                      int blue));
05100 RT_EXPORT BU_EXTERN(void nmg_pl_s,
05101                     (FILE *fp,
05102                      const struct shell *s));
05103 RT_EXPORT BU_EXTERN(void nmg_pl_r,
05104                     (FILE *fp,
05105                      const struct nmgregion *r));
05106 RT_EXPORT BU_EXTERN(void nmg_pl_m,
05107                     (FILE *fp,
05108                      const struct model *m));
05109 RT_EXPORT BU_EXTERN(void nmg_vlblock_v,
05110                     (struct bn_vlblock *vbp,
05111                      const struct vertex *v,
05112                      long *tab));
05113 RT_EXPORT BU_EXTERN(void nmg_vlblock_e,
05114                     (struct bn_vlblock *vbp,
05115                      const struct edge *e,
05116                      long *tab,
05117                      int red,
05118                      int green,
05119                      int blue,
05120                      int fancy));
05121 RT_EXPORT BU_EXTERN(void nmg_vlblock_eu,
05122                     (struct bn_vlblock *vbp,
05123                      const struct edgeuse *eu,
05124                      long *tab,
05125                      int red,
05126                      int green,
05127                      int blue,
05128                      int fancy,
05129                      int loopnum));
05130 RT_EXPORT BU_EXTERN(void nmg_vlblock_euleft,
05131                     (struct bu_list                     *vh,
05132                      const struct edgeuse               *eu,
05133                      const point_t                      center,
05134                      const mat_t                        mat,
05135                      const vect_t                       xvec,
05136                      const vect_t                       yvec,
05137                      double                             len,
05138                      const struct bn_tol                *tol));
05139 RT_EXPORT BU_EXTERN(void nmg_vlblock_around_eu,
05140                     (struct bn_vlblock          *vbp,
05141                      const struct edgeuse       *arg_eu,
05142                      long                       *tab,
05143                      int                        fancy,
05144                      const struct bn_tol        *tol));
05145 RT_EXPORT BU_EXTERN(void nmg_vlblock_lu,
05146                     (struct bn_vlblock *vbp,
05147                      const struct loopuse *lu,
05148                      long *tab,
05149                      int red,
05150                      int green,
05151                      int blue,
05152                      int fancy,
05153                      int loopnum));
05154 RT_EXPORT BU_EXTERN(void nmg_vlblock_fu,
05155                     (struct bn_vlblock *vbp,
05156                      const struct faceuse *fu,
05157                      long *tab, int fancy));
05158 RT_EXPORT BU_EXTERN(void nmg_vlblock_s,
05159                     (struct bn_vlblock *vbp,
05160                      const struct shell *s,
05161                      int fancy));
05162 RT_EXPORT BU_EXTERN(void nmg_vlblock_r,
05163                     (struct bn_vlblock *vbp,
05164                      const struct nmgregion *r,
05165                      int fancy));
05166 RT_EXPORT BU_EXTERN(void nmg_vlblock_m,
05167                     (struct bn_vlblock *vbp,
05168                      const struct model *m,
05169                      int fancy));
05170 /* visualization helper routines */
05171 RT_EXPORT BU_EXTERN(void nmg_pl_edges_in_2_shells,
05172                     (struct bn_vlblock  *vbp,
05173                      long                       *b,
05174                      const struct edgeuse       *eu,
05175                      int                        fancy,
05176                      const struct bn_tol        *tol));
05177 RT_EXPORT BU_EXTERN(void nmg_pl_isect,
05178                     (const char         *filename,
05179                      const struct shell *s,
05180                      const struct bn_tol        *tol));
05181 RT_EXPORT BU_EXTERN(void nmg_pl_comb_fu,
05182                     (int num1,
05183                      int num2,
05184                      const struct faceuse *fu1));
05185 RT_EXPORT BU_EXTERN(void nmg_pl_2fu,
05186                     (const char *str,
05187                      int num,
05188                      const struct faceuse *fu1,
05189                      const struct faceuse *fu2,
05190                      int show_mates));
05191         /* graphical display of classifier results */
05192 RT_EXPORT BU_EXTERN(void nmg_show_broken_classifier_stuff,
05193                     (long       *p,
05194                      long       *classlist[4],
05195                      int        all_new,
05196                      int        fancy,
05197                      const char *a_string));
05198 RT_EXPORT BU_EXTERN(void nmg_face_plot,
05199                     (const struct faceuse *fu));
05200 RT_EXPORT BU_EXTERN(void nmg_2face_plot,
05201                     (const struct faceuse *fu1,
05202                      const struct faceuse *fu2));
05203 RT_EXPORT BU_EXTERN(void nmg_face_lu_plot,
05204                     (const struct loopuse *lu,
05205                      const struct vertexuse *vu1,
05206                      const struct vertexuse *vu2));
05207 RT_EXPORT BU_EXTERN(void nmg_plot_lu_ray,
05208                     (const struct loopuse               *lu,
05209                      const struct vertexuse             *vu1,
05210                      const struct vertexuse             *vu2,
05211                      const vect_t                       left));
05212 RT_EXPORT BU_EXTERN(void nmg_plot_ray_face,
05213                     (const char *fname,
05214                      point_t pt,
05215                      const vect_t dir,
05216                      const struct faceuse *fu));
05217 RT_EXPORT BU_EXTERN(void nmg_plot_lu_around_eu,
05218                     (const char         *prefix,
05219                      const struct edgeuse       *eu,
05220                      const struct bn_tol        *tol));
05221 RT_EXPORT BU_EXTERN(int nmg_snurb_to_vlist,
05222                     (struct bu_list             *vhead,
05223                      const struct face_g_snurb  *fg,
05224                      int                        n_interior));
05225 RT_EXPORT BU_EXTERN(void nmg_cnurb_to_vlist,
05226                     (struct bu_list *vhead,
05227                      const struct edgeuse *eu,
05228                      int n_interior,
05229                      int cmd));
05230 RT_EXPORT extern void (*nmg_plot_anim_upcall)();
05231 RT_EXPORT extern void (*nmg_vlblock_anim_upcall)();
05232 RT_EXPORT extern void (*nmg_mged_debug_display_hack)();
05233 RT_EXPORT extern double nmg_eue_dist;
05234 
05235 /* nurb_util.c */
05236 RT_EXPORT BU_EXTERN(void rt_nurb_clean_cnurb,
05237                     (struct edge_g_cnurb * crv));
05238 
05239 /* nurb_knot.c */
05240 RT_EXPORT BU_EXTERN(int rt_nurb_knot_index,
05241                     (const struct knot_vector *kv,
05242                      fastf_t k_value,
05243                      int        order));
05244 
05245 /* nurb_trim.c */
05246 RT_EXPORT BU_EXTERN(int nmg_uv_in_lu,
05247                     (const fastf_t u,
05248                      const fastf_t v,
05249                      const struct loopuse *lu));
05250 
05251 
05252 /* from nmg_mesh.c */
05253 RT_EXPORT BU_EXTERN(int nmg_mesh_two_faces,
05254                     (struct faceuse *fu1,
05255                      struct faceuse *fu2,
05256                      const struct bn_tol        *tol));
05257 
05258 RT_EXPORT BU_EXTERN(void nmg_radial_join_eu,
05259                     (struct edgeuse *eu1,
05260                      struct edgeuse *eu2,
05261                      const struct bn_tol *tol));
05262 RT_EXPORT BU_EXTERN(void nmg_mesh_faces,
05263                     (struct faceuse *fu1,
05264                      struct faceuse *fu2,
05265                      const struct bn_tol *tol));
05266 RT_EXPORT BU_EXTERN(int nmg_mesh_face_shell,
05267                     (struct faceuse *fu1,
05268                      struct shell *s,
05269                      const struct bn_tol *tol));
05270 RT_EXPORT BU_EXTERN(int nmg_mesh_shell_shell,
05271                     (struct shell *s1,
05272                      struct shell *s2,
05273                      const struct bn_tol *tol));
05274 RT_EXPORT BU_EXTERN(double nmg_measure_fu_angle,
05275                     (const struct edgeuse *eu,
05276                      const vect_t xvec,
05277                      const vect_t yvec,
05278                      const vect_t zvec));
05279 
05280 /* from nmg_bool.c */
05281 RT_EXPORT BU_EXTERN(struct nmgregion *nmg_do_bool,
05282                     (struct nmgregion *s1,
05283                      struct nmgregion *s2,
05284                      const int oper, const struct bn_tol *tol));
05285 RT_EXPORT BU_EXTERN(void nmg_shell_coplanar_face_merge,
05286                     (struct shell *s,
05287                      const struct bn_tol *tol,
05288                      const int simplify));
05289 RT_EXPORT BU_EXTERN(int nmg_two_region_vertex_fuse,
05290                     (struct nmgregion *r1,
05291                      struct nmgregion *r2,
05292                      const struct bn_tol *tol));
05293 RT_EXPORT BU_EXTERN(union tree *nmg_booltree_leaf_tess,
05294                     (struct db_tree_state *tsp,
05295                      struct db_full_path *pathp,
05296                      struct rt_db_internal *ip,
05297                      genptr_t client_data));
05298 RT_EXPORT BU_EXTERN(union tree *nmg_booltree_leaf_tnurb,
05299                     (struct db_tree_state *tsp,
05300                      struct db_full_path *pathp,
05301                      struct rt_db_internal *ip,
05302                      genptr_t client_data));
05303 RT_EXPORT BU_EXTERN(union tree *nmg_booltree_evaluate,
05304                     (union tree *tp,
05305                      const struct bn_tol *tol,
05306                      struct resource *resp));
05307 RT_EXPORT BU_EXTERN(int nmg_boolean,
05308                     (union tree *tp,
05309                      struct model *m,
05310                      const struct bn_tol *tol,
05311                      struct resource *resp));
05312 
05313 /* from nmg_class.c */
05314 RT_EXPORT BU_EXTERN(void nmg_class_shells,
05315                     (struct shell *sA,
05316                      struct shell *sB,
05317                      long *classlist[4],
05318                      const struct bn_tol *tol));
05319 
05320 /* from nmg_fcut.c */
05321 /* static void ptbl_vsort */
05322 RT_EXPORT BU_EXTERN(int nmg_ck_vu_ptbl,
05323                     (struct bu_ptbl     *p,
05324                      struct faceuse     *fu));
05325 RT_EXPORT BU_EXTERN(double nmg_vu_angle_measure,
05326                     (struct vertexuse   *vu,
05327                      vect_t x_dir,
05328                      vect_t y_dir,
05329                      int assessment,
05330                      int in));
05331 #if 0
05332 RT_EXPORT BU_EXTERN(int nmg_is_v_on_rs_list,
05333                     (const struct nmg_ray_state *rs,
05334                      const struct vertex                *v));
05335 RT_EXPORT BU_EXTERN(int nmg_assess_eu,
05336                     (struct edgeuse *eu,
05337                      int                        forw,
05338                      struct nmg_ray_state       *rs,
05339                      int                        pos));
05340 RT_EXPORT BU_EXTERN(int nmg_assess_vu,
05341                     (struct nmg_ray_state       *rs,
05342                      int                        pos));
05343 RT_EXPORT BU_EXTERN(void nmg_pr_vu_stuff,
05344                     (const struct nmg_vu_stuff *vs));
05345 #endif
05346 RT_EXPORT BU_EXTERN(int nmg_wedge_class,
05347                     (int        ass,    /* assessment of two edges forming wedge */
05348                      double     a,
05349                      double     b));
05350 #if 0
05351 RT_EXPORT BU_EXTERN(int nmg_face_coincident_vu_sort,
05352                     (struct nmg_ray_state       *rs,
05353                      int                        start,
05354                      int                        end));
05355 #endif
05356 RT_EXPORT BU_EXTERN(void nmg_sanitize_fu,
05357                     (struct faceuse     *fu));
05358 #if 0
05359 RT_EXPORT BU_EXTERN(void nmg_face_rs_init,
05360                     (struct nmg_ray_state       *rs,
05361                      struct bu_ptbl     *b,
05362                      struct faceuse     *fu1,
05363                      struct faceuse     *fu2,
05364                      point_t            pt,
05365                      vect_t             dir,
05366                      struct edge_g_lseg         *eg,
05367                      const struct bn_tol        *tol));
05368 RT_EXPORT BU_EXTERN(void nmg_edge_geom_isect_line,
05369                     (struct edgeuse             *eu,
05370                      struct nmg_ray_state       *rs,
05371                      const char         *reason));
05372 #endif
05373 RT_EXPORT BU_EXTERN(void nmg_unlist_v,
05374                     (struct bu_ptbl     *b,
05375                      fastf_t *mag,
05376                      struct vertex      *v));
05377 #if 0
05378 RT_EXPORT BU_EXTERN(int mg_onon_fix,
05379                     (struct nmg_ray_state       *rs,
05380                      struct bu_ptbl             *b,
05381                      struct bu_ptbl             *ob,
05382                      fastf_t                    *mag,
05383                      fastf_t                    *omag));
05384 #endif
05385 RT_EXPORT BU_EXTERN(struct edge_g_lseg *nmg_face_cutjoin,
05386                     (struct bu_ptbl *b1,
05387                      struct bu_ptbl *b2,
05388                      fastf_t *mag1,
05389                      fastf_t *mag2,
05390                      struct faceuse *fu1,
05391                      struct faceuse *fu2,
05392                      point_t pt,
05393                      vect_t dir,
05394                      struct edge_g_lseg *eg,
05395                      const struct bn_tol *tol));
05396 RT_EXPORT BU_EXTERN(void nmg_fcut_face_2d,
05397                     (struct bu_ptbl *vu_list,
05398                      fastf_t *mag,
05399                      struct faceuse *fu1,
05400                      struct faceuse *fu2,
05401                      struct bn_tol *tol));
05402 RT_EXPORT BU_EXTERN(int nmg_insert_vu_if_on_edge,
05403                     (struct vertexuse *vu1,
05404                      struct vertexuse *vu2,
05405                      struct edgeuse *new_eu,
05406                      struct bn_tol *tol));
05407 /* nmg_face_state_transition */
05408 
05409 #define nmg_mev(_v, _u) nmg_me((_v), (struct vertex *)NULL, (_u))
05410 
05411 /* From nmg_eval.c */
05412 RT_EXPORT BU_EXTERN(void nmg_ck_lu_orientation,
05413                     (struct loopuse *lu,
05414                      const struct bn_tol *tolp));
05415 RT_EXPORT BU_EXTERN(const char *nmg_class_name,
05416                     (int class_no));
05417 RT_EXPORT BU_EXTERN(void nmg_evaluate_boolean,
05418                     (struct shell       *sA,
05419                      struct shell       *sB,
05420                      int                op,
05421                      long               *classlist[8],
05422                      const struct bn_tol        *tol));
05423 #if 0
05424 /* These can't be included because struct nmg_bool_state is in nmg_eval.c */
05425 /* nmg_eval_shell */
05426 /* nmg_eval_action */
05427 /* nmg_eval_plot */
05428 #endif
05429 
05430 
05431 /* From nmg_rt_isect.c */
05432 RT_EXPORT BU_EXTERN(void nmg_rt_print_hitlist,
05433                     (struct hitmiss *hl));
05434 
05435 RT_EXPORT BU_EXTERN(void nmg_rt_print_hitmiss,
05436                     (struct hitmiss *a_hit));
05437 
05438 RT_EXPORT BU_EXTERN(int nmg_class_ray_vs_shell,
05439                     (struct xray *rp,
05440                      const struct shell *s,
05441                      const int in_or_out_only,
05442                      const struct bn_tol *tol));
05443 
05444 RT_EXPORT BU_EXTERN(void nmg_isect_ray_model,
05445                     (struct ray_data *rd));
05446 
05447 /* From nmg_rt_segs.c */
05448 #if 0
05449 /* Don't have "nmg_specific" */
05450 RT_EXPORT BU_EXTERN(int nmg_ray_isect_segs,
05451                     (struct soltab *stp,
05452                      struct xray *rp,
05453                      struct application *ap,
05454                      struct seg *seghead,
05455                      struct nmg_specific *nmg_spec));
05456 #endif
05457 
05458 /* From nmg_ck.c */
05459 RT_EXPORT BU_EXTERN(void nmg_vvg,
05460                     (const struct vertex_g *vg));
05461 RT_EXPORT BU_EXTERN(void nmg_vvertex,
05462                     (const struct vertex *v,
05463                                 const struct vertexuse *vup));
05464 RT_EXPORT BU_EXTERN(void nmg_vvua,
05465                     (const long *vua));
05466 RT_EXPORT BU_EXTERN(void nmg_vvu,
05467                     (const struct vertexuse *vu,
05468                                 const long *up_magic_p));
05469 RT_EXPORT BU_EXTERN(void nmg_veg,
05470                     (const long *eg));
05471 RT_EXPORT BU_EXTERN(void nmg_vedge,
05472                     (const struct edge *e,
05473                      const struct edgeuse *eup));
05474 RT_EXPORT BU_EXTERN(void nmg_veu,
05475                     (const struct bu_list       *hp,
05476                      const long *up_magic_p));
05477 RT_EXPORT BU_EXTERN(void nmg_vlg,
05478                     (const struct loop_g *lg));
05479 RT_EXPORT BU_EXTERN(void nmg_vloop,
05480                     (const struct loop *l,
05481                      const struct loopuse *lup));
05482 RT_EXPORT BU_EXTERN(void nmg_vlu,
05483                     (const struct bu_list       *hp,
05484                      const long *up));
05485 RT_EXPORT BU_EXTERN(void nmg_vfg,
05486                     (const struct face_g_plane *fg));
05487 RT_EXPORT BU_EXTERN(void nmg_vface,
05488                     (const struct face *f,
05489                      const struct faceuse *fup));
05490 RT_EXPORT BU_EXTERN(void nmg_vfu,
05491                     (const struct bu_list       *hp,
05492                      const struct shell *s));
05493 RT_EXPORT BU_EXTERN(void nmg_vshell,
05494                     (const struct bu_list *hp,
05495                      const struct nmgregion *r));
05496 RT_EXPORT BU_EXTERN(void nmg_vregion,
05497                     (const struct bu_list *hp,
05498                      const struct model *m));
05499 RT_EXPORT BU_EXTERN(void nmg_vmodel,
05500                     (const struct model *m));
05501 
05502 /* checking routines */
05503 RT_EXPORT BU_EXTERN(void nmg_ck_e,
05504                     (const struct edgeuse *eu,
05505                      const struct edge *e,
05506                      const char *str));
05507 RT_EXPORT BU_EXTERN(void nmg_ck_vu,
05508                     (const long *parent,
05509                      const struct vertexuse *vu,
05510                      const char *str));
05511 RT_EXPORT BU_EXTERN(void nmg_ck_eu,
05512                     (const long *parent,
05513                      const struct edgeuse *eu,
05514                      const char *str));
05515 RT_EXPORT BU_EXTERN(void nmg_ck_lg,
05516                     (const struct loop *l,
05517                      const struct loop_g *lg,
05518                      const char *str));
05519 RT_EXPORT BU_EXTERN(void nmg_ck_l,
05520                     (const struct loopuse *lu,
05521                      const struct loop *l,
05522                      const char *str));
05523 RT_EXPORT BU_EXTERN(void nmg_ck_lu,
05524                     (const long *parent,
05525                      const struct loopuse *lu,
05526                      const char *str));
05527 RT_EXPORT BU_EXTERN(void nmg_ck_fg,
05528                     (const struct face *f,
05529                      const struct face_g_plane *fg,
05530                      const char *str));
05531 RT_EXPORT BU_EXTERN(void nmg_ck_f,
05532                     (const struct faceuse *fu,
05533                      const struct face *f,
05534                      const char *str));
05535 RT_EXPORT BU_EXTERN(void nmg_ck_fu,
05536                     (const struct shell *s,
05537                      const struct faceuse *fu,
05538                      const char *str));
05539 RT_EXPORT BU_EXTERN(int nmg_ck_eg_verts,
05540                     (const struct edge_g_lseg *eg,
05541                      const struct bn_tol *tol));
05542 RT_EXPORT BU_EXTERN(int nmg_ck_geometry,
05543                     (const struct model *m,
05544                      const struct bn_tol *tol));
05545 RT_EXPORT BU_EXTERN(int nmg_ck_face_worthless_edges,
05546                     (const struct faceuse *fu));
05547 RT_EXPORT BU_EXTERN(void nmg_ck_lueu,
05548                     (const struct loopuse *lu, const char *s));
05549 RT_EXPORT BU_EXTERN(int nmg_check_radial,
05550                     (const struct edgeuse *eu, const struct bn_tol *tol));
05551 RT_EXPORT BU_EXTERN(int nmg_eu_2s_orient_bad,
05552                     (const struct edgeuse       *eu,
05553                      const struct shell *s1,
05554                      const struct shell *s2,
05555                      const struct bn_tol        *tol));
05556 RT_EXPORT BU_EXTERN(int nmg_ck_closed_surf,
05557                     (const struct shell *s,
05558                      const struct bn_tol *tol));
05559 RT_EXPORT BU_EXTERN(int nmg_ck_closed_region,
05560                     (const struct nmgregion *r,
05561                      const struct bn_tol *tol));
05562 RT_EXPORT BU_EXTERN(void nmg_ck_v_in_2fus,
05563                     (const struct vertex *vp,
05564                      const struct faceuse *fu1,
05565                      const struct faceuse *fu2,
05566                      const struct bn_tol *tol));
05567 RT_EXPORT BU_EXTERN(void nmg_ck_vs_in_region,
05568                     (const struct nmgregion *r,
05569                      const struct bn_tol *tol));
05570 
05571 
05572 /* From nmg_inter.c */
05573 RT_EXPORT BU_EXTERN(struct vertexuse *nmg_make_dualvu,
05574                     (struct vertex *v,
05575                      struct faceuse *fu,
05576                      const struct bn_tol *tol));
05577 RT_EXPORT BU_EXTERN(struct vertexuse *nmg_enlist_vu,
05578                     (struct nmg_inter_struct    *is,
05579                      const struct vertexuse *vu,
05580                      struct vertexuse *dualvu,
05581                      fastf_t dist));
05582 RT_EXPORT BU_EXTERN(void nmg_isect2d_prep,
05583                     (struct nmg_inter_struct *is,
05584                      const long *assoc_use));
05585 RT_EXPORT BU_EXTERN(void nmg_isect2d_cleanup,
05586                     (struct nmg_inter_struct *is));
05587 RT_EXPORT BU_EXTERN(void nmg_isect2d_final_cleanup,
05588                     ());
05589 RT_EXPORT BU_EXTERN(void nmg_isect_vert2p_face2p,
05590                     (struct nmg_inter_struct *is,
05591                      struct vertexuse *vu1,
05592                      struct faceuse *fu2));
05593 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_break_eu_on_v,
05594                     (struct edgeuse *eu1,
05595                      struct vertex *v2,
05596                      struct faceuse *fu,
05597                      struct nmg_inter_struct *is));
05598 RT_EXPORT BU_EXTERN(void nmg_break_eg_on_v,
05599                     (const struct edge_g_lseg   *eg,
05600                      struct vertex              *v,
05601                      const struct bn_tol        *tol));
05602 RT_EXPORT BU_EXTERN(int nmg_isect_2colinear_edge2p,
05603                     (struct edgeuse     *eu1,
05604                      struct edgeuse     *eu2,
05605                      struct faceuse             *fu,
05606                      struct nmg_inter_struct    *is,
05607                      struct bu_ptbl             *l1,
05608                      struct bu_ptbl             *l2));
05609 RT_EXPORT BU_EXTERN(int nmg_isect_edge2p_edge2p,
05610                     (struct nmg_inter_struct    *is,
05611                      struct edgeuse             *eu1,
05612                      struct edgeuse             *eu2,
05613                      struct faceuse             *fu1,
05614                      struct faceuse             *fu2));
05615 RT_EXPORT BU_EXTERN(int nmg_isect_construct_nice_ray,
05616                     (struct nmg_inter_struct    *is,
05617                      struct faceuse             *fu2));
05618 RT_EXPORT BU_EXTERN(void nmg_enlist_one_vu,
05619                     (struct nmg_inter_struct    *is,
05620                      const struct vertexuse     *vu,
05621                      fastf_t                    dist));
05622 RT_EXPORT BU_EXTERN(int nmg_isect_line2_edge2p,
05623                     (struct nmg_inter_struct    *is,
05624                      struct bu_ptbl             *list,
05625                      struct edgeuse             *eu1,
05626                      struct faceuse             *fu1,
05627                      struct faceuse             *fu2));
05628 RT_EXPORT BU_EXTERN(void nmg_isect_line2_vertex2,
05629                     (struct nmg_inter_struct    *is,
05630                      struct vertexuse   *vu1,
05631                      struct faceuse             *fu1));
05632 RT_EXPORT BU_EXTERN(int nmg_isect_two_ptbls,
05633                     (struct nmg_inter_struct            *is,
05634                      const struct bu_ptbl               *t1,
05635                      const struct bu_ptbl               *t2));
05636 RT_EXPORT BU_EXTERN(struct edge_g_lseg  *nmg_find_eg_on_line,
05637                     (const long         *magic_p,
05638                      const point_t              pt,
05639                      const vect_t               dir,
05640                      const struct bn_tol        *tol));
05641 RT_EXPORT BU_EXTERN(int nmg_k0eu,
05642                     (struct vertex      *v));
05643 RT_EXPORT BU_EXTERN(struct vertex *nmg_repair_v_near_v,
05644                     (struct vertex              *hit_v,
05645                      struct vertex              *v,
05646                      const struct edge_g_lseg   *eg1,
05647                      const struct edge_g_lseg   *eg2,
05648                      int                        bomb,
05649                      const struct bn_tol        *tol));
05650 RT_EXPORT BU_EXTERN(struct vertex *nmg_search_v_eg,
05651                     (const struct edgeuse               *eu,
05652                      int                                second,
05653                      const struct edge_g_lseg   *eg1,
05654                      const struct edge_g_lseg   *eg2,
05655                      struct vertex              *hit_v,
05656                      const struct bn_tol                *tol));
05657 RT_EXPORT BU_EXTERN(struct vertex *nmg_common_v_2eg,
05658                     (struct edge_g_lseg *eg1,
05659                      struct edge_g_lseg *eg2,
05660                      const struct bn_tol        *tol));
05661 RT_EXPORT BU_EXTERN(int nmg_is_vertex_on_inter,
05662                     (struct vertex *v,
05663                      struct faceuse *fu1,
05664                      struct faceuse *fu2,
05665                      struct nmg_inter_struct *is));
05666 RT_EXPORT BU_EXTERN(void nmg_isect_eu_verts,
05667                     (struct edgeuse *eu,
05668                      struct vertex_g *vg1,
05669                      struct vertex_g *vg2,
05670                      struct bu_ptbl *verts,
05671                      struct bu_ptbl *inters,
05672                      const struct bn_tol *tol));
05673 RT_EXPORT BU_EXTERN(void nmg_isect_eu_eu,
05674                     (struct edgeuse *eu1,
05675                      struct vertex_g *vg1a,
05676                      struct vertex_g *vg1b,
05677                      vect_t dir1,
05678                      struct edgeuse *eu2,
05679                      struct bu_ptbl *verts,
05680                      struct bu_ptbl *inters,
05681                      const struct bn_tol *tol));
05682 RT_EXPORT BU_EXTERN(void nmg_isect_eu_fu,
05683                     (struct nmg_inter_struct *is,
05684                      struct bu_ptbl             *verts,
05685                      struct edgeuse             *eu,
05686                      struct faceuse          *fu));
05687 RT_EXPORT BU_EXTERN(void nmg_isect_fu_jra,
05688                     (struct nmg_inter_struct    *is,
05689                      struct faceuse             *fu1,
05690                      struct faceuse             *fu2,
05691                      struct bu_ptbl             *eu1_list,
05692                      struct bu_ptbl             *eu2_list));
05693 RT_EXPORT BU_EXTERN(void nmg_isect_line2_face2pNEW,
05694                     (struct nmg_inter_struct *is,
05695                      struct faceuse *fu1, struct faceuse *fu2,
05696                      struct bu_ptbl *eu1_list,
05697                      struct bu_ptbl *eu2_list));
05698 RT_EXPORT BU_EXTERN(int nmg_is_eu_on_line3,
05699                     (const struct edgeuse       *eu,
05700                      const point_t              pt,
05701                      const vect_t               dir,
05702                      const struct bn_tol        *tol));
05703 RT_EXPORT BU_EXTERN(struct edge_g_lseg  *nmg_find_eg_between_2fg,
05704                     (const struct faceuse       *ofu1,
05705                      const struct faceuse       *fu2,
05706                      const struct bn_tol        *tol));
05707 RT_EXPORT BU_EXTERN(struct edgeuse *nmg_does_fu_use_eg,
05708                     (const struct faceuse       *fu1,
05709                      const long         *eg));
05710 RT_EXPORT BU_EXTERN(int rt_line_on_plane,
05711                     (const point_t      pt,
05712                      const vect_t       dir,
05713                      const plane_t      plane,
05714                      const struct bn_tol        *tol));
05715 RT_EXPORT BU_EXTERN(void nmg_cut_lu_into_coplanar_and_non,
05716                     (struct loopuse *lu,
05717                      plane_t pl,
05718                      struct nmg_inter_struct *is));
05719 RT_EXPORT BU_EXTERN(void nmg_check_radial_angles,
05720                     (char *str,
05721                      struct shell *s,
05722                      const struct bn_tol *tol));
05723 RT_EXPORT BU_EXTERN(int nmg_faces_can_be_intersected,
05724                     (struct nmg_inter_struct *bs,
05725                      const struct faceuse *fu1,
05726                      const struct faceuse *fu2,
05727                      const struct bn_tol *tol));
05728 RT_EXPORT BU_EXTERN(void nmg_isect_two_generic_faces,
05729                     (struct faceuse             *fu1,
05730                      struct faceuse             *fu2,
05731                      const struct bn_tol        *tol));
05732 RT_EXPORT BU_EXTERN(void nmg_crackshells,
05733                     (struct shell *s1,
05734                      struct shell *s2,
05735                      const struct bn_tol *tol));
05736 RT_EXPORT BU_EXTERN(int nmg_fu_touchingloops,
05737                     (const struct faceuse *fu));
05738 
05739 
05740 /* From nmg_index.c */
05741 RT_EXPORT BU_EXTERN(int nmg_index_of_struct,
05742                     (const long *p));
05743 RT_EXPORT BU_EXTERN(void nmg_m_set_high_bit,
05744                     (struct model *m));
05745 RT_EXPORT BU_EXTERN(void nmg_m_reindex,
05746                     (struct model *m, long newindex));
05747 RT_EXPORT BU_EXTERN(void nmg_vls_struct_counts,
05748                     (struct bu_vls *str,
05749                      const struct nmg_struct_counts *ctr));
05750 RT_EXPORT BU_EXTERN(void nmg_pr_struct_counts,
05751                     (const struct nmg_struct_counts *ctr,
05752                      const char *str));
05753 RT_EXPORT BU_EXTERN(long **nmg_m_struct_count,
05754                     (struct nmg_struct_counts *ctr,
05755                      const struct model *m));
05756 RT_EXPORT BU_EXTERN(void nmg_struct_counts,
05757                     (const struct model *m,
05758                      const char         *str));
05759 RT_EXPORT BU_EXTERN(void nmg_merge_models,
05760                     (struct model *m1,
05761                      struct model *m2));
05762 RT_EXPORT BU_EXTERN(long nmg_find_max_index,
05763                     (const struct model *m));
05764 
05765 /* From nmg_rt.c */
05766 
05767 /* From rt_dspline.c */
05768 RT_EXPORT BU_EXTERN(void rt_dspline_matrix,
05769                     (mat_t m,const char *type,
05770                      const double       tension,
05771                      const double       bias));
05772 RT_EXPORT BU_EXTERN(double rt_dspline4,
05773                     (mat_t m,
05774                      double a,
05775                      double b,
05776                      double c,
05777                      double d,
05778                      double alpha));
05779 RT_EXPORT BU_EXTERN(void rt_dspline4v,
05780                     (double *pt,
05781                      const mat_t m,
05782                      const double *a,
05783                      const double *b,
05784                      const double *c,
05785                      const double *d,
05786                      const int depth,
05787                      const double alpha));
05788 RT_EXPORT BU_EXTERN(void rt_dspline_n,
05789                     (double *r,
05790                      const mat_t m,
05791                      const double *knots,
05792                      const int n,
05793                      const int depth,
05794                      const double alpha));
05795 
05796 /* From nurb_bezier.c */
05797 RT_EXPORT BU_EXTERN(int rt_nurb_bezier,
05798                     (struct bu_list *bezier_hd,
05799                      const struct face_g_snurb *orig_surf,
05800                      struct resource *res));
05801 RT_EXPORT BU_EXTERN(int rt_bez_check,
05802                     (const struct face_g_snurb * srf));
05803 RT_EXPORT BU_EXTERN(int nurb_crv_is_bezier,
05804                     (const struct edge_g_cnurb *crv));
05805 RT_EXPORT BU_EXTERN(void nurb_c_to_bezier,
05806                     (struct bu_list *clist,
05807                      struct edge_g_cnurb *crv));
05808 
05809 /* From nurb_copy.c */
05810 RT_EXPORT BU_EXTERN(struct face_g_snurb *rt_nurb_scopy,
05811                     (const struct face_g_snurb * srf,
05812                      struct resource *res));
05813 RT_EXPORT BU_EXTERN(struct edge_g_cnurb *rt_nurb_crv_copy,
05814                     (const struct edge_g_cnurb * crv));
05815 
05816 /* From nmg_fuse.c */
05817 RT_EXPORT BU_EXTERN(int nmg_is_common_bigloop,
05818                     (const struct face *f1,
05819                      const struct face *f2));
05820 RT_EXPORT BU_EXTERN(void nmg_region_v_unique,
05821                     (struct nmgregion *r1,
05822                      const struct bn_tol *tol));
05823 RT_EXPORT BU_EXTERN(int nmg_ptbl_vfuse,
05824                     (struct bu_ptbl *t,
05825                      const struct bn_tol *tol));
05826 RT_EXPORT BU_EXTERN(int nmg_region_both_vfuse,
05827                     (struct bu_ptbl *t1,
05828                      struct bu_ptbl *t2,
05829                      const struct bn_tol        *tol));
05830 /* nmg_two_region_vertex_fuse replaced with nmg_model_vertex_fuse */
05831 RT_EXPORT BU_EXTERN(int nmg_model_vertex_fuse,
05832                     (struct model *m,
05833                      const struct bn_tol *tol));
05834 RT_EXPORT BU_EXTERN(int nmg_cnurb_is_linear,
05835                     (const struct edge_g_cnurb *cnrb));
05836 RT_EXPORT BU_EXTERN(int nmg_snurb_is_planar,
05837                     (const struct face_g_snurb *srf,
05838                      const struct bn_tol *tol));
05839 RT_EXPORT BU_EXTERN(void nmg_eval_linear_trim_curve,
05840                     (const struct face_g_snurb *snrb,
05841                      const fastf_t uvw[3],
05842                      point_t xyz));
05843 RT_EXPORT BU_EXTERN(void nmg_eval_trim_curve,
05844                     (const struct edge_g_cnurb *cnrb,
05845                      const struct face_g_snurb *snrb,
05846                      const fastf_t t, point_t xyz));
05847 /* nmg_split_trim */
05848 RT_EXPORT BU_EXTERN(void nmg_eval_trim_to_tol,
05849                     (const struct edge_g_cnurb *cnrb,
05850                      const struct face_g_snurb *snrb,
05851                      const fastf_t t0,
05852                      const fastf_t t1,
05853                      struct bu_list *head,
05854                      const struct bn_tol *tol));
05855 /* nmg_split_linear_trim */
05856 RT_EXPORT BU_EXTERN(void nmg_eval_linear_trim_to_tol,
05857                     (const struct edge_g_cnurb *cnrb,
05858                      const struct face_g_snurb *snrb,
05859                      const fastf_t uvw1[3],
05860                      const fastf_t uvw2[3],
05861                      struct bu_list *head,
05862                      const struct bn_tol *tol));
05863 RT_EXPORT BU_EXTERN(int nmg_cnurb_lseg_coincident,
05864                     (const struct edgeuse *eu1,
05865                      const struct edge_g_cnurb *cnrb,
05866                      const struct face_g_snurb *snrb,
05867                      const point_t pt1,
05868                      const point_t pt2,
05869                      const struct bn_tol *tol));
05870 RT_EXPORT BU_EXTERN(int nmg_cnurb_is_on_crv,
05871                     (const struct edgeuse *eu,
05872                      const struct edge_g_cnurb *cnrb,
05873                      const struct face_g_snurb *snrb,
05874                      const struct bu_list *head,
05875                      const struct bn_tol *tol));
05876 RT_EXPORT BU_EXTERN(int nmg_model_edge_fuse,
05877                     (struct model *m,
05878                      const struct bn_tol *tol));
05879 RT_EXPORT BU_EXTERN(int nmg_model_edge_g_fuse,
05880                     (struct model               *m,
05881                      const struct bn_tol        *tol));
05882 RT_EXPORT BU_EXTERN(int nmg_ck_fu_verts,
05883                     (struct faceuse *fu1,
05884                      struct face *f2,
05885                      const struct bn_tol *tol));
05886 RT_EXPORT BU_EXTERN(int nmg_ck_fg_verts,
05887                     (struct faceuse *fu1,
05888                      struct face *f2,
05889                      const struct bn_tol *tol));
05890 RT_EXPORT BU_EXTERN(int nmg_two_face_fuse,
05891                     (struct face        *f1,
05892                      struct face *f2,
05893                      const struct bn_tol *tol));
05894 RT_EXPORT BU_EXTERN(int nmg_model_face_fuse,
05895                     (struct model *m,
05896                      const struct bn_tol *tol));
05897 RT_EXPORT BU_EXTERN(int nmg_break_all_es_on_v,
05898                     (long *magic_p,
05899                      struct vertex *v,
05900                      const struct bn_tol *tol));
05901 RT_EXPORT BU_EXTERN(int nmg_model_break_e_on_v,
05902                     (struct model *m,
05903                      const struct bn_tol *tol));
05904 RT_EXPORT BU_EXTERN(int nmg_model_fuse,
05905                     (struct model *m,
05906                      const struct bn_tol *tol));
05907 
05908         /* radial routines */
05909 RT_EXPORT BU_EXTERN(void nmg_radial_sorted_list_insert,
05910                     (struct bu_list *hd,
05911                      struct nmg_radial *rad));
05912 RT_EXPORT BU_EXTERN(void nmg_radial_verify_pointers,
05913                     (const struct bu_list *hd,
05914                      const struct bn_tol *tol));
05915 RT_EXPORT BU_EXTERN(void nmg_radial_verify_monotone,
05916                     (const struct bu_list       *hd,
05917                      const struct bn_tol        *tol));
05918 RT_EXPORT BU_EXTERN(void nmg_insure_radial_list_is_increasing,
05919                     (struct bu_list     *hd,
05920                      fastf_t amin, fastf_t amax));
05921 RT_EXPORT BU_EXTERN(void nmg_radial_build_list,
05922                     (struct bu_list             *hd,
05923                      struct bu_ptbl             *shell_tbl,
05924                      int                        existing,
05925                      struct edgeuse             *eu,
05926                      const vect_t               xvec,
05927                      const vect_t               yvec,
05928                      const vect_t               zvec,
05929                      const struct bn_tol        *tol));
05930 RT_EXPORT BU_EXTERN(void nmg_radial_merge_lists,
05931                     (struct bu_list             *dest,
05932                      struct bu_list             *src,
05933                      const struct bn_tol        *tol));
05934 RT_EXPORT BU_EXTERN(int  nmg_is_crack_outie,
05935                     (const struct edgeuse       *eu,
05936                      const struct bn_tol        *tol));
05937 RT_EXPORT BU_EXTERN(struct nmg_radial   *nmg_find_radial_eu,
05938                     (const struct bu_list *hd,
05939                      const struct edgeuse *eu));
05940 RT_EXPORT BU_EXTERN(const struct edgeuse *nmg_find_next_use_of_2e_in_lu,
05941                     (const struct edgeuse       *eu,
05942                      const struct edge  *e1,
05943                      const struct edge  *e2));
05944 RT_EXPORT BU_EXTERN(void nmg_radial_mark_cracks,
05945                     (struct bu_list     *hd,
05946                      const struct edge  *e1,
05947                      const struct edge  *e2,
05948                      const struct bn_tol        *tol));
05949 RT_EXPORT BU_EXTERN(struct nmg_radial *nmg_radial_find_an_original,
05950                     (const struct bu_list       *hd,
05951                      const struct shell *s,
05952                      const struct bn_tol        *tol));
05953 RT_EXPORT BU_EXTERN(int nmg_radial_mark_flips,
05954                     (struct bu_list             *hd,
05955                      const struct shell *s,
05956                      const struct bn_tol        *tol));
05957 RT_EXPORT BU_EXTERN(int nmg_radial_check_parity,
05958                     (const struct bu_list       *hd,
05959                      const struct bu_ptbl       *shells,
05960                      const struct bn_tol        *tol));
05961 RT_EXPORT BU_EXTERN(void nmg_radial_implement_decisions,
05962                     (struct bu_list             *hd,
05963                      const struct bn_tol        *tol,
05964                      struct edgeuse             *eu1,
05965                      vect_t xvec,
05966                      vect_t yvec,
05967                      vect_t zvec));
05968 RT_EXPORT BU_EXTERN(void nmg_pr_radial,
05969                     (const char *title,
05970                      const struct nmg_radial    *rad));
05971 RT_EXPORT BU_EXTERN(void nmg_pr_radial_list,
05972                     (const struct bu_list *hd,
05973                      const struct bn_tol *tol));
05974 RT_EXPORT BU_EXTERN(void nmg_do_radial_flips,
05975                     (struct bu_list *hd));
05976 RT_EXPORT BU_EXTERN(void nmg_do_radial_join,
05977                     (struct bu_list *hd,
05978                      struct edgeuse *eu1ref,
05979                      vect_t xvec, vect_t yvec, vect_t zvec,
05980                      const struct bn_tol *tol));
05981 RT_EXPORT BU_EXTERN(void nmg_radial_join_eu_NEW,
05982                     (struct edgeuse *eu1,
05983                      struct edgeuse *eu2,
05984                      const struct bn_tol *tol));
05985 RT_EXPORT BU_EXTERN(void nmg_radial_exchange_marked,
05986                     (struct bu_list             *hd,
05987                      const struct bn_tol        *tol));
05988 RT_EXPORT BU_EXTERN(void nmg_s_radial_harmonize,
05989                     (struct shell               *s,
05990                      const struct bn_tol        *tol));
05991 RT_EXPORT BU_EXTERN(int nmg_eu_radial_check,
05992                     (const struct edgeuse       *eu,
05993                      const struct shell *s,
05994                      const struct bn_tol        *tol));
05995 RT_EXPORT BU_EXTERN(void nmg_s_radial_check,
05996                     (struct shell               *s,
05997                      const struct bn_tol        *tol));
05998 RT_EXPORT BU_EXTERN(void nmg_r_radial_check,
05999                     (const struct nmgregion     *r,
06000                      const struct bn_tol        *tol));
06001 
06002 
06003 RT_EXPORT BU_EXTERN(struct edge_g_lseg  *nmg_pick_best_edge_g,
06004                     (struct edgeuse *eu1,
06005                      struct edgeuse *eu2,
06006                      const struct bn_tol *tol));
06007 
06008 /* nmg_visit.c */
06009 RT_EXPORT BU_EXTERN(void nmg_visit_vertex,
06010                     (struct vertex                      *v,
06011                      const struct nmg_visit_handlers    *htab,
06012                      genptr_t                   state));
06013 RT_EXPORT BU_EXTERN(void nmg_visit_vertexuse,
06014                     (struct vertexuse           *vu,
06015                      const struct nmg_visit_handlers    *htab,
06016                      genptr_t                   state));
06017 RT_EXPORT BU_EXTERN(void nmg_visit_edge,
06018                     (struct edge                        *e,
06019                      const struct nmg_visit_handlers    *htab,
06020                      genptr_t                   state));
06021 RT_EXPORT BU_EXTERN(void nmg_visit_edgeuse,
06022                     (struct edgeuse                     *eu,
06023                      const struct nmg_visit_handlers    *htab,
06024                      genptr_t                   state));
06025 RT_EXPORT BU_EXTERN(void nmg_visit_loop,
06026                     (struct loop                        *l,
06027                      const struct nmg_visit_handlers    *htab,
06028                      genptr_t                   state));
06029 RT_EXPORT BU_EXTERN(void nmg_visit_loopuse,
06030                     (struct loopuse                     *lu,
06031                      const struct nmg_visit_handlers    *htab,
06032                      genptr_t                   state));
06033 RT_EXPORT BU_EXTERN(void nmg_visit_face,
06034                     (struct face                        *f,
06035                      const struct nmg_visit_handlers    *htab,
06036                      genptr_t                   state));
06037 RT_EXPORT BU_EXTERN(void nmg_visit_faceuse,
06038                     (struct faceuse                     *fu,
06039                      const struct nmg_visit_handlers    *htab,
06040                      genptr_t                   state));
06041 RT_EXPORT BU_EXTERN(void nmg_visit_shell,
06042                     (struct shell                       *s,
06043                      const struct nmg_visit_handlers    *htab,
06044                      genptr_t                   state));
06045 RT_EXPORT BU_EXTERN(void nmg_visit_region,
06046                     (struct nmgregion           *r,
06047                      const struct nmg_visit_handlers    *htab,
06048                      genptr_t                   state));
06049 RT_EXPORT BU_EXTERN(void nmg_visit_model,
06050                     (struct model                       *model,
06051                      const struct nmg_visit_handlers    *htab,
06052                      genptr_t                   state));
06053 RT_EXPORT BU_EXTERN(void nmg_visit,
06054                     (const long                 *magicp,
06055                      const struct nmg_visit_handlers    *htab,
06056                      genptr_t                   state));
06057 
06058 /* db5_types.c */
06059 RT_EXPORT BU_EXTERN(int db5_type_tag_from_major,
06060                     (char       **tag,
06061                      const int  major));
06062 
06063 RT_EXPORT BU_EXTERN(int db5_type_descrip_from_major,
06064                     (char       **descrip,
06065                      const int  major));
06066 
06067 RT_EXPORT BU_EXTERN(int db5_type_tag_from_codes,
06068                     (char       **tag,
06069                      const int  major,
06070                      const int  minor));
06071 
06072 RT_EXPORT BU_EXTERN(int db5_type_descrip_from_codes,
06073                     (char       **descrip,
06074                      const int  major,
06075                      const int  minor));
06076 
06077 RT_EXPORT BU_EXTERN(int db5_type_codes_from_tag,
06078                     (int        *major,
06079                      int        *minor,
06080                      const char *tag));
06081 
06082 RT_EXPORT BU_EXTERN(int db5_type_codes_from_descrip,
06083                     (int        *major,
06084                      int        *minor,
06085                      const char *descrip));
06086 
06087 RT_EXPORT BU_EXTERN(size_t db5_type_sizeof_h_binu,
06088                     (const int minor));
06089 
06090 RT_EXPORT BU_EXTERN(size_t db5_type_sizeof_n_binu,
06091                     (const int minor));
06092 
06093 #endif
06094 
06095 /* defined in wdb_obj.c */
06096 RT_EXPORT BU_EXTERN(int wdb_create_cmd,
06097                     (Tcl_Interp *interp,
06098                      struct rt_wdb *wdbp,
06099                      const char *oname));
06100 RT_EXPORT BU_EXTERN(void wdb_deleteProc,
06101                     (ClientData clientData));
06102 RT_EXPORT BU_EXTERN(int wdb_get_tcl,
06103                     (ClientData clientData,
06104                      Tcl_Interp *interp,
06105                      int argc, char **argv));
06106 RT_EXPORT BU_EXTERN(int dgo_cmd,
06107                     (ClientData clientData,
06108                      Tcl_Interp *interp,
06109                      int argc,
06110                      char **argv));
06111 RT_EXPORT BU_EXTERN(int wdb_init_obj,
06112                     (Tcl_Interp *interp,
06113                      struct rt_wdb *wdbp,
06114                      const char *oname));
06115 RT_EXPORT BU_EXTERN(struct db_i *wdb_prep_dbip,
06116                     (Tcl_Interp *interp,
06117                      const char *filename));
06118 RT_EXPORT BU_EXTERN(int wdb_bot_face_sort_cmd,
06119                     (struct rt_wdb *wdbp,
06120                      Tcl_Interp *interp,
06121                      int argc, char **argv));
06122 RT_EXPORT BU_EXTERN(int wdb_bot_decimate_cmd,
06123                     (struct rt_wdb *wdbp,
06124                      Tcl_Interp *interp,
06125                      int argc,
06126                      char **argv));
06127 RT_EXPORT BU_EXTERN(int wdb_close_cmd,
06128                     (struct rt_wdb *wdbp,
06129                      Tcl_Interp *interp,
06130                      int argc,
06131                      char **argv));
06132 RT_EXPORT BU_EXTERN(int wdb_reopen_cmd,
06133                     (struct rt_wdb *wdbp,
06134                      Tcl_Interp *interp,
06135                      int argc,
06136                      char **argv));
06137 RT_EXPORT BU_EXTERN(int wdb_match_cmd,
06138                     (struct rt_wdb *wdbp,
06139                      Tcl_Interp *interp,
06140                      int argc,
06141                      char **argv));
06142 RT_EXPORT BU_EXTERN(int wdb_get_cmd,
06143                     (struct rt_wdb *wdbp,
06144                      Tcl_Interp *interp,
06145                      int argc,
06146                      char **argv));
06147 RT_EXPORT BU_EXTERN(int wdb_put_cmd,
06148                     (struct rt_wdb *wdbp,
06149                      Tcl_Interp *interp,
06150                      int argc,
06151                      char **argv));
06152 RT_EXPORT BU_EXTERN(int wdb_adjust_cmd,
06153                     (struct rt_wdb *wdbp,
06154                      Tcl_Interp *interp,
06155                      int argc,
06156                      char **argv));
06157 RT_EXPORT BU_EXTERN(int wdb_form_cmd,
06158                     (struct rt_wdb *wdbp,
06159                      Tcl_Interp *interp,
06160                      int argc,
06161                      char **argv));
06162 RT_EXPORT BU_EXTERN(int wdb_tops_cmd,
06163                     (struct rt_wdb *wdbp,
06164                      Tcl_Interp *interp,
06165                      int argc,
06166                      char **argv));
06167 RT_EXPORT BU_EXTERN(int wdb_rt_gettrees_cmd,
06168                     (struct rt_wdb *wdbp,
06169                      Tcl_Interp *interp,
06170                      int argc,
06171                      char **argv));
06172 RT_EXPORT BU_EXTERN(int wdb_dump_cmd,
06173                     (struct rt_wdb *wdbp,
06174                      Tcl_Interp *interp,
06175                      int argc,
06176                      char **argv));
06177 RT_EXPORT BU_EXTERN(int wdb_dbip_cmd,
06178                     (struct rt_wdb *wdbp,
06179                      Tcl_Interp *interp,
06180                      int argc,
06181                      char **argv));
06182 RT_EXPORT BU_EXTERN(int wdb_ls_cmd,
06183                     (struct rt_wdb *wdbp,
06184                      Tcl_Interp *interp,
06185                      int argc,
06186                      char **argv));
06187 RT_EXPORT BU_EXTERN(int wdb_list_cmd,
06188                     (struct rt_wdb *wdbp,
06189                      Tcl_Interp *interp,
06190                      int argc,
06191                      char **argv));
06192 RT_EXPORT BU_EXTERN(int wdb_lt_cmd,
06193                     (struct rt_wdb *wdbp,
06194                      Tcl_Interp *interp,
06195                      int argc,
06196                      char **argv));
06197 RT_EXPORT BU_EXTERN(int wdb_pathlist_cmd,
06198                     (struct rt_wdb *wdbp,
06199                      Tcl_Interp *interp,
06200                      int argc,
06201                      char **argv));
06202 RT_EXPORT BU_EXTERN(int wdb_pathsum_cmd,
06203                     (struct rt_wdb *wdbp,
06204                      Tcl_Interp *interp,
06205                      int argc,
06206                      char **argv));
06207 RT_EXPORT BU_EXTERN(int wdb_expand_cmd,
06208                     (struct rt_wdb *wdbp,
06209                      Tcl_Interp *interp,
06210                      int argc,
06211                      char **argv));
06212 RT_EXPORT BU_EXTERN(int wdb_kill_cmd,
06213                     (struct rt_wdb *wdbp,
06214                      Tcl_Interp *interp,
06215                      int argc,
06216                      char **argv));
06217 RT_EXPORT BU_EXTERN(int wdb_killall_cmd,
06218                     (struct rt_wdb *wdbp,
06219                      Tcl_Interp *interp,
06220                      int argc,
06221                      char **argv));
06222 RT_EXPORT BU_EXTERN(int wdb_killtree_cmd,
06223                     (struct rt_wdb *wdbp,
06224                      Tcl_Interp *interp,
06225                      int argc,
06226                      char **argv));
06227 RT_EXPORT BU_EXTERN(int wdb_copy_cmd,
06228                     (struct rt_wdb *wdbp,
06229                      Tcl_Interp *interp,
06230                      int argc,
06231                      char **argv));
06232 RT_EXPORT BU_EXTERN(int wdb_move_cmd,
06233                     (struct rt_wdb *wdbp,
06234                      Tcl_Interp *interp,
06235                      int argc,
06236                      char **argv));
06237 RT_EXPORT BU_EXTERN(int wdb_move_all_cmd,
06238                     (struct rt_wdb *wdbp,
06239                      Tcl_Interp *interp,
06240                      int argc,
06241                      char **argv));
06242 RT_EXPORT BU_EXTERN(int wdb_concat_cmd,
06243                     (struct rt_wdb *wdbp,
06244                      Tcl_Interp *interp,
06245                      int argc,
06246                      char **argv));
06247 RT_EXPORT BU_EXTERN(int wdb_dup_cmd,
06248                     (struct rt_wdb *wdbp,
06249                      Tcl_Interp *interp,
06250                      int argc,
06251                      char **argv));
06252 RT_EXPORT BU_EXTERN(int wdb_group_cmd,
06253                     (struct rt_wdb *wdbp,
06254                      Tcl_Interp *interp,
06255                      int argc,
06256                      char **argv));
06257 RT_EXPORT BU_EXTERN(int wdb_remove_cmd,
06258                     (struct rt_wdb *wdbp,
06259                      Tcl_Interp *interp,
06260                      int argc,
06261                      char **argv));
06262 RT_EXPORT BU_EXTERN(int wdb_region_cmd,
06263                     (struct rt_wdb *wdbp,
06264                      Tcl_Interp *interp,
06265                      int argc,
06266                      char **argv));
06267 RT_EXPORT BU_EXTERN(int wdb_comb_cmd,
06268                     (struct rt_wdb *wdbp,
06269                      Tcl_Interp *interp,
06270                      int argc,
06271                      char **argv));
06272 RT_EXPORT BU_EXTERN(int wdb_find_cmd,
06273                     (struct rt_wdb *wdbp,
06274                      Tcl_Interp *interp,
06275                      int argc,
06276                      char **argv));
06277 RT_EXPORT BU_EXTERN(int wdb_which_cmd,
06278                     (struct rt_wdb *wdbp,
06279                      Tcl_Interp *interp,
06280                      int argc,
06281                      char **argv));
06282 RT_EXPORT BU_EXTERN(int wdb_title_cmd,
06283                     (struct rt_wdb *wdbp,
06284                      Tcl_Interp *interp,
06285                      int argc,
06286                      char **argv));
06287 RT_EXPORT BU_EXTERN(int wdb_tree_cmd,
06288                     (struct rt_wdb *wdbp,
06289                      Tcl_Interp *interp,
06290                      int argc,
06291                      char **argv));
06292 RT_EXPORT BU_EXTERN(int wdb_color_cmd,
06293                     (struct rt_wdb *wdbp,
06294                      Tcl_Interp *interp,
06295                      int argc,
06296                      char **argv));
06297 RT_EXPORT BU_EXTERN(int wdb_prcolor_cmd,
06298                     (struct rt_wdb *wdbp,
06299                      Tcl_Interp *interp,
06300                      int argc,
06301                      char **argv));
06302 RT_EXPORT BU_EXTERN(int wdb_tol_cmd,
06303                     (struct rt_wdb *wdbp,
06304                      Tcl_Interp *interp,
06305                      int argc,
06306                      char **argv));
06307 RT_EXPORT BU_EXTERN(int wdb_push_cmd,
06308                     (struct rt_wdb *wdbp,
06309                      Tcl_Interp *interp,
06310                      int argc,
06311                      char **argv));
06312 RT_EXPORT BU_EXTERN(int wdb_whatid_cmd,
06313                     (struct rt_wdb *wdbp,
06314                      Tcl_Interp *interp,
06315                      int argc,
06316                      char **argv));
06317 RT_EXPORT BU_EXTERN(int wdb_keep_cmd,
06318                     (struct rt_wdb *wdbp,
06319                      Tcl_Interp *interp,
06320                      int argc,
06321                      char **argv));
06322 RT_EXPORT BU_EXTERN(int wdb_cat_cmd,
06323                     (struct rt_wdb *wdbp,
06324                      Tcl_Interp *interp,
06325                      int argc,
06326                      char **argv));
06327 RT_EXPORT BU_EXTERN(int wdb_instance_cmd,
06328                     (struct rt_wdb *wdbp,
06329                      Tcl_Interp *interp,
06330                      int argc,
06331                      char **argv));
06332 RT_EXPORT BU_EXTERN(int wdb_observer_cmd,
06333                     (struct rt_wdb *wdbp,
06334                      Tcl_Interp *interp,
06335                      int argc,
06336                      char **argv));
06337 RT_EXPORT BU_EXTERN(int wdb_make_bb_cmd,
06338                     (struct rt_wdb *wdbp,
06339                      Tcl_Interp *interp,
06340                      int argc,
06341                      char **argv));
06342 RT_EXPORT BU_EXTERN(int wdb_make_name_cmd,
06343                     (struct rt_wdb *wdbp,
06344                      Tcl_Interp *interp,
06345                      int argc,
06346                      char **argv));
06347 RT_EXPORT BU_EXTERN(int wdb_units_cmd,
06348                     (struct rt_wdb *wdbp,
06349                      Tcl_Interp *interp,
06350                      int argc,
06351                      char **argv));
06352 RT_EXPORT BU_EXTERN(int wdb_hide_cmd,
06353                     (struct rt_wdb *wdbp,
06354                      Tcl_Interp *interp,
06355                      int argc,
06356                      char **argv));
06357 RT_EXPORT BU_EXTERN(int wdb_unhide_cmd,
06358                     (struct rt_wdb *wdbp,
06359                      Tcl_Interp *interp,
06360                      int argc,
06361                      char **argv));
06362 RT_EXPORT BU_EXTERN(int wdb_attr_cmd,
06363                     (struct rt_wdb *wdbp,
06364                      Tcl_Interp *interp,
06365                      int argc,
06366                      char **argv));
06367 RT_EXPORT BU_EXTERN(int wdb_summary_cmd,
06368                     (struct rt_wdb *wdbp,
06369                      Tcl_Interp *interp,
06370                      int argc,
06371                      char **argv));
06372 RT_EXPORT BU_EXTERN(int wdb_comb_std_cmd,
06373                     (struct rt_wdb *wdbp,
06374                      Tcl_Interp *interp,
06375                      int argc,
06376                      char **argv));
06377 RT_EXPORT BU_EXTERN(int wdb_nmg_collapse_cmd,
06378                     (struct rt_wdb *wdbp,
06379                      Tcl_Interp *interp,
06380                      int argc,
06381                      char **argv));
06382 RT_EXPORT BU_EXTERN(int wdb_nmg_simplify_cmd,
06383                     (struct rt_wdb *wdbp,
06384                      Tcl_Interp *interp,
06385                      int argc,
06386                      char **argv));
06387 RT_EXPORT BU_EXTERN(int wdb_shells_cmd,
06388                     (struct rt_wdb *wdbp,
06389                      Tcl_Interp *interp,
06390                      int argc,
06391                      char **argv));
06392 RT_EXPORT BU_EXTERN(int wdb_xpush_cmd,
06393                     (struct rt_wdb *wdbp,
06394                      Tcl_Interp *interp,
06395                      int argc,
06396                      char **argv));
06397 RT_EXPORT BU_EXTERN(int wdb_showmats_cmd,
06398                     (struct rt_wdb *wdbp,
06399                      Tcl_Interp *interp,
06400                      int argc,
06401                      char **argv));
06402 RT_EXPORT BU_EXTERN(int wdb_copyeval_cmd,
06403                     (struct rt_wdb *wdbp,
06404                      Tcl_Interp *interp,
06405                      int argc,
06406                      char **argv));
06407 RT_EXPORT BU_EXTERN(int wdb_version_cmd,
06408                     (struct rt_wdb *wdbp,
06409                      Tcl_Interp *interp,
06410                      int argc,
06411                      char **argv));
06412 RT_EXPORT BU_EXTERN(int wdb_binary_cmd,
06413                     (struct rt_wdb *wdbp,
06414                      Tcl_Interp *interp,
06415                      int argc,
06416                      char **argv));
06417 RT_EXPORT BU_EXTERN(int wdb_track_cmd,
06418                     (struct rt_wdb *wdbp,
06419                      Tcl_Interp *interp,
06420                      int argc,
06421                      char **argv));
06422 RT_EXPORT BU_EXTERN(int wdb_smooth_bot_cmd,
06423                     (struct rt_wdb *wdbp,
06424                      Tcl_Interp *interp,
06425                      int argc,
06426                      char **argv));
06427 RT_EXPORT BU_EXTERN(int wdb_importFg4Section_cmd,
06428                     (struct rt_wdb *wdbp,
06429                      Tcl_Interp *interp,
06430                      int argc,
06431                      char **argv));
06432 
06433 /* defined in dg_obj.c */
06434 RT_EXPORT BU_EXTERN(int dgo_set_outputHandler_cmd,
06435                     (struct dg_obj      *dgop,
06436                      Tcl_Interp         *interp,
06437                      int                argc,
06438                      char               **argv));
06439 RT_EXPORT BU_EXTERN(int dgo_set_transparency_cmd,
06440                     (struct dg_obj      *dgop,
06441                      Tcl_Interp         *interp,
06442                      int                argc,
06443                      char               **argv));
06444 RT_EXPORT BU_EXTERN(int dgo_observer_cmd,
06445                     (struct dg_obj *dgop,
06446                      Tcl_Interp *interp,
06447                      int argc,
06448                      char **argv));
06449 RT_EXPORT BU_EXTERN(void dgo_deleteProc,
06450                     (ClientData clientData));
06451 RT_EXPORT BU_EXTERN(void dgo_autoview,
06452                     (struct dg_obj *dgop,
06453                      struct view_obj *vop,
06454                      Tcl_Interp *interp));
06455 RT_EXPORT BU_EXTERN(int dgo_autoview_cmd,
06456                     (struct dg_obj *dgop,
06457                      struct view_obj *vop,
06458                      Tcl_Interp *interp,
06459                      int argc, char **argv));
06460 RT_EXPORT BU_EXTERN(int dgo_blast_cmd,
06461                     (struct dg_obj *dgop,
06462                      Tcl_Interp *interp,
06463                      int argc,
06464                      char **argv));
06465 RT_EXPORT BU_EXTERN(int dgo_draw_cmd,
06466                     (struct dg_obj *dgop,
06467                      Tcl_Interp *interp,
06468                      int argc, char **argv,
06469                      int kind));
06470 RT_EXPORT BU_EXTERN(int dgo_E_cmd,
06471                     (struct dg_obj *dgop,
06472                      Tcl_Interp *interp,
06473                      int argc,
06474                      char **argv));
06475 RT_EXPORT BU_EXTERN(int dgo_erase_cmd,
06476                     (struct dg_obj *dgop,
06477                      Tcl_Interp *interp,
06478                      int argc,
06479                      char **argv));
06480 RT_EXPORT BU_EXTERN(int dgo_erase_all_cmd,
06481                     (struct dg_obj *dgop,
06482                      Tcl_Interp *interp,
06483                      int argc,
06484                      char **argv));
06485 RT_EXPORT BU_EXTERN(int dgo_get_autoview_cmd,
06486                     (struct dg_obj *dgop,
06487                      Tcl_Interp *interp,
06488                      int argc,
06489                      char **argv));
06490 RT_EXPORT BU_EXTERN(int dgo_how_cmd,
06491                     (struct dg_obj *dgop,
06492                      Tcl_Interp *interp,
06493                      int argc,
06494                      char **argv));
06495 RT_EXPORT BU_EXTERN(int dgo_illum_cmd,
06496                     (struct dg_obj *dgop,
06497                      Tcl_Interp *interp,
06498                      int argc,
06499                      char **argv));
06500 RT_EXPORT BU_EXTERN(int dgo_label_cmd,
06501                     (struct dg_obj *dgop,
06502                      Tcl_Interp *interp,
06503                      int argc,
06504                      char **argv));
06505 RT_EXPORT BU_EXTERN(struct dg_obj *dgo_open_cmd,
06506                     (char *oname,
06507                      struct rt_wdb *wdbp));
06508 RT_EXPORT BU_EXTERN(int dgo_overlay_cmd,
06509                     (struct dg_obj *dgop,
06510                      Tcl_Interp *interp,
06511                      int argc,
06512                      char **argv));
06513 RT_EXPORT BU_EXTERN(int dgo_report_cmd,
06514                     (struct dg_obj *dgop,
06515                      Tcl_Interp *interp,
06516                      int argc,
06517                      char **argv));
06518 RT_EXPORT BU_EXTERN(int dgo_rt_cmd,
06519                     (struct dg_obj *dgop,
06520                      struct view_obj *vop,
06521                      Tcl_Interp *interp,
06522                      int argc,
06523                      char **argv));
06524 RT_EXPORT BU_EXTERN(int dgo_rtabort_cmd,
06525                     (struct dg_obj *dgop,
06526                      Tcl_Interp *interp,
06527                      int argc,
06528                      char **argv));
06529 RT_EXPORT BU_EXTERN(int dgo_rtcheck_cmd,
06530                     (struct dg_obj *dgop,
06531                      struct view_obj *vop,
06532                      Tcl_Interp *interp,
06533                      int argc, char **argv));
06534 RT_EXPORT BU_EXTERN(int dgo_vdraw_cmd,
06535                     (struct dg_obj *dgop,
06536                      Tcl_Interp *interp,
06537                      int argc,
06538                      char **argv));
06539 RT_EXPORT BU_EXTERN(int dgo_who_cmd,
06540                     (struct dg_obj *dgop,
06541                      Tcl_Interp *interp,
06542                      int argc,
06543                      char **argv));
06544 RT_EXPORT BU_EXTERN(void dgo_zap_cmd,
06545                     (struct dg_obj *dgop,
06546                      Tcl_Interp *interp));
06547 RT_EXPORT BU_EXTERN(int dgo_shaded_mode_cmd,
06548                     (struct dg_obj *dgop,
06549                      Tcl_Interp *interp,
06550                      int argc,
06551                      char **argv));
06552 
06553 RT_EXPORT BU_EXTERN(void dgo_color_soltab,
06554                     ());
06555 RT_EXPORT BU_EXTERN(void dgo_drawH_part2,
06556                     ());
06557 RT_EXPORT BU_EXTERN(void dgo_eraseobjall_callback,
06558                     (struct db_i        *dbip,
06559                      Tcl_Interp         *interp,
06560                      struct directory   *dp,
06561                      int                notify));
06562 RT_EXPORT BU_EXTERN(void dgo_eraseobjpath,
06563                     ());
06564 RT_EXPORT BU_EXTERN(void dgo_impending_wdb_close,
06565                     ());
06566 RT_EXPORT BU_EXTERN(int dgo_invent_solid,
06567                     ());
06568 RT_EXPORT BU_EXTERN(void dgo_notify,
06569                     (struct dg_obj      *dgop,
06570                      Tcl_Interp         *interp));
06571 RT_EXPORT BU_EXTERN(void dgo_notifyWdb,
06572                     (struct rt_wdb *wdbp,
06573                      Tcl_Interp    *interp));
06574 RT_EXPORT BU_EXTERN(void dgo_zapall,
06575                     ());
06576 
06577 /* defined in nirt.c */
06578 RT_EXPORT BU_EXTERN(int dgo_nirt_cmd,
06579                     (struct dg_obj *dgop,
06580                      struct view_obj *vop,
06581                      Tcl_Interp *interp,
06582                      int argc,
06583                      char **argv));
06584 RT_EXPORT BU_EXTERN(int dgo_vnirt_cmd,
06585                     (struct dg_obj *dgop,
06586                      struct view_obj *vop,
06587                      Tcl_Interp *interp,
06588                      int argc,
06589                      char **argv));
06590 
06591 
06592 /* defined in bigE.c */
06593 RT_EXPORT BU_EXTERN(int dg_E_cmd,
06594                     (struct dg_obj *dgop,
06595                      Tcl_Interp *interp,
06596                      int argc,
06597                      char **argv));
06598 
06599 /* defined in view_obj.c */
06600 RT_EXPORT BU_EXTERN(struct view_obj *vo_open_cmd,
06601                     (const char *oname));
06602 RT_EXPORT BU_EXTERN(void vo_center,
06603                     (struct view_obj *vop,
06604                      Tcl_Interp *interp,
06605                      point_t center));
06606 RT_EXPORT BU_EXTERN(int vo_center_cmd,
06607                     (struct view_obj *vop,
06608                      Tcl_Interp *interp,
06609                      int argc,
06610                      char **argv));
06611 RT_EXPORT BU_EXTERN(void vo_size,
06612                     (struct view_obj *vop,
06613                      Tcl_Interp *interp,
06614                      fastf_t size));
06615 RT_EXPORT BU_EXTERN(int vo_size_cmd,
06616                     (struct view_obj *vop,
06617                      Tcl_Interp *interp,
06618                      int argc,
06619                      char **argv));
06620 RT_EXPORT BU_EXTERN(int vo_invSize_cmd,
06621                     (struct view_obj *vop,
06622                      Tcl_Interp *interp,
06623                      int argc,
06624                      char **argv));
06625 RT_EXPORT BU_EXTERN(void vo_mat_aet,
06626                     (struct view_obj *vop));
06627 RT_EXPORT BU_EXTERN(int vo_zoom,
06628                     (struct view_obj *vop,
06629                      Tcl_Interp *interp,
06630                      fastf_t sf));
06631 RT_EXPORT BU_EXTERN(int vo_zoom_cmd,
06632                     (struct view_obj *vop,
06633                      Tcl_Interp *interp,
06634                      int argc, char **argv));
06635 RT_EXPORT BU_EXTERN(int vo_orientation_cmd,
06636                     (struct view_obj *vop,
06637                      Tcl_Interp *interp,
06638                      int argc,
06639                      char **argv));
06640 RT_EXPORT BU_EXTERN(int vo_lookat_cmd,
06641                     (struct view_obj *vop,
06642                      Tcl_Interp *interp,
06643                      int argc,
06644                      char **argv));
06645 RT_EXPORT BU_EXTERN(void vo_setview,
06646                     (struct view_obj *vop,
06647                      Tcl_Interp *interp,
06648                      vect_t rvec));
06649 RT_EXPORT BU_EXTERN(int vo_setview_cmd,
06650                     (struct view_obj *vop,
06651                      Tcl_Interp *interp,
06652                      int argc,
06653                      char **argv));
06654 RT_EXPORT BU_EXTERN(int vo_eye_cmd,
06655                     (struct view_obj *vop,
06656                      Tcl_Interp *interp,
06657                      int argc,
06658                      char **argv));
06659 RT_EXPORT BU_EXTERN(int vo_eye_pos_cmd,
06660                     (struct view_obj *vop,
06661                      Tcl_Interp *interp,
06662                      int argc,
06663                      char **argv));
06664 RT_EXPORT BU_EXTERN(int vo_pmat_cmd,
06665                     (struct view_obj *vop,
06666                      Tcl_Interp *interp,
06667                      int argc,
06668                      char **argv));
06669 RT_EXPORT BU_EXTERN(int vo_perspective_cmd,
06670                     (struct view_obj *vop,
06671                      Tcl_Interp *interp,
06672                      int argc,
06673                      char **argv));
06674 RT_EXPORT BU_EXTERN(void vo_update,
06675                     (struct view_obj *vop,
06676                      Tcl_Interp *interp,
06677                      int oflag));
06678 RT_EXPORT BU_EXTERN(int vo_aet_cmd,
06679                     (struct view_obj *vop,
06680                      Tcl_Interp *interp,
06681                      int argc,
06682                      char **argv));
06683 RT_EXPORT BU_EXTERN(int vo_rmat_cmd,
06684                     (struct view_obj *vop,
06685                      Tcl_Interp *interp,
06686                      int argc,
06687                      char **argv));
06688 RT_EXPORT BU_EXTERN(int vo_model2view_cmd,
06689                     (struct view_obj *vop,
06690                      Tcl_Interp *interp,
06691                      int argc,
06692                      char **argv));
06693 RT_EXPORT BU_EXTERN(int vo_pmodel2view_cmd,
06694                     (struct view_obj *vop,
06695                      Tcl_Interp *interp,
06696                      int argc,
06697                      char **argv));
06698 RT_EXPORT BU_EXTERN(int vo_view2model_cmd,
06699                     (struct view_obj *vop,
06700                      Tcl_Interp *interp,
06701                      int argc,
06702                      char **argv));
06703 RT_EXPORT BU_EXTERN(int vo_pov_cmd,
06704                     (struct view_obj *vop,
06705                      Tcl_Interp *interp,
06706                      int argc,
06707                      char **argv));
06708 RT_EXPORT BU_EXTERN(int vo_units_cmd,
06709                     (struct view_obj *vop,
06710                      Tcl_Interp *interp,
06711                      int argc,
06712                      char **argv));
06713 RT_EXPORT BU_EXTERN(int vo_base2local_cmd,
06714                     (struct view_obj *vop,
06715                      Tcl_Interp *interp,
06716                      int argc,
06717                      char **argv));
06718 RT_EXPORT BU_EXTERN(int vo_local2base_cmd,
06719                     (struct view_obj *vop,
06720                      Tcl_Interp *interp,
06721                      int argc,
06722                      char **argv));
06723 RT_EXPORT BU_EXTERN(int vo_rot,
06724                     (struct view_obj *vop,
06725                      Tcl_Interp *interp,
06726                      char coord,
06727                      char origin,
06728                      mat_t rmat,
06729                      int (*func)()));
06730 RT_EXPORT BU_EXTERN(int vo_rot_cmd,
06731                     (struct view_obj *vop,
06732                      Tcl_Interp *interp,
06733                      int argc, char **argv,
06734                      int (*func)()));
06735 RT_EXPORT BU_EXTERN(int vo_arot_cmd,
06736                     (struct view_obj *vop,
06737                      Tcl_Interp *interp,
06738                      int argc,
06739                      char **argv,
06740                      int (*func)()));
06741 RT_EXPORT BU_EXTERN(int vo_mrot_cmd,
06742                     (struct view_obj *vop,
06743                      Tcl_Interp *interp,
06744                      int argc,
06745                      char **argv,
06746                      int (*func)()));
06747 RT_EXPORT BU_EXTERN(int vo_tra,
06748                     (struct view_obj *vop,
06749                      Tcl_Interp *interp,
06750                      char coord,
06751                      vect_t tvec,
06752                      int (*func)()));
06753 RT_EXPORT BU_EXTERN(int vo_tra_cmd,
06754                     (struct view_obj *vop,
06755                      Tcl_Interp *interp,
06756                      int argc, char **argv,
06757                      int (*func)()));
06758 RT_EXPORT BU_EXTERN(int vo_slew,
06759                     (struct view_obj *vop,
06760                      Tcl_Interp *interp,
06761                      vect_t svec));
06762 RT_EXPORT BU_EXTERN(int vo_slew_cmd,
06763                     (struct view_obj *vop,
06764                      Tcl_Interp *interp,
06765                      int argc, char **argv));
06766 RT_EXPORT BU_EXTERN(int vo_observer_cmd,
06767                     (struct view_obj *vop,
06768                      Tcl_Interp *interp,
06769                      int argc,
06770                      char **argv));
06771 RT_EXPORT BU_EXTERN(int vo_coord_cmd,
06772                     (struct view_obj *vop,
06773                      Tcl_Interp *interp,
06774                      int argc,
06775                      char **argv));
06776 RT_EXPORT BU_EXTERN(int vo_rotate_about_cmd,
06777                     (struct view_obj *vop,
06778                      Tcl_Interp *interp,
06779                      int argc,
06780                      char **argv));
06781 RT_EXPORT BU_EXTERN(int vo_keypoint_cmd,
06782                     (struct view_obj *vop,
06783                      Tcl_Interp *interp,
06784                      int argc,
06785                      char **argv));
06786 RT_EXPORT BU_EXTERN(int vo_vrot_cmd,
06787                     (struct view_obj *vop,
06788                      Tcl_Interp *interp,
06789                      int argc,
06790                      char **argv));
06791 RT_EXPORT BU_EXTERN(int vo_sca,
06792                     (struct view_obj *vop,
06793                      Tcl_Interp *interp,
06794                      fastf_t sf,
06795                      int (*func)()));
06796 RT_EXPORT BU_EXTERN(int vo_sca_cmd,
06797                     (struct view_obj *vop,
06798                      Tcl_Interp *interp,
06799                      int argc,
06800                      char **argv,
06801                      int (*func)()));
06802 
06803 /* defined in binary_obj.c */
06804 RT_EXPORT BU_EXTERN(int rt_mk_binunif,
06805                     (struct rt_wdb *wdbp,
06806                      const char *obj_name,
06807                      const char *file_name,
06808                      unsigned int minor_type,
06809                      long max_count));
06810 
06811 /* XXX do not rely on *_ifree() functions */
06812 #ifdef _WIN32
06813 /* defined in g_dsp.c */
06814 RT_EXPORT BU_EXTERN(void rt_dsp_ifree,
06815                     (struct rt_db_internal *ip));
06816 
06817 /* defined in g_ebm.c */
06818 RT_EXPORT BU_EXTERN(void rt_ebm_ifree,
06819                     (struct rt_db_internal *ip));
06820 
06821 /* defined in g_vol.c */
06822 RT_EXPORT BU_EXTERN(void rt_vol_ifree,
06823                     (struct rt_db_internal *ip));
06824 #endif
06825 
06826 /* defined in db5_bin.c */
06827 RT_EXPORT BU_EXTERN(void rt_binunif_free,
06828                     (struct rt_binunif_internal *bip));
06829 RT_EXPORT BU_EXTERN(void rt_binunif_dump,
06830                     (struct rt_binunif_internal *bip));
06831 
06832 /* defined in g_cline.c */
06833 RT_EXPORT extern fastf_t rt_cline_radius;
06834 
06835 /* defined in g_bot.c */
06836 RT_EXPORT extern int rt_bot_minpieces;
06837 RT_EXPORT extern int rt_bot_tri_per_piece;
06838 
06839 
06840 /*
06841  *  Constants provided and used by the RT library.
06842  */
06843 RT_EXPORT extern const struct db_tree_state rt_initial_tree_state;
06844 RT_EXPORT extern const char *rt_vlist_cmd_descriptions[];
06845 
06846 /* vers.c */
06847 RT_EXPORT extern const char rt_version[];
06848 
06849 __END_DECLS
06850 
06851 #endif /* RAYTRACE_H */
06852 /*@}*/
06853 /*
06854  * Local Variables:
06855  * mode: C
06856  * tab-width: 8
06857  * c-basic-offset: 4
06858  * indent-tabs-mode: t
06859  * End:
06860  * ex: shiftwidth=4 tabstop=8
06861  */
06862 

Generated on Mon Sep 18 01:24:42 2006 for BRL-CAD by  doxygen 1.4.6