BRL-CAD
#include "common.h"
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <math.h>
#include "bio.h"
#include "bu/parallel.h"
#include "vmath.h"
#include "nmg.h"
#include "raytrace.h"
#include "plot3.h"
Include dependency graph for nmg_rt_segs.c:

Go to the source code of this file.

Data Structures

struct  ef_data
 

Macros

#define CK_SEGP(_p)
 
#define DO_LONGJMP
 
#define nmg_rt_segs_exit(_s)   {bu_log("%s\n", _s);longjmp(nmg_longjump_env, -1);}
 

Functions

HIDDEN void print_seg_list (struct seg *seghead, int seg_count, char *s)
 
HIDDEN void pl_ray (struct ray_data *rd)
 
HIDDEN void set_inpoint (struct seg **seg_p, struct hitmiss *a_hit, struct soltab *stp, struct application *ap)
 
HIDDEN void set_outpoint (struct seg **seg_p, struct hitmiss *a_hit)
 
HIDDEN int state0 (struct seg *seghead, struct seg **seg_p, int *seg_count, struct hitmiss *a_hit, struct soltab *stp, struct application *ap, struct bn_tol *tol)
 
HIDDEN int state1 (struct seg *seghead, struct seg **seg_p, int *seg_count, struct hitmiss *a_hit, struct soltab *stp, struct application *ap, struct bn_tol *tol)
 
HIDDEN int state2 (struct seg *seghead, struct seg **seg_p, int *seg_count, struct hitmiss *a_hit, struct soltab *stp, struct application *ap, struct bn_tol *tol)
 
HIDDEN int state3 (struct seg *seghead, struct seg **seg_p, int *seg_count, struct hitmiss *a_hit, struct soltab *stp, struct application *ap, struct bn_tol *tol)
 
HIDDEN int state4 (struct seg *seghead, struct seg **seg_p, int *seg_count, struct hitmiss *a_hit, struct soltab *stp, struct application *ap, struct bn_tol *tol)
 
HIDDEN int state5and6 (struct seg *seghead, struct seg **seg_p, int *seg_count, struct hitmiss *a_hit, struct soltab *stp, struct application *ap, struct bn_tol *tol, int ret_val_7)
 
HIDDEN int state5 (struct seg *seghead, struct seg **seg_p, int *seg_count, struct hitmiss *a_hit, struct soltab *stp, struct application *ap, struct bn_tol *tol)
 
HIDDEN int state6 (struct seg *seghead, struct seg **seg_p, int *seg_count, struct hitmiss *a_hit, struct soltab *stp, struct application *ap, struct bn_tol *tol)
 
HIDDEN int nmg_bsegs (struct ray_data *rd, struct application *ap, struct seg *seghead, struct soltab *stp)
 
HIDDEN long * common_topo (struct bu_ptbl *a_tbl, struct bu_ptbl *next_tbl)
 
HIDDEN void visitor (uint32_t *l_p, void *tbl, int unused)
 
HIDDEN void build_topo_list (uint32_t *l_p, struct bu_ptbl *tbl)
 
HIDDEN void unresolved (struct hitmiss *next_hit, struct bu_ptbl *a_tbl, struct bu_ptbl *next_tbl, struct bu_list *hd, struct ray_data *rd)
 
HIDDEN int check_hitstate (struct bu_list *hd, struct ray_data *rd)
 
int nmg_ray_segs (struct ray_data *rd)
 

Detailed Description

Support routines for raytracing an NMG.

Definition in file nmg_rt_segs.c.

Macro Definition Documentation

#define CK_SEGP (   _p)
Value:
if (!(_p) || !(*(_p))) {\
bu_log("%s[line:%d]: Bad seg_p pointer\n", __FILE__, __LINE__); \
nmg_rt_segs_exit("Goodbye"); }
void bu_log(const char *,...) _BU_ATTR_PRINTF12
Definition: log.c:176
#define nmg_rt_segs_exit(_s)
Definition: nmg_rt_segs.c:61

Definition at line 55 of file nmg_rt_segs.c.

Referenced by state2(), state3(), state4(), and state5and6().

#define DO_LONGJMP

