g_xxx.c File Reference

#include "common.h"
#include <stdio.h>
#include <math.h>
#include "machine.h"
#include "vmath.h"
#include "db.h"
#include "nmg.h"
#include "raytrace.h"
#include "rtgeom.h"
#include "./debug.h"

Include dependency graph for g_xxx.c:

Go to the source code of this file.

Data Structures

struct  xxx_specific

Defines

#define RT_XXX_SEG_MISS(SEG)   (SEG).seg_stp=RT_SOLTAB_NULL

Functions

int rt_xxx_prep (struct soltab *stp, struct rt_db_internal *ip, struct rt_i *rtip)
void rt_xxx_print (const struct soltab *stp)
int rt_xxx_shot (struct soltab *stp, struct xray *rp, struct application *ap, struct seg *seghead)
void rt_xxx_vshot (struct soltab *stp[], struct xray *rp[], struct seg segp[], int n, struct application *ap)
void rt_xxx_norm (struct hit *hitp, struct soltab *stp, struct xray *rp)
void rt_xxx_curve (struct curvature *cvp, struct hit *hitp, struct soltab *stp)
void rt_xxx_uv (struct application *ap, struct soltab *stp, struct hit *hitp, struct uvcoord *uvp)
void rt_xxx_free (struct soltab *stp)
int rt_xxx_class (const struct soltab *stp, const vect_t min, const vect_t max, const struct bn_tol *tol)
int rt_xxx_plot (struct bu_list *vhead, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol)
int 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)
int rt_xxx_import (struct rt_db_internal *ip, const struct bu_external *ep, const mat_t mat, const struct db_i *dbip)
int rt_xxx_export (struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip)
int rt_xxx_import5 (struct rt_db_internal *ip, const struct bu_external *ep, const mat_t mat, const struct db_i *dbip)
int rt_xxx_export5 (struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip)
int rt_xxx_describe (struct bu_vls *str, const struct rt_db_internal *ip, int verbose, double mm2local)
void rt_xxx_ifree (struct rt_db_internal *ip)
int rt_xxx_xform (struct rt_db_internal *op, const mat_t mat, struct rt_db_internal *ip, int free)


Detailed Description

Intersect a ray with a.

Adding a new solid type: Design disk record

define rt_xxx_internal --- parameters for solid define xxx_specific --- raytracing form, possibly w/precomuted terms define rt_xxx_parse --- struct bu_structparse for "db get", "db adjust", ...

code import/export/describe/print/ifree/plot/prep/shot/curve/uv/tess

edit db.h add solidrec s_type define edit rtgeom.h to add rt_xxx_internal edit table.c: RT_DECLARE_INTERFACE() struct rt_functab entry rt_id_solid() edit raytrace.h to make ID_XXX, increment ID_MAXIMUM edit db_scan.c to add the new solid to db_scan() edit Makefile.am to add g_xxx.c to compile

Then: go to src/libwdb and create mk_xxx() routine go to src/conv and edit g2asc.c and asc2g.c to support the new solid go to src/librt and edit tcl.c to add the new solid to rt_solid_type_lookup[] also add the interface table and to rt_id_solid() in table.c go to src/mged and create the edit support

Authors -

Source - SECAD/VLD Computing Consortium, Bldg 394 The U. S. Army Ballistic Research Laboratory Aberdeen Proving Ground, Maryland 21005-5066

Definition in file g_xxx.c.


Define Documentation

#define RT_XXX_SEG_MISS SEG   )     (SEG).seg_stp=RT_SOLTAB_NULL
 

Definition at line 164 of file g_xxx.c.


Function Documentation

int rt_xxx_prep struct soltab stp,
struct rt_db_internal ip,
struct rt_i rtip
 

R T _ X X X _ P R E P

Given a pointer to a GED database record, and a transformation matrix, determine if this is a valid XXX, and if so, precompute various terms of the formula.

