~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Cross Reference
BRL-CAD/include/rtgeom.h

Version: ~ [ 7.24.0 ] ~

  1 /*                        R T G E O M . H
  2  * BRL-CAD
  3  *
  4  * Copyright (c) 2004-2013 United States Government as represented by
  5  * the U.S. Army Research Laboratory.
  6  *
  7  * This library is free software; you can redistribute it and/or
  8  * modify it under the terms of the GNU Lesser General Public License
  9  * version 2.1 as published by the Free Software Foundation.
 10  *
 11  * This library is distributed in the hope that it will be useful, but
 12  * WITHOUT ANY WARRANTY; without even the implied warranty of
 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14  * Lesser General Public License for more details.
 15  *
 16  * You should have received a copy of the GNU Lesser General Public
 17  * License along with this file; see the file named COPYING for more
 18  * information.
 19  */
 20 /** @addtogroup g_ */
 21 /** @{ */
 22 /** @file rtgeom.h
 23  *
 24  * @brief Details of the internal forms used by the LIBRT geometry
 25  * routines for the different solids.
 26  *
 27  * These structures are what the struct rt_db_internal generic pointer
 28  * idb_ptr points at, based on idb_type indicating a solid id ID_xxx,
 29  * such as ID_TGC.
 30  *
 31  */
 32 
 33 #ifndef __RTGEOM_H__
 34 #define __RTGEOM_H__
 35 
 36 #include "common.h"
 37 
 38 #include "vmath.h"
 39 #include "bu.h"
 40 
 41 #include "nmg.h" /* (temporarily?) needed for knot_vector */
 42 #include "brep.h"
 43 
 44 
 45 __BEGIN_DECLS
 46 
 47 #define NAMELEN 16      /* NAMESIZE from db.h (can't call it NAMESIZE!!!!!) */
 48 
 49 /*
 50  *      ID_TOR
 51  */
 52 struct rt_tor_internal {
 53     uint32_t magic;
 54     point_t     v;              /**< @brief  center point */
 55     vect_t      h;              /**< @brief  normal, unit length */
 56     fastf_t     r_h;            /**< @brief  radius in H direction (r2) */
 57     fastf_t     r_a;            /**< @brief  radius in A direction (r1) */
 58     /* REMAINING ELEMENTS PROVIDED BY IMPORT, UNUSED BY EXPORT */
 59     vect_t      a;              /**< @brief  r_a length */
 60     vect_t      b;              /**< @brief  r_b length */
 61     fastf_t     r_b;            /**< @brief  radius in B direction (typ == r_a) */
 62 };
 63 #define RT_TOR_CK_MAGIC(_p)     BU_CKMAG(_p, RT_TOR_INTERNAL_MAGIC, "rt_tor_internal")
 64 
 65 /**
 66  *      ID_TGC and ID_REC
 67  */
 68 struct rt_tgc_internal {
 69     uint32_t magic;
 70     point_t     v;
 71     vect_t      h;
 72     vect_t      a;
 73     vect_t      b;
 74     vect_t      c;
 75     vect_t      d;
 76 };
 77 #define RT_TGC_CK_MAGIC(_p)     BU_CKMAG(_p, RT_TGC_INTERNAL_MAGIC, "rt_tgc_internal")
 78 
 79 /*
 80  *      ID_ELL, and ID_SPH
 81  */
 82 struct rt_ell_internal  {
 83     uint32_t magic;
 84     point_t     v;      /**< @brief center point */
 85     vect_t      a;      /**< @brief axis a radial length */
 86     vect_t      b;      /**< @brief axis b radial length */
 87     vect_t      c;      /**< @brief axis c radial length */
 88 };
 89 #define RT_ELL_CK_MAGIC(_p)     BU_CKMAG(_p, RT_ELL_INTERNAL_MAGIC, "rt_ell_internal")
 90 
 91 /*
 92  *      ID_SUPERELL
 93  */
 94 struct rt_superell_internal {
 95     uint32_t magic;
 96     point_t v;
 97     vect_t  a;
 98     vect_t  b;
 99     vect_t  c;
100     double n;
101     double e;
102 };
103 #define RT_SUPERELL_CK_MAGIC(_p)        BU_CKMAG(_p, RT_SUPERELL_INTERNAL_MAGIC, "rt_superell_internal")
104 
105 /**
106  * ID_METABALL
107  *
108  * The "metaball" primitive contains a method ID, threshold value, and
109  * an unordered set of control points. Each control point contains a
110  * 3d location, a "field strength", and possibly a "blobbiness" value
111  * (called "goo" in rt_metaball_add_point).
112  *
113  * There are three method ID's defined:
114  *
115  * 1. "metaball", which is the Tokyo Metaball approximation of the
116  *    Blinn Blobby Surface. This method is not implemented yet.
117  *
118  * 2. "blob", the Blinn method.
119  *
120  * 3. "iso", which is a simple computation like you'd see for
121  *    computing gravitational magnitude or point charge in a basic
122  *    physics course.  Blending function in latex notation is:
123  *
124  @code
125                 \Sum_{i}\frac{f_{i}}{d^{2}}
126  @endcode
127  *
128  * The surface of the primitive exists where the summation of the
129  * points contribution is equal to the threshold, with the general
130  * fldstr/distance^2 pattern.
131  *
132  * The blobbiness value is only used in the blob method, and modifies
133  * the gusseting effect.
134  *
135  */
136 struct rt_metaball_internal {
137     uint32_t magic;
138     /* these three defines are used with the method field */
139 #define METABALL_METABALL     0
140 #define METABALL_ISOPOTENTIAL 1
141 #define METABALL_BLOB         2
142     int method;
143     fastf_t threshold;
144     fastf_t initstep;
145     fastf_t finalstep; /* for raytrace stepping. */
146     struct bu_list metaball_ctrl_head;
147 };
148 #define RT_METABALL_CK_MAGIC(_p)        BU_CKMAG(_p, RT_METABALL_INTERNAL_MAGIC, "rt_metaball_internal")
149 
150 /*
151  *      ID_ARB8
152  *
153  *  The internal (in memory) form of an ARB8 -- 8 points in space.
154  *  The first 4 form the "bottom" face, the second 4 form the "top" face.
155  */
156 struct rt_arb_internal {
157     uint32_t magic;
158     point_t     pt[8];
159 };
160 #define RT_ARB_CK_MAGIC(_p)     BU_CKMAG(_p, RT_ARB_INTERNAL_MAGIC, "rt_arb_internal")
161 
162 /*
163  *      ID_ARS
164  */
165 struct rt_ars_internal {
166     uint32_t magic;
167     size_t ncurves;
168     size_t pts_per_curve;
169     fastf_t     **curves;
170 };
171 #define RT_ARS_CK_MAGIC(_p)     BU_CKMAG(_p, RT_ARS_INTERNAL_MAGIC, "rt_ars_internal")
172 
173 /*
174  *      ID_HALF
175  */
176 struct rt_half_internal  {
177     uint32_t magic;
178     plane_t     eqn;
179 };
180 #define RT_HALF_CK_MAGIC(_p)    BU_CKMAG(_p, RT_HALF_INTERNAL_MAGIC, "rt_half_internal")
181 
182 /*
183  *      ID_GRIP
184  */
185 struct rt_grip_internal {
186     uint32_t magic;
187     point_t     center;
188     /* Remaining elements are used for display purposes only */
189     vect_t      normal;
190     fastf_t     mag;
191 };
192 #define RT_GRIP_CK_MAGIC(_p)    BU_CKMAG(_p, RT_GRIP_INTERNAL_MAGIC, "rt_grip_internal")
193 
194 /**
195  *      ID_POLY
196  */
197 struct rt_pg_internal {
198     uint32_t magic;
199     size_t npoly;
200     struct rt_pg_face_internal {
201         size_t npts;            /**< @brief  number of points for this polygon */
202         fastf_t *verts;         /**< @brief  has 3*npts elements */
203         fastf_t *norms;         /**< @brief  has 3*npts elements */
204     } *poly;                    /**< @brief  has npoly elements */
205     /* REMAINING ELEMENTS PROVIDED BY IMPORT, UNUSED BY EXPORT */
206     size_t max_npts;            /**< @brief  maximum value of npts in poly[] */
207 };
208 #define RT_PG_CK_MAGIC(_p)      BU_CKMAG(_p, RT_PG_INTERNAL_MAGIC, "rt_pg_internal")
209 
210 /* ID_BSPLINE */
211 struct rt_nurb_internal {
212     uint32_t magic;
213     int nsrf;                   /**< @brief  number of surfaces */
214     struct face_g_snurb **srfs; /**< @brief  The surfaces themselves */
215 #ifdef CONVERT_TO_BREP
216     ON_Brep *brep;
217 #endif
218 };
219 
220 #define RT_NURB_CK_MAGIC( _p) BU_CKMAG(_p, RT_NURB_INTERNAL_MAGIC, "rt_nurb_internal");
221 #define RT_NURB_GET_CONTROL_POINT(_s, _u, _v)   ((_s)->ctl_points[ \
222         ((_v)*(_s)->s_size[0]+(_u))*RT_NURB_EXTRACT_COORDS((_s)->pt_type)])
223 
224 /* ID_BREP */
225 struct rt_brep_internal {
226     uint32_t magic;
227 
228     ON_Brep* brep; /**< @brief  An openNURBS brep object containing the solid */
229 };
230 
231 #define RT_BREP_CK_MAGIC( _p) BU_CKMAG(_p, RT_BREP_INTERNAL_MAGIC, "rt_brep_internal");
232 #define RT_BREP_TEST_MAGIC( _p) ((_p) && (*((uint32_t *)(_p)) == (uint32_t)(RT_BREP_INTERNAL_MAGIC)))
233 
234 
235 /*
236  * ID_NMG
237  *
238  * The internal form of the NMG is not rt_nmg_internal, but just a
239  * "struct model", from nmg.h.  e.g.:
240  *
241  *      if ( intern.idb_type == ID_NMG )
242  *              m = (struct model *)intern.idb_ptr;
243  */
244 
245 /*
246  *      ID_EBM
247  */
248 #define RT_EBM_NAME_LEN 256
249 struct rt_ebm_internal  {
250     uint32_t magic;
251     char                file[RT_EBM_NAME_LEN];
252     /* NOTE: xdim/ydim cannot be size_t until rel8 as they are
253      * written out to disk via bu_vls_struct_print() as 32-bit ints.
254      */
255     uint32_t            xdim;           /**< @brief  X dimension (w cells) */
256     uint32_t            ydim;           /**< @brief  Y dimension (n cells) */
257     fastf_t             tallness;       /**< @brief  Z dimension (mm) */
258     mat_t               mat;            /**< @brief  convert local coords to model space */
259     /* REMAINING ELEMENTS PROVIDED BY IMPORT, UNUSED BY EXPORT */
260     struct bu_mapped_file       *mp;    /**< @brief  actual data */
261 };
262 #define RT_EBM_CK_MAGIC(_p)     BU_CKMAG(_p, RT_EBM_INTERNAL_MAGIC, "rt_ebm_internal")
263 
264 /*
265  *      ID_VOL
266  */
267 #define RT_VOL_NAME_LEN 128
268 struct rt_vol_internal  {
269     uint32_t magic;
270     char                file[RT_VOL_NAME_LEN];
271     /* NOTE: [xyz]dim/lo/hi cannot be size_t until rel8 as they are
272      * written out to disk via bu_vls_struct_print() as 32-bit ints.
273      */
274     uint32_t            xdim;           /**< @brief  X dimension */
275     uint32_t            ydim;           /**< @brief  Y dimension */
276     uint32_t            zdim;           /**< @brief  Z dimension */
277     uint32_t            lo;             /**< @brief  Low threshold */
278     uint32_t            hi;             /**< @brief  High threshold */
279     vect_t              cellsize;       /**< @brief  ideal coords: size of each cell */
280     mat_t               mat;            /**< @brief  convert local coords to model space */
281     /* REMAINING ELEMENTS PROVIDED BY IMPORT, UNUSED BY EXPORT */
282     unsigned char       *map;
283 };
284 #define RT_VOL_CK_MAGIC(_p)     BU_CKMAG(_p, RT_VOL_INTERNAL_MAGIC, "rt_vol_internal")
285 
286 /*
287  *      ID_HF
288  */
289 struct rt_hf_internal {
290     uint32_t magic;
291     /* BEGIN USER SETTABLE VARIABLES */
292     char                cfile[128];     /**< @brief  name of control file (optional) */
293     char                dfile[128];     /**< @brief  name of data file */
294     char                fmt[8];         /**< @brief  CV style file format descriptor */
295     /* NOTE: w/n/shorts cannot be size_t until rel8 as they are
296      * written out to disk via bu_vls_struct_print() as 32-bit ints.
297      */
298     uint32_t            w;              /**< @brief  # samples wide of data file.  ("i", "x") */
299     uint32_t            n;              /**< @brief  nlines of data file.  ("j", "y") */
300     uint32_t            shorts;         /**< @brief  !0 --> memory array is short, not float */
301     fastf_t             file2mm;        /**< @brief  scale factor to cvt file units to mm */
302     vect_t              v;              /**< @brief  origin of HT in model space */
303     vect_t              x;              /**< @brief  model vect corresponding to "w" dir (will be unitized) */
304     vect_t              y;              /**< @brief  model vect corresponding to "n" dir (will be unitized) */
305     fastf_t             xlen;           /**< @brief  model len of HT rpp in "w" dir */
306     fastf_t             ylen;           /**< @brief  model len of HT rpp in "n" dir */
307     fastf_t             zscale;         /**< @brief  scale of data in ''up'' dir (after file2mm is applied) */
308     /* END USER SETTABLE VARIABLES, BEGIN INTERNAL STUFF */
309     struct bu_mapped_file       *mp;    /**< @brief  actual data */
310 };
311 #define RT_HF_CK_MAGIC(_p)      BU_CKMAG(_p, RT_HF_INTERNAL_MAGIC, "rt_hf_internal")
312 
313 /*
314  *      ID_ARBN
315  */
316 struct rt_arbn_internal  {
317     uint32_t magic;
318     size_t      neqn;
319     plane_t     *eqn;
320 };
321 #define RT_ARBN_CK_MAGIC(_p)    BU_CKMAG(_p, RT_ARBN_INTERNAL_MAGIC, "rt_arbn_internal")
322 
323 /*
324  *      ID_PIPE
325  */
326 struct rt_pipe_internal {
327     uint32_t pipe_magic;
328     struct bu_list pipe_segs_head;
329     /* REMAINING ELEMENTS PROVIDED BY IMPORT, UNUSED BY EXPORT */
330     int pipe_count;
331 };
332 #define RT_PIPE_CK_MAGIC(_p)    BU_CKMAG(_p, RT_PIPE_INTERNAL_MAGIC, "rt_pipe_internal")
333 
334 /*
335  *      ID_PARTICLE
336  */
337 struct rt_part_internal {
338     uint32_t part_magic;
339     point_t     part_V;
340     vect_t      part_H;
341     fastf_t     part_vrad;
342     fastf_t     part_hrad;
343     /* REMAINING ELEMENTS PROVIDED BY IMPORT, UNUSED BY EXPORT */
344     int part_type;      /**< @brief  sphere, cylinder, cone */
345 };
346 #define RT_PART_CK_MAGIC(_p)    BU_CKMAG(_p, RT_PART_INTERNAL_MAGIC, "rt_part_internal")
347 
348 #define RT_PARTICLE_TYPE_SPHERE         1
349 #define RT_PARTICLE_TYPE_CYLINDER       2
350 #define RT_PARTICLE_TYPE_CONE           3
351 
352 /*
353  *      ID_RPC
354  */
355 struct rt_rpc_internal {
356     uint32_t rpc_magic;
357     point_t     rpc_V;  /**< @brief  rpc vertex */
358     vect_t      rpc_H;  /**< @brief  height vector */
359     vect_t      rpc_B;  /**< @brief  breadth vector */
360     fastf_t     rpc_r;  /**< @brief  scalar half-width of rectangular face */
361 };
362 #define RT_RPC_CK_MAGIC(_p)     BU_CKMAG(_p, RT_RPC_INTERNAL_MAGIC, "rt_rpc_internal")
363 
364 /*
365  *      ID_RHC
366  */
367 struct rt_rhc_internal {
368     uint32_t rhc_magic;
369     point_t     rhc_V;  /**< @brief  rhc vertex */
370     vect_t      rhc_H;  /**< @brief  height vector */
371     vect_t      rhc_B;  /**< @brief  breadth vector */
372     fastf_t     rhc_r;  /**< @brief  scalar half-width of rectangular face */
373     fastf_t     rhc_c;  /**< @brief  dist from hyperbola to vertex of asymptotes */
374 };
375 #define RT_RHC_CK_MAGIC(_p)     BU_CKMAG(_p, RT_RHC_INTERNAL_MAGIC, "rt_rhc_internal")
376 
377 /*
378  *      ID_EPA
379  */
380 struct rt_epa_internal {
381     uint32_t epa_magic;
382     point_t     epa_V;  /**< @brief  epa vertex */
383     vect_t      epa_H;  /**< @brief  height vector */
384     vect_t      epa_Au; /**< @brief  unit vector along semi-major axis */
385     fastf_t     epa_r1; /**< @brief  scalar semi-major axis length */
386     fastf_t     epa_r2; /**< @brief  scalar semi-minor axis length */
387 };
388 #define RT_EPA_CK_MAGIC(_p)     BU_CKMAG(_p, RT_EPA_INTERNAL_MAGIC, "rt_epa_internal")
389 
390 /*
391  *      ID_EHY
392  */
393 struct rt_ehy_internal {
394     uint32_t ehy_magic;
395     point_t     ehy_V;  /**< @brief  ehy vertex */
396     vect_t      ehy_H;  /**< @brief  height vector */
397     vect_t      ehy_Au; /**< @brief  unit vector along semi-major axis */
398     fastf_t     ehy_r1; /**< @brief  scalar semi-major axis length */
399     fastf_t     ehy_r2; /**< @brief  scalar semi-minor axis length */
400     fastf_t     ehy_c;  /**< @brief  dist from hyperbola to vertex of asymptotes */
401 };
402 #define RT_EHY_CK_MAGIC(_p)     BU_CKMAG(_p, RT_EHY_INTERNAL_MAGIC, "rt_ehy_internal")
403 
404 /*
405  *      ID_HYP
406  */
407 struct rt_hyp_internal {
408     uint32_t hyp_magic;
409     point_t     hyp_Vi; /**< @brief  hyp vertex */
410     vect_t      hyp_Hi; /**< @brief  full height vector */
411     vect_t      hyp_A;  /**< @brief  semi-major axis */
412     fastf_t     hyp_b;  /**< @brief  scalar semi-minor axis length */
413     fastf_t     hyp_bnr;/**< @brief  ratio of minimum neck width to base width */
414 };
415 #define RT_HYP_CK_MAGIC(_p)     BU_CKMAG(_p, RT_HYP_INTERNAL_MAGIC, "rt_hyp_internal")
416 
417 
418 /*
419  *      ID_ETO
420  */
421 struct rt_eto_internal {
422     uint32_t eto_magic;
423     point_t     eto_V;  /**< @brief  eto vertex */
424     vect_t      eto_N;  /**< @brief  vector normal to plane of torus */
425     vect_t      eto_C;  /**< @brief  vector along semi-major axis of ellipse */
426     fastf_t     eto_r;  /**< @brief  scalar radius of rotation */
427     fastf_t     eto_rd; /**< @brief  scalar length of semi-minor of ellipse */
428 };
429 #define RT_ETO_CK_MAGIC(_p)     BU_CKMAG(_p, RT_ETO_INTERNAL_MAGIC, "rt_eto_internal")
430 
431 /*
432  *      ID_DSP
433  */
434 #define DSP_NAME_LEN 128
435 struct rt_dsp_internal{
436     uint32_t magic;
437 #define dsp_file dsp_name               /**< @brief for backwards compatibility */
438     struct bu_vls dsp_name;     /**< TODO: make this a pointer, name of data file */
439 
440     /* NOTE: dsp_xcnt/dsp_ycnt cannot be size_t until rel8 as they are
441      * written out to disk via bu_vls_struct_print() as 32-bit ints.
442      */
443     uint32_t dsp_xcnt;  /**< @brief  # samples in row of data */
444     uint32_t dsp_ycnt;  /**< @brief  # of columns in data */
445     unsigned short dsp_smooth;  /**< @brief  bool: surf normal interp */
446 #define DSP_CUT_DIR_ADAPT       'a'
447 #define DSP_CUT_DIR_llUR        'l'
448 #define DSP_CUT_DIR_ULlr        'L'
449     unsigned char dsp_cuttype;  /**< @brief  type of cut to make */
450 
451     mat_t dsp_mtos;     /**< @brief  model to solid space */
452     /* END OF USER SETTABLE VARIABLES, BEGIN INTERNAL STUFF */
453     mat_t dsp_stom;     /**< @brief  solid to model space
454                                          * computed from dsp_mtos */
455     unsigned short *dsp_buf;    /**< @brief  actual data */
456     struct bu_mapped_file *dsp_mp;      /**< @brief  mapped file for data */
457     struct rt_db_internal *dsp_bip;     /**< @brief  db object for data */
458 #define RT_DSP_SRC_V4_FILE      '4'
459 #define RT_DSP_SRC_FILE 'f'
460 #define RT_DSP_SRC_OBJ  'o'
461     char dsp_datasrc;   /**< @brief  which type of data source */
462 };
463 #define RT_DSP_CK_MAGIC(_p)     BU_CKMAG(_p, RT_DSP_INTERNAL_MAGIC, "rt_dsp_internal")
464 
465 
466 /*
467  *      ID_SKETCH
468  */
469 
470 /**
471  * container for a set of sketch segments
472  */
473 struct rt_curve {
474     size_t count;       /**< number of segments in this curve */
475     int *reverse;       /**< array of boolean flags indicating if
476                          * segment should be reversed
477                          */
478     genptr_t *segment;  /**< array of curve segment pointers */
479 };
480 
481 
482 /**
483  * L I N E _ S E G,  C A R C _ S E G,  N U R B _ S E G
484  *
485  * used by the sketch and solid of extrusion
486  */
487 struct line_seg         /**< @brief  line segment */
488 {
489     uint32_t magic;
490     int                 start, end;     /**< @brief  indices into sketch's array of vertices */
491 };
492 
493 struct carc_seg         /**< @brief  circular arc segment */
494 {
495     uint32_t magic;
496     int                 start, end;     /**< @brief  indices */
497     fastf_t             radius;         /**< @brief  radius < 0.0 -> full circle with start point on
498                                          * circle and "end" at center */
499     int                 center_is_left; /**< @brief  flag indicating where center of curvature is.
500                                          * If non-zero, then center is to left of vector
501                                          * from start to end */
502     int                 orientation;    /**< @brief  0 -> ccw, !0 -> cw */
503     int                 center;         /**< @brief  index of vertex at center of arc (only used by rt_extrude_prep and rt_extrude_shot) */
504 };
505 
506 struct nurb_seg         /**< @brief  NURB curve segment */
507 {
508     uint32_t magic;
509     int                 order;          /**< @brief  order of NURB curve (degree - 1) */
510     int                 pt_type;        /**< @brief  type of NURB curve */
511     struct knot_vector  k;              /**< @brief  knot vector for NURB curve */
512     int                 c_size;         /**< @brief  number of control points */
513     int                 *ctl_points;    /**< @brief  array of indices for control points */
514     fastf_t             *weights;       /**< @brief  array of weights for control points (NULL if non_rational) */
515 };
516 
517 struct bezier_seg       /**< @brief  Bezier curve segment */
518 {
519     uint32_t magic;
520     int                 degree;         /**< @brief  degree of curve (number of control points - 1) */
521     int                 *ctl_points;    /**< @brief  array of indices for control points */
522 };
523 
524 
525 #define SKETCH_NAME_LEN 16
526 struct rt_sketch_internal
527 {
528     uint32_t magic;
529     point_t V;                  /**< default embedding of sketch */
530     vect_t u_vec;               /**< unit vector 'u' component
531                                  * defining the sketch plane
532                                  */
533     vect_t v_vec;               /**< unit vector 'v' component
534                                  * defining the sketch plane
535                                  */
536     size_t vert_count;          /**< number of sketch vertices */
537     point2d_t *verts;           /**< array of 2D vertices that may be
538                                  * used as endpoints, centers, or
539                                  * spline control points
540                                  */
541     struct rt_curve curve;      /**< the curves of this sketch */
542 };
543 #define RT_SKETCH_CK_MAGIC(_p)  BU_CKMAG(_p, RT_SKETCH_INTERNAL_MAGIC, "rt_sketch_internal")
544 
545 /*
546  *      ID_SUBMODEL
547  */
548 struct rt_submodel_internal {
549     uint32_t magic;
550     struct bu_vls file;         /**< @brief  .g filename, 0-len --> this database. */
551     struct bu_vls treetop;      /**< @brief  one treetop only */
552     int meth;                   /**< @brief  space partitioning method */
553     /* other option flags (lazy prep, etc.)?? */
554     /* REMAINING ELEMENTS PROVIDED BY IMPORT, UNUSED BY EXPORT */
555     mat_t root2leaf;
556     const struct db_i *dbip;
557 };
558 #define RT_SUBMODEL_CK_MAGIC(_p)        BU_CKMAG(_p, RT_SUBMODEL_INTERNAL_MAGIC, "rt_submodel_internal")
559 
560 /*
561  *      ID_EXTRUDE
562  */
563 
564 struct rt_extrude_internal
565 {
566     uint32_t magic;
567     point_t             V;              /**< @brief  vertex, start and end point of loop to be extruded */
568     vect_t              h;              /**< @brief  extrusion vector, may not be in (u_vec X v_vec) plane */
569     vect_t              u_vec;          /**< @brief  vector in U parameter direction */
570     vect_t              v_vec;          /**< @brief  vector in V parameter direction */
571     int                 keypoint;       /**< @brief  DEPRECATED (UNUSED): index of keypoint vertex */
572     char                *sketch_name;   /**< @brief  name of sketch object that defines the curve to be extruded */
573     struct rt_sketch_internal   *skt;   /**< @brief  pointer to referenced sketch */
574 };
575 
576 /**
577  * Note that the u_vec and v_vec are not unit vectors, their magnitude
578  * and direction are used for scaling and rotation.
579  */
580 #define RT_EXTRUDE_CK_MAGIC(_p) BU_CKMAG(_p, RT_EXTRUDE_INTERNAL_MAGIC, "rt_extrude_internal")
581 
582 /*
583  *      ID_REVOLVE
584  */
585 struct rt_revolve_internal {
586     uint32_t magic;
587     point_t             v3d;            /**< @brief vertex in 3d space  */
588     vect_t              axis3d;         /**< @brief revolve axis in 3d space, y axis */
589 
590     point2d_t           v2d;            /**< @brief vertex in 2d sketch */
591     vect2d_t            axis2d;         /**< @brief revolve axis in 2d sketch */
592 
593     vect_t              r;              /**< @brief vector in start plane, x axis */
594     fastf_t             ang;            /**< @brief angle to revolve*/
595     struct bu_vls       sketch_name;    /**< @brief name of sketch */
596     struct rt_sketch_internal *skt;     /**< @brief pointer to sketch */
597 };
598 #define RT_REVOLVE_CK_MAGIC(_p) BU_CKMAG(_p, RT_REVOLVE_INTERNAL_MAGIC, "rt_revolve_internal")
599 
600 /*
601  *      ID_CLINE
602  *
603  *      Implementation of FASTGEN CLINE element
604  */
605 
606 struct rt_cline_internal
607 {
608     uint32_t magic;
609     point_t             v;
610     vect_t              h;
611     fastf_t             radius;
612     fastf_t             thickness;      /**< @brief  zero thickness means volume mode */
613 };
614 #define RT_CLINE_CK_MAGIC(_p)   BU_CKMAG(_p, RT_CLINE_INTERNAL_MAGIC, "rt_cline_internal")
615 
616 /*
617  *      ID_BOT
618  */
619 
620 struct rt_bot_internal
621 {
622     uint32_t magic;
623     unsigned char mode;
624     unsigned char orientation;
625     unsigned char bot_flags;    /**< @brief flags, (indicates surface
626                                  * normals available, for example)
627                                  */
628     size_t num_vertices;
629     size_t num_faces;
630     int *faces;                 /**< @brief array of ints for faces
631                                  * [num_faces*3]
632                                  */
633     fastf_t *vertices;          /**< @brief array of floats for
634                                  * vertices [num_vertices*3]
635                                  */
636     fastf_t *thickness;         /**< @brief array of plate mode
637                                  * thicknesses (corresponds to array
638                                  * of faces) NULL for modes
639                                  * RT_BOT_SURFACE and RT_BOT_SOLID.
640                                  */
641     struct bu_bitv *face_mode;  /**< @brief a flag for each face
642                                  * indicating thickness is appended to
643                                  * hit point in ray direction (if bit
644                                  * is set), otherwise thickness is
645                                  * centered about hit point (NULL for
646                                  * modes RT_BOT_SURFACE and
647                                  * RT_BOT_SOLID).
648                                  */
649     size_t num_normals;
650     fastf_t *normals;           /**< @brief array of unit surface
651                                  * normals [num_normals*3]
652                                  */
653     size_t num_face_normals;    /**< @brief current size of the
654                                  * face_normals array below (number of
655                                  * faces in the array)
656                                  */
657     int *face_normals;          /**< @brief array of indices into the
658                                  * "normals" array, one per face
659                                  * vertex [num_face_normals*3]
660                                  */
661     void *tie;  /* FIXME: blind casting. TIE needs to move from TIE_FUNC to XGLUE before this can not suck. */
662 };
663 
664 struct rt_bot_list {
665     struct bu_list l;
666     struct rt_bot_internal *bot;
667 };
668 
669 /* orientations for BOT */
670 #define RT_BOT_UNORIENTED               1       /**< @brief  unoriented triangles */
671 #define RT_BOT_CCW                      2       /**< @brief  oriented counter-clockwise */
672 #define RT_BOT_CW                       3       /**< @brief  oriented clockwise */
673 
674 /* modes for BOT */
675 #define RT_BOT_SURFACE                  1       /**< @brief  triangles represent a surface (no volume) */
676 #define RT_BOT_SOLID                    2       /**< @brief  triangles represent the boundary of a solid object */
677 
678 /**
679  * triangles represent plates. Thicknesses are specified in
680  * "thickness" array, and face mode is specified in "face_mode" bit
681  * vector.  This is the FASTGEN "plate" mode. Orientation is ignored.
682  */
683 #define RT_BOT_PLATE                    3
684 
685 /**
686  * same as plate mode, but LOS is set equal to face thickness, not the
687  * thickness divided by the cosine of the obliquity angle.
688  */
689 #define RT_BOT_PLATE_NOCOS              4
690 
691 /* flags for bot_flags */
692 #define RT_BOT_HAS_SURFACE_NORMALS    0x1       /**< @brief  This primitive may have surface normals at each face vertex */
693 #define RT_BOT_USE_NORMALS            0x2       /**< @brief  Use the surface normals if they exist */
694 #define RT_BOT_USE_FLOATS             0x4       /**< @brief  Use the single precision version of "tri_specific" during prep */
695 
696 #define RT_BOT_CK_MAGIC(_p)     BU_CKMAG(_p, RT_BOT_INTERNAL_MAGIC, "rt_bot_internal")
697 
698 
699 /**
700  * ID_PNTS
701  *
702  * Points are represented to a structure that contains exactly the
703  * data that it needs for that 'type' of point.  The reason this was
704  * done over using something like a union was to fully optimize memory
705  * usage so that the maximum number of points could be stored without
706  * resorting to out-of-core techniques.  A union is at least the size
707  * of the largest type and would have wasted memory.
708  *
709  * By using this data-driven approach of type identification, it does
710  * result in needing to have a switching table for all supported types
711  * in order to access data.  This could be avoided by storing them as
712  * multiple lists (wasting a few bytes for unused pointers) but is
713  * left as an exercise to the reader.
714  */
715 
716 typedef enum {
717     RT_PNT_TYPE_PNT = 0,
718     RT_PNT_TYPE_COL = 0+1,
719     RT_PNT_TYPE_SCA = 0+2,
720     RT_PNT_TYPE_NRM = 0+4,
721     RT_PNT_TYPE_COL_SCA = 0+1+2,
722     RT_PNT_TYPE_COL_NRM = 0+1+4,
723     RT_PNT_TYPE_SCA_NRM = 0+2+4,
724     RT_PNT_TYPE_COL_SCA_NRM = 0+1+2+4
725 } rt_pnt_type;
726 
727 struct pnt {
728     struct bu_list l;
729     point_t v;
730 };
731 struct pnt_color {
732     struct bu_list l;
733     point_t v;
734     struct bu_color c;
735 };
736 struct pnt_scale {
737     struct bu_list l;
738     point_t v;
739     fastf_t s;
740 };
741 struct pnt_normal {
742     struct bu_list l;
743     point_t v;
744     vect_t n;
745 };
746 struct pnt_color_scale {
747     struct bu_list l;
748     point_t v;
749     struct bu_color c;
750     fastf_t s;
751 };
752 struct pnt_color_normal {
753     struct bu_list l;
754     point_t v;
755     struct bu_color c;
756     vect_t n;
757 };
758 struct pnt_scale_normal {
759     struct bu_list l;
760     point_t v;
761     fastf_t s;
762     vect_t n;
763 };
764 struct pnt_color_scale_normal {
765     struct bu_list l;
766     point_t v;
767     struct bu_color c;
768     fastf_t s;
769     vect_t n;
770 };
771 
772 
773 struct rt_pnts_internal {
774     uint32_t magic;
775     double scale;
776     rt_pnt_type type;
777     unsigned long count;
778     void *point;
779 };
780 #define RT_PNTS_CK_MAGIC(_p)     BU_CKMAG(_p, RT_PNTS_INTERNAL_MAGIC, "rt_pnts_internal")
781 
782 /*
783  *      ID_ANNOTATION
784  *
785  * Annotations are used to provide labels in-scene when viewing geometry.  Leaders connect labels
786  * to geometry objects or fixed points in space.
787  *
788  */
789 
790 struct rt_annotation_internal
791 {
792     uint32_t magic;
793     point_t             V;                      /**< @brief  vertex, start and end point of loop to be extruded */
794     vect_t              h;                      /**< @brief  extrusion vector, may not be in (u_vec X v_vec) plane */
795     vect_t              u_vec;                  /**< @brief  vector in U parameter direction */
796     vect_t              v_vec;                  /**< @brief  vector in V parameter direction */
797     int                 view_aligned;
798     struct bu_vls       label;                  /**< @brief  either user supplied labels, format strings, or empty */
799     struct rt_sketch_internal   *skt;           /**< @brief  pointer to sketch holding label decoration (if any) - same plane as text plane */
800 };
801 
802 /**
803  * Note that the u_vec and v_vec are not unit vectors, their magnitude
804  * and direction are used for scaling and rotation.
805  */
806 #define RT_ANNOTATION_CK_MAGIC(_p)      BU_CKMAG(_p, RT_ANNOTATION_INTERNAL_MAGIC, "rt_annotation_internal")
807 
808 
809 __END_DECLS
810 
811 #endif /* __RTGEOM_H__ */
812 
813 /** @} */
814 /*
815  * Local Variables:
816  * mode: C
817  * tab-width: 8
818  * indent-tabs-mode: t
819  * c-file-style: "stroustrup"
820  * End:
821  * ex: shiftwidth=4 tabstop=8
822  */
823 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.