Definition at line 58 of file nmg_rt_segs.c.

#define nmg_rt_segs_exit (   _s)    {bu_log("%s\n", _s);longjmp(nmg_longjump_env, -1);}

Function Documentation

HIDDEN void print_seg_list ( struct seg seghead,
int  seg_count,
char *  s 
)

Definition at line 68 of file nmg_rt_segs.c.

References bu_list::back, BU_LIST_FOR, bu_log(), bu_list::forw, hit::hit_dist, hit::hit_normal, hit::hit_point, seg::l, bu_list::magic, seg::seg_in, and seg::seg_out.

Referenced by nmg_ray_segs().

Here is the call graph for this function:

HIDDEN void pl_ray ( struct ray_data rd)

Definition at line 107 of file nmg_rt_segs.c.

References bu_bomb(), BU_LIST_FOR, bu_log(), hitmiss::hit, hit::hit_point, HMG_INBOUND_STATE, HMG_OUTBOUND_STATE, NMG_CK_HITMISS, NMG_RAY_STATE_INSIDE, NMG_RAY_STATE_ON, NMG_RAY_STATE_OUTSIDE, pdv_3line(), pl_color(), xray::r_dir, xray::r_pt, ray_data::rd_hit, and ray_data::rp.

Referenced by nmg_ray_segs(), and unresolved().

Here is the call graph for this function:

HIDDEN void set_inpoint ( struct seg **  seg_p,
struct hitmiss a_hit,
struct soltab stp,
struct application ap 
)

Definition at line 216 of file nmg_rt_segs.c.

References application::a_resource, bu_log(), hitmiss::hit, hitmiss::inbound_norm, rt_g::NMG_debug, nmg_rt_segs_exit, RT_GET_SEG, and RTG.

Referenced by state0(), state2(), state3(), state4(), and state5and6().

Here is the call graph for this function:

HIDDEN void set_outpoint ( struct seg **  seg_p,
struct hitmiss a_hit 
)

Definition at line 254 of file nmg_rt_segs.c.

References bu_log(), hitmiss::hit, rt_g::NMG_debug, nmg_rt_segs_exit, hitmiss::outbound_norm, and RTG.

Referenced by state0(), state1(), state2(), state3(), state4(), and state5and6().

Here is the call graph for this function:

HIDDEN int state0 ( struct seg seghead,
struct seg **  seg_p,
int *  seg_count,
struct hitmiss a_hit,
struct soltab stp,
struct application ap,
struct bn_tol tol 
)

Definition at line 296 of file nmg_rt_segs.c.

References bu_log(), HMG_HIT_ANY_ANY, HMG_HIT_IN_IN, HMG_HIT_IN_ON, HMG_HIT_IN_OUT, HMG_HIT_ON_IN, HMG_HIT_ON_ON, HMG_HIT_ON_OUT, HMG_HIT_OUT_IN, HMG_HIT_OUT_ON, HMG_HIT_OUT_OUT, hitmiss::in_out, NMG_CK_HITMISS, nmg_rt_segs_exit, set_inpoint(), and set_outpoint().

Here is the call graph for this function:

HIDDEN int state1 ( struct seg seghead,
struct seg **  seg_p,
int *  seg_count,
struct hitmiss a_hit,
struct soltab stp,
struct application ap,
struct bn_tol tol 
)

Definition at line 350 of file nmg_rt_segs.c.

References bu_log(), HMG_HIT_ANY_ANY, HMG_HIT_IN_IN, HMG_HIT_IN_ON, HMG_HIT_IN_OUT, HMG_HIT_ON_IN, HMG_HIT_ON_ON, HMG_HIT_ON_OUT, HMG_HIT_OUT_IN, HMG_HIT_OUT_ON, HMG_HIT_OUT_OUT, hitmiss::in_out, NMG_CK_HITMISS, nmg_rt_segs_exit, RT_CK_APPLICATION, RT_CK_SOLTAB, and set_outpoint().

Here is the call graph for this function:

HIDDEN int state2 ( struct seg seghead,
struct seg **  seg_p,
int *  seg_count,
struct hitmiss a_hit,
struct soltab stp,
struct application ap,
struct bn_tol tol 
)

