BRL-CAD
Collaboration diagram for Ray Tracing:

Files

file  shoot.c
 
file  bezier.c
 
file  bool.c
 
file  cmd.c
 
file  cut.c
 
file  prep.c
 
file  vshoot.c
 

Macros

#define SGN(_x)   (((_x)<0) ? -1 : 1)
 
#define MAXDEPTH   64
 

Functions

void rt_add_res_stats (struct rt_i *rtip, struct resource *resp)
 
void rt_zero_res_stats (struct resource *resp)
 
void rt_res_pieces_clean (struct resource *resp, struct rt_i *rtip)
 
void rt_res_pieces_init (struct resource *resp, struct rt_i *rtip)
 
void rt_vstub (struct soltab *stp[], struct xray *rp[], struct seg segp[], int n, struct application *ap)
 
HIDDEN int crossing_count (point2d_t *V, int degree, point2d_t ray_start, point2d_t ray_perp)
 
HIDDEN int control_polygon_flat_enough (point2d_t *V, int degree, fastf_t epsilon)
 
void bezier (point2d_t *V, int degree, double t, point2d_t *Left, point2d_t *Right, point2d_t eval_pt, point2d_t normal)
 
HIDDEN int compute_x_intercept (point2d_t *V, int degree, point2d_t ray_start, point2d_t ray_dir, point2d_t intercept, point2d_t normal)
 
int bezier_roots (point2d_t *w, int degree, point2d_t **intercept, point2d_t **normal, point2d_t ray_start, point2d_t ray_dir, point2d_t ray_perp, int depth, fastf_t epsilon)
 
struct bezier_2d_list * bezier_subdivide (struct bezier_2d_list *bezier_in, int degree, fastf_t epsilon, int depth)
 
void rt_ck (struct rt_i *rtip)
 
HIDDEN void rt_solid_bitfinder (register union tree *treep, struct region *regp, struct resource *resp)
 
struct rt_irt_new_rti (struct db_i *dbip)
 
void rt_free_rti (struct rt_i *rtip)
 
void rt_prep_parallel (register struct rt_i *rtip, int ncpu)
 
void rt_prep (register struct rt_i *rtip)
 
void rt_plot_all_bboxes (FILE *fp, struct rt_i *rtip)
 
void rt_plot_all_solids (FILE *fp, struct rt_i *rtip, struct resource *resp)
 
int rt_vlist_solid (struct bu_list *vhead, struct rt_i *rtip, const struct soltab *stp, struct resource *resp)
 
int rt_plot_solid (register FILE *fp, struct rt_i *rtip, const struct soltab *stp, struct resource *resp)
 
void rt_init_resource (struct resource *resp, int cpu_num, struct rt_i *rtip)
 
void rt_clean_resource_basic (struct rt_i *rtip, struct resource *resp)
 
void rt_clean_resource_complete (struct rt_i *rtip, struct resource *resp)
 
void rt_clean_resource (struct rt_i *rtip, struct resource *resp)
 
struct bu_bitvrt_get_solidbitv (size_t nbits, struct resource *resp)
 
void rt_clean (register struct rt_i *rtip)
 
int rt_del_regtree (struct rt_i *rtip, register struct region *delregp, struct resource *resp)
 
void rt_ck (register struct rt_i *rtip)
 
int rt_load_attrs (struct rt_i *rtip, char **attrs)
 
int rt_find_paths (struct db_i *dbip, struct directory *start, struct directory *end, struct bu_ptbl *paths, struct resource *resp)
 
int obj_in_path (const char *path, const char *obj)
 
HIDDEN int unprep_reg_start (struct db_tree_state *tsp, const struct db_full_path *pathp, const struct rt_comb_internal *comb, void *client_data)
 
HIDDEN union treeunprep_reg_end (struct db_tree_state *tsp, const struct db_full_path *pathp, union tree *tree, void *client_data)
 
HIDDEN union treeunprep_leaf (struct db_tree_state *tsp, const struct db_full_path *pathp, struct rt_db_internal *ip, void *client_data)
 
int rt_unprep (struct rt_i *rtip, struct rt_reprep_obj_list *objs, struct resource *resp)
 
int rt_reprep (struct rt_i *rtip, struct rt_reprep_obj_list *objs, struct resource *resp)
 
HIDDEN void vshot_stub (struct soltab **stp, struct xray **rp, struct seg *segp, int n, struct application *ap)
 
int rt_vshootray (struct application *ap)
 

Detailed Description

Macro Definition Documentation

#define SGN (   _x)    (((_x)<0) ? -1 : 1)

Definition at line 46 of file bezier.c.

Referenced by crossing_count().

#define MAXDEPTH   64

Definition at line 47 of file bezier.c.

Referenced by bezier_roots(), and bezier_subdivide().

Function Documentation

void rt_add_res_stats ( struct rt_i rtip,
struct resource resp 
)

To be called only in non-parallel mode, to tally up the statistics from the resource structure(s) into the rt instance structure.

Non-parallel programs should call rt_add_res_stats(rtip, RESOURCE_NULL); to have the default resource results tallied in.

void rt_res_pieces_clean ( struct resource resp,
struct rt_i rtip 
)

Definition at line 72 of file shoot.c.

References bu_bitv_free(), bu_free(), bu_ptbl_free(), BU_PTBL_TEST, rt_piecestate::htab, rt_piecestate::magic, resource::re_pieces, resource::re_pieces_pending, RT_CK_PIECESTATE, RT_CK_RESOURCE, RT_CK_RTI, rt_htbl_free(), rt_i::rti_nsolids_with_pieces, and rt_piecestate::shot.

Referenced by rt_clean_resource_basic(), and rt_unprep().

Here is the call graph for this function:

void rt_res_pieces_init ( struct resource resp,
struct rt_i rtip 
)

Allocate the per-processor state variables needed to support rt_shootray()'s use of 'solid pieces'.

Definition at line 46 of file shoot.c.

References bu_bitv_new(), bu_calloc(), rt_piecestate::cutp, CUTTER_NULL, rt_piecestate::htab, rt_piecestate::magic, resource::re_pieces, RT_CK_RESOURCE, RT_CK_RTI, RT_CK_SOLTAB, rt_htbl_init(), RT_PIECESTATE_MAGIC, RT_VISIT_ALL_SOLTABS_END, RT_VISIT_ALL_SOLTABS_START, rt_i::rti_nsolids_with_pieces, rt_piecestate::shot, soltab::st_npieces, soltab::st_piecestate_num, and rt_piecestate::stp.

Referenced by rt_reprep(), and rt_shootray().

Here is the call graph for this function:

void rt_vstub ( struct soltab stp[],
struct xray rp[],
struct seg  segp[],
int  n,
struct application ap 
)
HIDDEN int crossing_count ( point2d_t *  V,
int  degree,
point2d_t  ray_start,
point2d_t  ray_perp 
)

Definition at line 54 of file bezier.c.

References SGN, and sign().

Referenced by bezier_roots().

Here is the call graph for this function:

HIDDEN int control_polygon_flat_enough ( point2d_t *  V,
int  degree,
fastf_t  epsilon 
)

Definition at line 83 of file bezier.c.

References bu_free(), bu_malloc(), FMAX, FMIN, NEAR_ZERO, X, and Y.

Referenced by bezier_roots(), and bezier_subdivide().

Here is the call graph for this function:

void bezier ( point2d_t *  V,
int  degree,
double  t,
point2d_t *  Left,
point2d_t *  Right,
point2d_t  eval_pt,
point2d_t  normal 
)

Evaluate a Bezier curve at a particular parameter value. Fill in control points for resulting sub-curves if "Left" and "Right" are non-null.

Definition at line 192 of file bezier.c.

References bu_calloc(), bu_free(), X, and Y.

Referenced by bezier_roots(), bezier_subdivide(), bezier_to_carcs(), brep_surface_bezier_info(), brep_trim_bezier_info(), and nurb_crv_is_bezier().

Here is the call graph for this function:

HIDDEN int compute_x_intercept ( point2d_t *  V,
int  degree,
point2d_t  ray_start,
point2d_t  ray_dir,
point2d_t  intercept,
point2d_t  normal 
)

Definition at line 268 of file bezier.c.

References X, Y, and ZERO.

Referenced by bezier_roots().

int bezier_roots ( point2d_t *  w,
int  degree,
point2d_t **  intercept,
point2d_t **  normal,
point2d_t  ray_start,
point2d_t  ray_dir,
point2d_t  ray_perp,
int  depth,
fastf_t  epsilon 
)