Returns - 0 XXX is OK !0 Error in description

Implicit return - A struct xxx_specific is created, and it's address is stored in stp->st_specific for use by xxx_shot().

Definition at line 121 of file g_xxx.c.

References rt_db_internal::idb_ptr, RT_CK_DB_INTERNAL, and rt_i::rti_tol.

void rt_xxx_print const struct soltab stp  ) 
 

R T _ X X X _ P R I N T

Definition at line 136 of file g_xxx.c.

References soltab::st_specific.

int rt_xxx_shot struct soltab stp,
struct xray rp,
struct application ap,
struct seg seghead
 

R T _ X X X _ S H O T

Intersect a ray with a xxx. If an intersection occurs, a struct seg will be acquired and filled in.

Returns - 0 MISS >0 HIT

Definition at line 154 of file g_xxx.c.

References application::a_rt_i, rt_i::rti_tol, and soltab::st_specific.

void rt_xxx_vshot struct soltab stp[],
struct xray rp[],
struct seg  segp[],
int  n,
struct application ap
 

R T _ X X X _ V S H O T

Vectorized version.

Definition at line 172 of file g_xxx.c.

References rt_vstub().

Here is the call graph for this function:

void rt_xxx_norm struct hit hitp,
struct soltab stp,
struct xray rp
 

R T _ X X X _ N O R M

Given ONE ray distance, return the normal and entry/exit point.

Definition at line 187 of file g_xxx.c.

References hit::hit_dist, hit::hit_point, xray::r_dir, xray::r_pt, soltab::st_specific, and VJOIN1.

void rt_xxx_curve struct curvature cvp,
struct hit hitp,
struct soltab stp
 

R T _ X X X _ C U R V E

Return the curvature of the xxx.

Definition at line 201 of file g_xxx.c.

References bn_vec_ortho(), curvature::crv_c1, curvature::crv_c2, curvature::crv_pdir, hit::hit_normal, and soltab::st_specific.

Here is the call graph for this function:

void rt_xxx_uv struct application ap,
struct soltab stp,
struct hit hitp,
struct uvcoord uvp
 

R T _ X X X _ U V

For a hit on the surface of an xxx, return the (u,v) coordinates of the hit point, 0 <= u,v <= 1. u = azimuth v = elevation

Definition at line 221 of file g_xxx.c.

References soltab::st_specific.

void rt_xxx_free struct soltab stp  ) 
 

R T _ X X X _ F R E E

Definition at line 231 of file g_xxx.c.

References bu_free(), and soltab::st_specific.

Here is the call graph for this function:

int rt_xxx_class const struct soltab stp,
const vect_t  min,
const vect_t  max,
const struct bn_tol tol
 

R T _ X X X _ C L A S S

Definition at line 243 of file g_xxx.c.

References RT_CLASSIFY_UNIMPLEMENTED.

int rt_xxx_plot struct bu_list vhead,
struct rt_db_internal ip,
const struct rt_tess_tol ttol,
const struct bn_tol tol
 

R T _ X X X _ P L O T

Definition at line 252 of file g_xxx.c.

References rt_db_internal::idb_ptr, LOCAL, and RT_CK_DB_INTERNAL.

int 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
 

R T _ X X X _ T E S S

Returns - -1 failure 0 OK. *r points to nmgregion that holds this tessellation.

Definition at line 271 of file g_xxx.c.

References rt_db_internal::idb_ptr, LOCAL, and RT_CK_DB_INTERNAL.

int rt_xxx_import struct rt_db_internal ip,
const struct bu_external ep,
const mat_t  mat,
const struct db_i dbip
 

R T _ X X X _ I M P O R T

Import an XXX from the database format to the internal format. Apply modeling transformations as well.

Definition at line 289 of file g_xxx.c.

References BU_CK_EXTERNAL, bu_log(), bu_malloc(), DB5_MAJORTYPE_BRLCAD, bu_external::ext_buf, ID_SOLID, rt_db_internal::idb_major_type, rt_db_internal::idb_meth, rt_db_internal::idb_ptr, LOCAL, MAT4X3PNT, RT_CK_DB_INTERNAL, record::s, record::solidrec::s_values, and record::u_id.

Here is the call graph for this function:

int rt_xxx_export struct bu_external ep,
const struct rt_db_internal ip,
double  local2mm,
const struct db_i dbip
 

R T _ X X X _ E X P O R T

The name is added by the caller, in the usual place.

Definition at line 321 of file g_xxx.c.

References bu_calloc(), BU_CK_EXTERNAL, bu_external::ext_buf, bu_external::ext_nbytes, ID_SOLID, rt_db_internal::idb_ptr, RT_CK_DB_INTERNAL, record::s, record::solidrec::s_id, record::solidrec::s_type, record::solidrec::s_values, and VSCALE.

Here is the call graph for this function:

int rt_xxx_import5 struct rt_db_internal ip,
const struct bu_external ep,
const mat_t  mat,
const struct db_i dbip
 

R T _ X X X _ I M P O R T 5

Import an XXX from the database format to the internal format. Note that the data read will be in network order. This means Big-Endian integers and IEEE doubles for floating point.

Apply modeling transformations as well.

Definition at line 369 of file g_xxx.c.

References BU_ASSERT_LONG, BU_CK_EXTERNAL, bu_malloc(), DB5_MAJORTYPE_BRLCAD, ELEMENTS_PER_VECT, bu_external::ext_buf, bu_external::ext_nbytes, rt_db_internal::idb_major_type, rt_db_internal::idb_meth, rt_db_internal::idb_ptr, LOCAL, MAT4X3PNT, ntohd(), RT_CK_DB_INTERNAL, and SIZEOF_NETWORK_DOUBLE.

Here is the call graph for this function:

int rt_xxx_export5 struct bu_external ep,
const struct rt_db_internal ip,
double  local2mm,
const struct db_i dbip
 

R T _ X X X _ E X P O R T 5

Export an XXX from internal form to external format. Note that this means converting all integers to Big-Endian format and floating point data to IEEE double.

Apply the transformation to mm units as well.

Definition at line 410 of file g_xxx.c.

References bu_calloc(), BU_CK_EXTERNAL, ELEMENTS_PER_VECT, bu_external::ext_buf, bu_external::ext_nbytes, htond(), rt_db_internal::idb_ptr, RT_CK_DB_INTERNAL, SIZEOF_NETWORK_DOUBLE, and VSCALE.

Here is the call graph for this function:

int rt_xxx_describe struct bu_vls str,
const struct rt_db_internal ip,
int  verbose,
double  mm2local
 

R T _ X X X _ D E S C R I B E

Make human-readable formatted presentation of this solid. First line describes type of solid. Additional lines are indented one tab, and give parameter values.

Definition at line 445 of file g_xxx.c.

References bu_vls_strcat(), rt_db_internal::idb_ptr, INTCLAMP, X, Y, and Z.

Here is the call graph for this function:

void rt_xxx_ifree struct rt_db_internal ip  ) 
 

R T _ X X X _ I F R E E

Free the storage associated with the rt_db_internal version of this solid.

Definition at line 469 of file g_xxx.c.

References bu_free(), GENPTR_NULL, rt_db_internal::idb_ptr, and RT_CK_DB_INTERNAL.

Here is the call graph for this function:

int rt_xxx_xform struct rt_db_internal op,
const mat_t  mat,
struct rt_db_internal ip,
int  free
 

R T _ X X X _ X F O R M

Create transformed version of internal form. Free *ip if requested. Implement this if it's faster than doing an export/import cycle.

Definition at line 489 of file g_xxx.c.


Generated on Mon Sep 18 01:25:07 2006 for BRL-CAD by  doxygen 1.4.6