Definition at line 398 of file nmg_rt_segs.c.

References BN_CK_TOL, BU_LIST_INSERT, BU_LIST_MAGIC_SET, bu_log(), CK_SEGP, delta, hitmiss::hit, hit::hit_dist, HMG_HIT_ANY_ANY, HMG_HIT_IN_IN, HMG_HIT_IN_ON, HMG_HIT_IN_OUT, HMG_HIT_ON_IN, HMG_HIT_ON_ON, HMG_HIT_ON_OUT, HMG_HIT_OUT_IN, HMG_HIT_OUT_ON, HMG_HIT_OUT_OUT, hitmiss::in_out, seg::l, NMG_CK_HITMISS, nmg_rt_segs_exit, RT_SEG_MAGIC, set_inpoint(), and set_outpoint().

Here is the call graph for this function:

HIDDEN int state3 ( struct seg seghead,
struct seg **  seg_p,
int *  seg_count,
struct hitmiss a_hit,
struct soltab stp,
struct application ap,
struct bn_tol tol 
)

Definition at line 494 of file nmg_rt_segs.c.

References BN_CK_TOL, BU_LIST_INSERT, BU_LIST_MAGIC_SET, bu_log(), CK_SEGP, delta, bn_tol::dist, hitmiss::hit, hit::hit_dist, HMG_HIT_ANY_ANY, HMG_HIT_IN_IN, HMG_HIT_IN_ON, HMG_HIT_IN_OUT, HMG_HIT_ON_IN, HMG_HIT_ON_ON, HMG_HIT_ON_OUT, HMG_HIT_OUT_IN, HMG_HIT_OUT_ON, HMG_HIT_OUT_OUT, hitmiss::in_out, seg::l, NMG_CK_HITMISS, nmg_rt_segs_exit, RT_SEG_MAGIC, set_inpoint(), and set_outpoint().

Here is the call graph for this function:

HIDDEN int state4 ( struct seg seghead,
struct seg **  seg_p,
int *  seg_count,
struct hitmiss a_hit,
struct soltab stp,
struct application ap,
struct bn_tol tol 
)

Definition at line 597 of file nmg_rt_segs.c.

References BN_CK_TOL, BU_LIST_INSERT, BU_LIST_MAGIC_SET, bu_log(), CK_SEGP, delta, bn_tol::dist, hitmiss::hit, hit::hit_dist, HMG_HIT_ANY_ANY, HMG_HIT_IN_IN, HMG_HIT_IN_ON, HMG_HIT_IN_OUT, HMG_HIT_ON_IN, HMG_HIT_ON_ON, HMG_HIT_ON_OUT, HMG_HIT_OUT_IN, HMG_HIT_OUT_ON, HMG_HIT_OUT_OUT, hitmiss::in_out, seg::l, NMG_CK_HITMISS, nmg_rt_segs_exit, RT_SEG_MAGIC, set_inpoint(), and set_outpoint().

Here is the call graph for this function:

HIDDEN int state5and6 ( struct seg seghead,
struct seg **  seg_p,
int *  seg_count,
struct hitmiss a_hit,
struct soltab stp,
struct application ap,
struct bn_tol tol,
int  ret_val_7 
)

Definition at line 684 of file nmg_rt_segs.c.

References BN_CK_TOL, BU_LIST_INSERT, BU_LIST_MAGIC_SET, bu_log(), CK_SEGP, delta, hitmiss::hit, hit::hit_dist, HMG_HIT_ANY_ANY, HMG_HIT_IN_IN, HMG_HIT_IN_ON, HMG_HIT_IN_OUT, HMG_HIT_ON_IN, HMG_HIT_ON_ON, HMG_HIT_ON_OUT, HMG_HIT_OUT_IN, HMG_HIT_OUT_ON, HMG_HIT_OUT_OUT, hitmiss::in_out, seg::l, NMG_CK_HITMISS, nmg_rt_segs_exit, RT_SEG_MAGIC, set_inpoint(), and set_outpoint().

Referenced by state5(), and state6().

Here is the call graph for this function:

HIDDEN int state5 ( struct seg seghead,
struct seg **  seg_p,
int *  seg_count,
struct hitmiss a_hit,
struct soltab stp,
struct application ap,
struct bn_tol tol 
)

Definition at line 771 of file nmg_rt_segs.c.

References state5and6().

Here is the call graph for this function:

HIDDEN int state6 ( struct seg seghead,
struct seg **  seg_p,
int *  seg_count,
struct hitmiss a_hit,
struct soltab stp,
struct application ap,
struct bn_tol tol 
)

Definition at line 783 of file nmg_rt_segs.c.

References state5and6().

Here is the call graph for this function:

HIDDEN int nmg_bsegs ( struct ray_data rd,
struct application ap,
struct seg seghead,
struct soltab stp 
)

Definition at line 806 of file nmg_rt_segs.c.

References BU_LIST_FOR, BU_LIST_INSERT, BU_LIST_MAGIC_SET, bu_log(), seg::l, NMG_CK_HITMISS, nmg_rt_print_hitmiss(), nmg_rt_segs_exit, RT_SEG_MAGIC, and V3ARGS.

Referenced by nmg_ray_segs().

Here is the call graph for this function:

HIDDEN long* common_topo ( struct bu_ptbl a_tbl,
struct bu_ptbl next_tbl 
)

If a_tbl and next_tbl have an element in common, return it. Otherwise return a NULL pointer.

Definition at line 888 of file nmg_rt_segs.c.

References bu_ptbl_locate(), bu_ptbl::buffer, and bu_ptbl::end.

Referenced by check_hitstate().

Here is the call graph for this function:

HIDDEN void visitor ( uint32_t *  l_p,
void *  tbl,
int  unused 
)

Definition at line 902 of file nmg_rt_segs.c.

References bu_ptbl_ins_unique().

Referenced by build_topo_list().

Here is the call graph for this function:

HIDDEN void build_topo_list ( uint32_t *  l_p,
struct bu_ptbl tbl 
)

Add an element provided by nmg_visit to a bu_ptbl struct.

Definition at line 912 of file nmg_rt_segs.c.

References bu_identify_magic(), BU_LIST_FOR, bu_log(), bu_ptbl_ins_unique(), eu_p, lu, NMG_EDGEUSE_MAGIC, NMG_FACEUSE_MAGIC, NMG_LOOPUSE_MAGIC, nmg_rt_segs_exit, NMG_SHELL_MAGIC, NMG_VERTEXUSE_MAGIC, nmg_visit(), and visitor().

Referenced by check_hitstate().

Here is the call graph for this function:

HIDDEN void unresolved ( struct hitmiss next_hit,
struct bu_ptbl a_tbl,
struct bu_ptbl next_tbl,
struct bu_list hd,
struct ray_data rd 
)

Definition at line 997 of file nmg_rt_segs.c.

References application::a_level, application::a_purpose, application::a_x, application::a_y, ray_data::ap, bu_identify_magic(), BU_LIST_FOR, bu_log(), bu_ptbl::buffer, directory::d_namep, bu_ptbl::end, nmg_rt_print_hitmiss(), pl_ray(), xray::r_dir, xray::r_pt, ray_data::rp, soltab::st_dp, ray_data::stp, and V3ARGS.

Referenced by check_hitstate().

Here is the call graph for this function:

int nmg_ray_segs ( struct ray_data rd)

Obtain the list of ray segments which intersect with the nmg. This routine does all of the "work" for rt_nmg_shot()

Return:

of segments added to list.

Definition at line 1156 of file nmg_rt_segs.c.

References ray_data::ap, BU_LIST_FOR, BU_LIST_IS_EMPTY, bu_log(), check_hitstate(), nmg_bsegs(), NMG_CK_HITMISS_LISTS, rt_g::NMG_debug, NMG_FREE_HITLIST, nmg_rt_print_hitmiss(), pl_ray(), print_seg_list(), ray_data::rd_hit, ray_data::rd_miss, RTG, ray_data::seghead, and ray_data::stp.

Referenced by rt_nmg_shot().

Here is the call graph for this function: