00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 #ifndef lint
00065 static const char RCSxxx[] = "@(#)$Header: /cvsroot/brlcad/brlcad/src/librt/g_xxx.c,v 14.14 2006/09/16 02:04:25 lbutler Exp $ (BRL)";
00066 #endif
00067
00068 #include "common.h"
00069
00070
00071 #include <stdio.h>
00072 #include <math.h>
00073
00074
00075 #include "machine.h"
00076 #include "vmath.h"
00077 #include "db.h"
00078 #include "nmg.h"
00079 #include "raytrace.h"
00080 #include "rtgeom.h"
00081
00082
00083 #include "./debug.h"
00084
00085
00086 #if 0
00087
00088
00089
00090
00091 struct rt_xxx_internal {
00092 long magic;
00093 vect_t v;
00094 };
00095 # define RT_XXX_INTERNAL_MAGIC 0xxx
00096 # define RT_XXX_CK_MAGIC(_p) BU_CKMAG(_p,RT_XXX_INTERNAL_MAGIC,"rt_xxx_internal")
00097 #endif
00098
00099
00100 struct xxx_specific {
00101 vect_t xxx_V;
00102 };
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120 int
00121 rt_xxx_prep( struct soltab *stp, struct rt_db_internal *ip, struct rt_i *rtip )
00122 {
00123 struct rt_xxx_internal *xxx_ip;
00124 register struct xxx_specific *xxx;
00125 const struct bn_tol *tol = &rtip->rti_tol;
00126
00127 RT_CK_DB_INTERNAL(ip);
00128 xxx_ip = (struct rt_xxx_internal *)ip->idb_ptr;
00129 RT_XXX_CK_MAGIC(xxx_ip);
00130 }
00131
00132
00133
00134
00135 void
00136 rt_xxx_print( const struct soltab *stp )
00137 {
00138 register const struct xxx_specific *xxx =
00139 (struct xxx_specific *)stp->st_specific;
00140 }
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153 int
00154 rt_xxx_shot( struct soltab *stp, struct xray *rp, struct application *ap, struct seg *seghead )
00155 {
00156 register struct xxx_specific *xxx =
00157 (struct xxx_specific *)stp->st_specific;
00158 register struct seg *segp;
00159 const struct bn_tol *tol = &ap->a_rt_i->rti_tol;
00160
00161 return(0);
00162 }
00163
00164 #define RT_XXX_SEG_MISS(SEG) (SEG).seg_stp=RT_SOLTAB_NULL
00165
00166
00167
00168
00169
00170
00171 void
00172 rt_xxx_vshot(struct soltab *stp[],
00173 struct xray *rp[],
00174 struct seg segp[],
00175 int n,
00176 struct application *ap)
00177 {
00178 rt_vstub( stp, rp, segp, n, ap );
00179 }
00180
00181
00182
00183
00184
00185
00186 void
00187 rt_xxx_norm( struct hit *hitp, struct soltab *stp, struct xray *rp )
00188 {
00189 register struct xxx_specific *xxx =
00190 (struct xxx_specific *)stp->st_specific;
00191
00192 VJOIN1( hitp->hit_point, rp->r_pt, hitp->hit_dist, rp->r_dir );
00193 }
00194
00195
00196
00197
00198
00199
00200 void
00201 rt_xxx_curve( struct curvature *cvp, struct hit *hitp, struct soltab *stp )
00202 {
00203 register struct xxx_specific *xxx =
00204 (struct xxx_specific *)stp->st_specific;
00205
00206 cvp->crv_c1 = cvp->crv_c2 = 0;
00207
00208
00209 bn_vec_ortho( cvp->crv_pdir, hitp->hit_normal );
00210 }
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220 void
00221 rt_xxx_uv( struct application *ap, struct soltab *stp, struct hit *hitp, struct uvcoord *uvp )
00222 {
00223 register struct xxx_specific *xxx =
00224 (struct xxx_specific *)stp->st_specific;
00225 }
00226
00227
00228
00229
00230 void
00231 rt_xxx_free( struct soltab *stp )
00232 {
00233 register struct xxx_specific *xxx =
00234 (struct xxx_specific *)stp->st_specific;
00235
00236 bu_free( (char *)xxx, "xxx_specific" );
00237 }
00238
00239
00240
00241
00242 int
00243 rt_xxx_class( const struct soltab *stp, const vect_t min, const vect_t max, const struct bn_tol *tol )
00244 {
00245 return RT_CLASSIFY_UNIMPLEMENTED;
00246 }
00247
00248
00249
00250
00251 int
00252 rt_xxx_plot( struct bu_list *vhead, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol )
00253 {
00254 LOCAL struct rt_xxx_internal *xxx_ip;
00255
00256 RT_CK_DB_INTERNAL(ip);
00257 xxx_ip = (struct rt_xxx_internal *)ip->idb_ptr;
00258 RT_XXX_CK_MAGIC(xxx_ip);
00259
00260 return(-1);
00261 }
00262
00263
00264
00265
00266
00267
00268
00269
00270 int
00271 rt_xxx_tess( struct nmgregion **r, struct model *m, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol )
00272 {
00273 LOCAL struct rt_xxx_internal *xxx_ip;
00274
00275 RT_CK_DB_INTERNAL(ip);
00276 xxx_ip = (struct rt_xxx_internal *)ip->idb_ptr;
00277 RT_XXX_CK_MAGIC(xxx_ip);
00278
00279 return(-1);
00280 }
00281
00282
00283
00284
00285
00286
00287
00288 int
00289 rt_xxx_import( struct rt_db_internal *ip, const struct bu_external *ep, const mat_t mat, const struct db_i *dbip )
00290 {
00291 LOCAL struct rt_xxx_internal *xxx_ip;
00292 union record *rp;
00293
00294 BU_CK_EXTERNAL( ep );
00295 rp = (union record *)ep->ext_buf;
00296
00297 if( rp->u_id != ID_SOLID ) {
00298 bu_log("rt_xxx_import: defective record\n");
00299 return(-1);
00300 }
00301
00302 RT_CK_DB_INTERNAL( ip );
00303 ip->idb_major_type = DB5_MAJORTYPE_BRLCAD;
00304 ip->idb_type = ID_XXX;
00305 ip->idb_meth = &rt_functab[ID_XXX];
00306 ip->idb_ptr = bu_malloc( sizeof(struct rt_xxx_internal), "rt_xxx_internal");
00307 xxx_ip = (struct rt_xxx_internal *)ip->idb_ptr;
00308 xxx_ip->magic = RT_XXX_INTERNAL_MAGIC;
00309
00310 MAT4X3PNT( xxx_ip->xxx_V, mat, &rp->s.s_values[0] );
00311
00312 return(0);
00313 }
00314
00315
00316
00317
00318
00319
00320 int
00321 rt_xxx_export( struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip )
00322 {
00323 struct rt_xxx_internal *xxx_ip;
00324 union record *rec;
00325
00326 RT_CK_DB_INTERNAL(ip);
00327 if( ip->idb_type != ID_XXX ) return(-1);
00328 xxx_ip = (struct rt_xxx_internal *)ip->idb_ptr;
00329 RT_XXX_CK_MAGIC(xxx_ip);
00330
00331 BU_CK_EXTERNAL(ep);
00332 ep->ext_nbytes = sizeof(union record);
00333 ep->ext_buf = (genptr_t)bu_calloc( 1, ep->ext_nbytes, "xxx external");
00334 rec = (union record *)ep->ext_buf;
00335
00336 rec->s.s_id = ID_SOLID;
00337 rec->s.s_type = XXX;
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350 VSCALE( &rec->s.s_values[0], xxx_ip->xxx_V, local2mm );
00351 rec->s.s_values[3] = xxx_ip->xxx_radius * local2mm;
00352
00353 return(0);
00354 }
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368 int
00369 rt_xxx_import5( struct rt_db_internal *ip, const struct bu_external *ep, const mat_t mat, const struct db_i *dbip )
00370 {
00371 LOCAL struct rt_xxx_internal *xxx_ip;
00372 fastf_t vv[ELEMENTS_PER_VECT*1];
00373
00374 RT_CK_DB_INTERNAL(ip)
00375 BU_CK_EXTERNAL( ep );
00376
00377 BU_ASSERT_LONG( ep->ext_nbytes, ==, SIZEOF_NETWORK_DOUBLE * 3*4 );
00378
00379
00380 ip->idb_major_type = DB5_MAJORTYPE_BRLCAD;
00381 ip->idb_type = ID_XXX;
00382 ip->idb_meth = &rt_functab[ID_XXX];
00383 ip->idb_ptr = bu_malloc( sizeof(struct rt_xxx_internal), "rt_xxx_internal");
00384 xxx_ip = (struct rt_xxx_internal *)ip->idb_ptr;
00385 xxx_ip->magic = RT_XXX_INTERNAL_MAGIC;
00386
00387
00388
00389
00390
00391
00392 ntohd( (unsigned char *)&vv, (char *)ep->ext_buf, ELEMENTS_PER_VECT*1 );
00393
00394
00395 MAT4X3PNT( xxx_ip->v, mat, vv );
00396
00397 return(0);
00398 }
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409 int
00410 rt_xxx_export5( struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip )
00411 {
00412 struct rt_xxx_internal *xxx_ip;
00413 fastf_t vec[ELEMENTS_PER_VECT];
00414
00415 RT_CK_DB_INTERNAL(ip);
00416 if( ip->idb_type != ID_XXX ) return(-1);
00417 xxx_ip = (struct rt_xxx_internal *)ip->idb_ptr;
00418 RT_XXX_CK_MAGIC(xxx_ip);
00419
00420 BU_CK_EXTERNAL(ep);
00421 ep->ext_nbytes = SIZEOF_NETWORK_DOUBLE * ELEMENTS_PER_VECT;
00422 ep->ext_buf = (genptr_t)bu_calloc( 1, ep->ext_nbytes, "xxx external");
00423
00424
00425
00426
00427
00428
00429 VSCALE( vec, xxx_ip->v, local2mm );
00430
00431
00432 htond( ep->ext_buf, (unsigned char *)vec, ELEMENTS_PER_VECT*1 );
00433
00434 return 0;
00435 }
00436
00437
00438
00439
00440
00441
00442
00443
00444 int
00445 rt_xxx_describe( struct bu_vls *str, const struct rt_db_internal *ip, int verbose, double mm2local )
00446 {
00447 register struct rt_xxx_internal *xxx_ip =
00448 (struct rt_xxx_internal *)ip->idb_ptr;
00449 char buf[256];
00450
00451 RT_XXX_CK_MAGIC(xxx_ip);
00452 bu_vls_strcat( str, "truncated general xxx (XXX)\n");
00453
00454 sprintf(buf, "\tV (%g, %g, %g)\n",
00455 INTCLAMP(xxx_ip->v[X] * mm2local),
00456 INTCLAMP(xxx_ip->v[Y] * mm2local),
00457 INTCLAMP(xxx_ip->v[Z] * mm2local) );
00458 bu_vls_strcat( str, buf );
00459
00460 return(0);
00461 }
00462
00463
00464
00465
00466
00467
00468 void
00469 rt_xxx_ifree( struct rt_db_internal *ip )
00470 {
00471 register struct rt_xxx_internal *xxx_ip;
00472
00473 RT_CK_DB_INTERNAL(ip);
00474 xxx_ip = (struct rt_xxx_internal *)ip->idb_ptr;
00475 RT_XXX_CK_MAGIC(xxx_ip);
00476 xxx_ip->magic = 0;
00477
00478 bu_free( (char *)xxx_ip, "xxx ifree" );
00479 ip->idb_ptr = GENPTR_NULL;
00480 }
00481
00482
00483
00484
00485
00486
00487
00488 int
00489 rt_xxx_xform( struct rt_db_internal *op, const mat_t mat, struct rt_db_internal *ip, int free )
00490 {
00491 }
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501