Given an equation in Bernstein-Bezier form, find all of the roots in the interval [0, 1]. Return the number of roots found.

Definition at line 308 of file bezier.c.

References bezier(), bezier_roots(), BU_ALLOC, bu_calloc(), bu_free(), compute_x_intercept(), control_polygon_flat_enough(), crossing_count(), and MAXDEPTH.

Referenced by bezier_roots(), and rt_extrude_shot().

Here is the call graph for this function:

struct bezier_2d_list* bezier_subdivide ( struct bezier_2d_list *  bezier_hd,
int  degree,
fastf_t  epsilon,
int  depth 
)

subdivide a 2D bezier curve at t=0.5

Definition at line 405 of file bezier.c.

References bezier(), bezier_subdivide(), BU_ALLOC, bu_calloc(), bu_free(), BU_LIST_APPEND, BU_LIST_APPEND_LIST, BU_LIST_DEQUEUE, BU_LIST_INIT, control_polygon_flat_enough(), and MAXDEPTH.

Referenced by bezier_subdivide(), and seg_to_vlist().

Here is the call graph for this function:

void rt_ck ( struct rt_i rtip)
HIDDEN void rt_solid_bitfinder ( register union tree treep,
struct region regp,
struct resource resp 
)

Used to walk the boolean tree, setting bits for all the solids in the tree to the provided bit vector. Should be called AFTER the region bits have been assigned.

Definition at line 1065 of file prep.c.

References bu_log(), bu_ptbl_ins(), OP_INTERSECT, OP_NOP, OP_SOLID, OP_SUBTRACT, OP_UNION, resource::re_boolslen, resource::re_boolstack, RT_CK_REGION, RT_CK_RESOURCE, RT_CK_SOLTAB, RT_CK_TREE, rt_grow_boolstack(), soltab::st_regions, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tr_a, tree::tr_b, TREE_NULL, and tree::tree_leaf::tu_stp.

Referenced by rt_prep_parallel(), and rt_reprep().

Here is the call graph for this function:

struct rt_i* rt_new_rti ( struct db_i dbip)
void rt_free_rti ( struct rt_i rtip)

Release all the dynamic storage acquired by rt_dirbuild() and any subsequent ray-tracing operations.

Any PARALLEL resource structures are freed by rt_clean(). Note that the rt_g structure needs to be cleaned separately.

Definition at line 156 of file prep.c.

References BU_CK_PTBL, bu_free(), BU_LIST_IS_INITIALIZED, BU_PTBL_FOR, bu_ptbl_free(), db_close_client(), rt_i::delete_regs, RT_CK_DIR, RT_CK_RTI, rt_clean(), rt_i::rti_dbip, and rt_i::rti_resources.

Referenced by _ged_get_obj_bounds2(), ged_get_obj_bounds(), ged_gqa(), ged_voxelize(), rt_bot_smooth(), rt_bound_internal(), rt_submodel_free(), to_deleteProc_rt(), and to_rt_gettrees_application().

Here is the call graph for this function:

void rt_prep_parallel ( register struct rt_i rtip,
int  ncpu 
)

This routine should be called just before the first call to rt_shootray(). It should only be called ONCE per execution, unless rt_clean() is called in between.

Because this can be called from rt_shootray(), it may potentially be called ncpu times, hence the critical section.

Definition at line 201 of file prep.c.

References BU_ASSERT_PTR, BU_BITV_SHIFT, bu_calloc(), bu_free(), BU_LIST_FOR, bu_log(), bu_pr_ptbl(), BU_PTBL_GET, bu_semaphore_acquire(), bu_semaphore_release(), CUT_MAXIMUM, db_ck_tree(), db_i::dbi_filename, db_i::dbi_uses, DEBUG_DB, DEBUG_PL_BOX, DEBUG_PL_SOLIDS, DEBUG_REGIONS, DEBUG_SOLIDS, rt_functab::ft_name, rt_i::HeadRegion, ID_MAX_SOLID, rt_i::mdl_max, rt_i::mdl_min, rt_i::needprep, rt_i::nregions, rt_i::nsolids, OBJ, pl_color(), region::reg_bit, region::reg_treetop, REGION_NULL, rt_i::Regions, RT_CK_RESOURCE, RT_CK_RTI, rt_cut_it(), RT_G_DEBUG, rt_optim_tree(), rt_plot_all_bboxes(), rt_plot_all_solids(), rt_pr_region(), rt_pr_soltab(), rt_regionfix(), RT_SEM_RESULTS, rt_solid_bitfinder(), rt_uniresource, RT_VISIT_ALL_SOLTABS_END, RT_VISIT_ALL_SOLTABS_START, rt_i::rti_air_discards, rt_i::rti_dbip, rt_i::rti_maxsol_by_type, rt_i::rti_ncut_by_type, rt_i::rti_nsol_by_type, rt_i::rti_pmax, rt_i::rti_pmin, rt_i::rti_radius, rt_i::rti_resources, rt_i::rti_sol_by_type, rt_i::rti_Solids, SOLTAB_NULL, soltab::st_bit, soltab::st_id, soltab::st_piece_rpps, soltab::st_regions, soltab::st_rtip, VSETALL, X, Y, and Z.

Referenced by rt_prep().

Here is the call graph for this function:

void rt_prep ( register struct rt_i rtip)

Compatibility stub. Only uses 1 CPU.

Definition at line 440 of file prep.c.

References RT_CK_RTI, and rt_prep_parallel().

Here is the call graph for this function:

void rt_plot_all_bboxes ( FILE *  fp,
struct rt_i rtip 
)

Plot the bounding boxes of all the active solids. Color may be set in advance by the caller.

Definition at line 452 of file prep.c.

References pdv_3box(), pdv_3space(), RT_CK_RTI, RT_VISIT_ALL_SOLTABS_END, RT_VISIT_ALL_SOLTABS_START, rt_i::rti_pmax, rt_i::rti_pmin, soltab::st_aradius, soltab::st_max, and soltab::st_min.

Referenced by rt_prep_parallel().

Here is the call graph for this function:

void rt_plot_all_solids ( FILE *  fp,
struct rt_i rtip,
struct resource resp 
)

Definition at line 470 of file prep.c.

References pdv_3space(), RT_CK_RTI, rt_plot_solid(), RT_VISIT_ALL_SOLTABS_END, RT_VISIT_ALL_SOLTABS_START, rt_i::rti_pmax, rt_i::rti_pmin, and soltab::st_aradius.

Referenced by rt_prep_parallel().

Here is the call graph for this function:

int rt_vlist_solid ( struct bu_list vhead,
struct rt_i rtip,
const struct soltab stp,
struct resource resp 
)

"Draw" a solid with the same kind of wireframes that MGED would display, appending vectors to an already initialized vlist head.

Returns - <0 failure 0 OK

Definition at line 503 of file prep.c.

References bu_log(), rt_functab::ft_plot, OBJ, RT_CK_DB_INTERNAL, rt_db_free_internal(), rt_db_get_internal(), rt_i::rti_dbip, rt_i::rti_tol, rt_i::rti_ttol, soltab::st_dp, and soltab::st_matp.

Referenced by rt_plot_solid().

Here is the call graph for this function:

int rt_plot_solid ( register FILE *  fp,
struct rt_i rtip,
const struct soltab stp,
struct resource resp 
)

Plot a solid with the same kind of wireframes that MGED would display, in UNIX-plot form, on the indicated file descriptor. The caller is responsible for calling pdv_3space().

Returns - <0 failure 0 OK

Definition at line 543 of file prep.c.

References BU_LIST_INIT, BU_LIST_IS_EMPTY, bu_log(), BU_PTBL_GET, mater_info::ma_color, pl_color(), region::reg_mater, REGION_NULL, RT_CK_RTI, RT_CK_SOLTAB, RT_FREE_VLIST, rt_vlist_solid(), rt_vlist_to_uplot(), and soltab::st_regions.

Referenced by rt_plot_all_solids().

Here is the call graph for this function:

void rt_init_resource ( struct resource resp,
int  cpu_num,
struct rt_i rtip 
)

initialize a memory resource structure for use during ray tracing.

a given resource structure is prepared for use and marked as the resource for a given thread of execution (indicated by 'cpu_num'). if an 'rtip' ray tracing instance pointer is provided, the resource structure will be stored within so that it's available to threads of execution during parallel ray tracing.

This routine should initialize all the same resources that rt_clean_resource() releases. It shouldn't (but currently does for ptbl) allocate any dynamic memory, just init pointers & lists.

Definition at line 585 of file prep.c.

References bu_ptbl::blen, bn_rand_init, BU_ASSERT_LONG, BU_LIST_INIT, BU_LIST_IS_INITIALIZED, bu_log(), BU_PTBL_GET, bu_ptbl_init(), BU_PTBL_SET, bu_ptbl::l, MAX_PSW, resource::re_boolslen, resource::re_boolstack, resource::re_cpu, resource::re_directory_blocks, resource::re_magic, resource::re_nmgfree, resource::re_parthead, resource::re_randptr, resource::re_region_ptbl, resource::re_seg, resource::re_seg_blocks, resource::re_solid_bitv, RESOURCE_MAGIC, RT_CK_RTI, rt_uniresource, rt_i::rti_resources, and rt_i::rti_treetop.

Referenced by BuildPhotonMap(), db5_diradd(), db_diradd5(), ged_gqa(), nmg_mc_evaluate(), rt_cell_n_on_ray(), rt_clean_resource(), rt_dirbuild(), Rt_Init(), rt_shootray(), rt_shootray_bundle(), rt_submodel_prep(), rt_submodel_shot(), to_rt_gettrees_application(), wdb_dbopen(), and wdb_fopen_v().

Here is the call graph for this function:

void rt_clean_resource_basic ( struct rt_i rtip,
struct resource resp 
)
void rt_clean_resource_complete ( struct rt_i rtip,
struct resource resp 
)

This method performs the basic resource clean, and also frees all the directory entry blocks. The resource structure is not re-initialized.

DO NOT CALL THIS METHOD IF YOU ARE STILL USING THE RT_I OR DB_I INSTANCES.

Definition at line 769 of file prep.c.

References BU_CK_PTBL, bu_free(), BU_LIST_IS_INITIALIZED, BU_LIST_NULL, BU_PTBL_FOR, bu_ptbl_free(), bu_list::forw, bu_ptbl::l, resource::re_directory_blocks, resource::re_directory_hd, RT_CK_DIR, and rt_clean_resource_basic().

Here is the call graph for this function:

void rt_clean_resource ( struct rt_i rtip,
struct resource resp 
)

Deallocate the per-cpu "private" memory resources:

segment freelist hitmiss freelist for NMG raytracer partition freelist solid_bitv freelist region_ptbl freelist re_boolstack

Some care is required, as rt_uniresource may not be fully initialized before it gets freed.

Note that the resource struct's storage is not freed (it may be static or otherwise allocated by a LIBRT application) but any dynamic memory pointed to by it is freed.

One exception to this is that the re_directory_hd and re_directory_blocks are not touched unless there is no raytrace instance, because the "directory" structures (which are really part of the db_i) continue to be in use.

Definition at line 810 of file prep.c.

References resource::re_cpu, rt_clean_resource_basic(), and rt_init_resource().

Referenced by rt_clean(), and rt_submodel_free().

Here is the call graph for this function:

struct bu_bitv* rt_get_solidbitv ( size_t  nbits,
struct resource resp 
)

returns a bitv zero-initialized with space for least nbits back to the caller. if a resource pointer is provided, a previously allocated bitv may be reused or a new one will be allocated.

Definition at line 828 of file prep.c.

References bu_bitv_clear(), bu_bitv_new(), bu_bomb(), BU_LIST_DEQUEUE, BU_LIST_FOR, BU_LIST_HEAD_MAGIC, BU_LIST_IS_EMPTY, bu_bitv::l, bu_list::magic, bu_bitv::nbits, and resource::re_solid_bitv.

Referenced by rt_find_backing_dist(), rt_shootray(), rt_shootray_bundle(), and rt_vshootray().

Here is the call graph for this function:

void rt_clean ( register struct rt_i rtip)

Release all the dynamic storage associated with a particular rt_i structure, except for the database instance information (dir, etc.) and the rti_resources ptbl.

Note that an animation script can invoke a "clean" operation before anything has been prepped.

Definition at line 868 of file prep.c.

References region::attr_values, cutter::bn, boxnode::bn_max, boxnode::bn_min, boxnode::bn_type, bu_avs_free(), BU_CK_PTBL, bu_free(), bu_hist_free(), BU_LIST_DEQUEUE, BU_LIST_FOR, BU_LIST_MAGIC_EQUAL, BU_LIST_WHILE, BU_PTBL_FOR, BU_PTBL_MAGIC, bu_ptbl_reset(), CUT_BOXNODE, directory::d_forw, directory::d_uses, db_ck_tree(), db_free_anim(), db_free_tree(), db_i::dbi_Head, rt_i::delete_regs, rt_i::HeadRegion, ID_MAX_SOLID, bu_ptbl::l, region::l, mater_info::ma_shader, rt_i::mdl_max, rt_i::mdl_min, memset(), rt_i::needprep, rt_i::nregions, rt_i::nsolids, rt_i::Orca_hash_tbl, resource::re_magic, region::reg_mater, region::reg_name, region::reg_treetop, rt_i::Regions, RT_CHECK_SOLTAB, RT_CK_REGION, RT_CK_RESOURCE, RT_CK_RTI, rt_clean_resource(), rt_cut_clean(), RT_DBNHASH, RT_DIR_NULL, rt_fr_cut(), rt_free_soltab(), rt_uniresource, rt_i::rti_CutHead, rt_i::rti_dbip, rt_i::rti_hist_cell_pieces, rt_i::rti_hist_cellsize, rt_i::rti_hist_cutdepth, rt_i::rti_inf_box, RTI_MAGIC, rt_i::rti_magic, rt_i::rti_nsol_by_type, rt_i::rti_resources, rt_i::rti_sol_by_type, rt_i::rti_solidheads, rt_i::rti_Solids, and VSETALL.

Referenced by rt_free_rti().

Here is the call graph for this function:

int rt_del_regtree ( struct rt_i rtip,
register struct region delregp,
struct resource resp 
)

Remove a region from the linked list. Used to remove a particular region from the active database, presumably after some useful information has been extracted (e.g., a light being converted to implicit type), or for special effects.

Returns - 0 success

Definition at line 1038 of file prep.c.

References region::attr_values, bu_avs_free(), bu_free(), BU_LIST_DEQUEUE, bu_log(), db_free_tree(), DEBUG_REGIONS, region::l, region::reg_name, region::reg_treetop, RT_CK_REGION, RT_CK_RESOURCE, RT_CK_RTI, RT_G_DEBUG, and TREE_NULL.

Here is the call graph for this function:

void rt_ck ( register struct rt_i rtip)

Check as many of the in-memory data structures as is practical. Useful for detecting memory corruption, and inappropriate sharing between different LIBRT instances.

Definition at line 1118 of file prep.c.

References BU_LIST_FOR, db_ck_directory(), db_ck_tree(), rt_i::HeadRegion, region::reg_treetop, RT_CK_DBI, RT_CK_REGION, RT_CK_RTI, RT_CK_SOLTAB, RT_VISIT_ALL_SOLTABS_END, RT_VISIT_ALL_SOLTABS_START, and rt_i::rti_dbip.

Here is the call graph for this function:

int rt_load_attrs ( struct rt_i rtip,
char **  attrs 
)

Loads a new set of attribute values (corresponding to the provided list of attribute names) for each region structure in the provided rtip.

Returns - The number of region structures affected

Definition at line 1149 of file prep.c.

References region::attr_values, bu_avs_add(), bu_avs_free(), bu_avs_get(), bu_avs_init_empty(), BU_LIST_FOR, bu_log(), db5_get_attributes(), db_lookup(), db_version(), rt_i::HeadRegion, LOOKUP_NOISY, region::reg_name, RT_CHECK_RTI, RT_CK_DBI, RT_CK_REGION, RT_DIR_NULL, and rt_i::rti_dbip.

Here is the call graph for this function:

int rt_find_paths ( struct db_i dbip,
struct directory start,
struct directory end,
struct bu_ptbl paths,
struct resource resp 
)

Routine to find all the paths from the "start" to the "end". The resulting paths are returned in "paths"

Definition at line 1275 of file prep.c.

References BU_ALLOC, bu_free(), bu_log(), bu_ptbl_ins(), directory::d_flags, directory::d_namep, db_add_node_to_full_path(), db_free_full_path(), db_full_path_init(), rt_db_internal::idb_ptr, rt_db_free_internal(), rt_db_get_internal(), RT_DIR_COMB, RT_DIR_REGION, and rt_comb_internal::tree.

Referenced by rt_unprep().

Here is the call graph for this function:

int obj_in_path ( const char *  path,
const char *  obj 
)

This routine searches the provided path (in the form of a string) for the specified object name.

Returns: 1 - the specified object name is somewhere along the path 0 - the specified object name does not appear in this path

Definition at line 1325 of file prep.c.

Referenced by unprep_leaf().

HIDDEN int unprep_reg_start ( struct db_tree_state tsp,
const struct db_full_path pathp,
const struct rt_comb_internal comb,
void *  client_data 
)
HIDDEN union tree* unprep_reg_end ( struct db_tree_state tsp,
const struct db_full_path pathp,
union tree tree,
void *  client_data 
)
HIDDEN void vshot_stub ( struct soltab **  stp,
struct xray **  rp,
struct seg segp,
int  n,
struct application ap 
)

Stub function which will "simulate" a call to a vector shot routine

Definition at line 41 of file vshoot.c.

References application::a_resource, BU_LIST_DEQUEUE, BU_LIST_FIRST, BU_LIST_INIT, rt_functab::ft_shot, seg::l, OBJ, RT_FREE_SEG, seg::seg_stp, and soltab::st_id.

Referenced by rt_vshootray().

int rt_vshootray ( struct application ap)

Given a ray, shoot it at all the relevant parts of the model, (building the HeadSeg chain), and then call rt_boolregions() to build and evaluate the partition chain. If the ray actually hit anything, call the application's a_hit() routine with a pointer to the partition chain, otherwise, call the application's a_miss() routine.

It is important to note that rays extend infinitely only in the positive direction. The ray is composed of all points P, where

P = r_pt + K * r_dir

for K ranging from 0 to +infinity. There is no looking backwards.

It is also important to note that the direction vector r_dir must have unit length; this is mandatory, and is not ordinarily checked, in the name of efficiency.

Input: Pointer to an application structure, with these mandatory fields: a_ray.r_pt Starting point of ray to be fired a_ray.r_dir UNIT VECTOR with direction to fire in (dir cosines) a_hit Routine to call when something is hit a_miss Routine to call when ray misses everything

Calls user's a_miss() or a_hit() routine as appropriate. Passes a_hit() routine list of partitions, with only hit_dist fields valid. Normal computation deferred to user code, to avoid needless computation here.

Returns: whatever the application function returns (an int).

NOTE: The application functions may call rt_shootray() recursively. Thus, none of the local variables may be static.

An open issue for execution in a PARALLEL environment is locking of the statistics variables.

Definition at line 116 of file vshoot.c.

References application::a_hit, application::a_level, application::a_miss, application::a_purpose, application::a_ray, application::a_resource, application::a_rt_i, application::a_x, application::a_y, BACKING_DIST, BU_ALLOC, bu_bitv_free(), bu_bomb(), bu_calloc(), BU_CK_PTBL, bu_free(), BU_LIST_DEQUEUE, BU_LIST_FIRST, BU_LIST_INIT, BU_LIST_IS_EMPTY, bu_log(), bu_ptbl_init(), DEBUG_ALLRAYS, DEBUG_PARTITION, DEBUG_SHOOT, FREE_PT, rt_functab::ft_vshot, ID_MAX_SOLID, bu_ptbl::l, seg::l, rt_i::mdl_max, rt_i::mdl_min, rt_i::needprep, rt_i::nhits, rt_i::nmiss, rt_i::nmiss_model, rt_i::nshots, rt_i::nsolids, OBJ, out, partition::pt_back, partition::pt_forw, xray::r_dir, xray::r_max, xray::r_pt, resource::re_cpu, resource::re_region_ptbl, RT_AP_CHECK, rt_boolfinal(), RT_CK_RESOURCE, RT_G_DEBUG, RT_GET_SEG, rt_get_solidbitv(), rt_in_rpp(), rt_pr_partitions(), rt_prep(), RT_SEG_NULL, rt_uniresource, rt_i::rti_maxsol_by_type, rt_i::rti_nrays, rt_i::rti_nsol_by_type, rt_i::rti_sol_by_type, seg::seg_stp, SOLTAB_NULL, VPRINT, vshot_stub(), X, Y, Z, and ZERO.

Here is the call graph for this function: