nmg_rt_isect.c File Reference

#include "common.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "machine.h"
#include "vmath.h"
#include "nmg.h"
#include "raytrace.h"
#include "nurb.h"
#include "plot3.h"

Include dependency graph for nmg_rt_isect.c:

Go to the source code of this file.

Defines

#define HIT_EDGE_VERTEX(rd, eu_p, vu_p)
#define FACE_MISS(rd, f_p)
#define UV_TOL   1.0e-6

Functions

const char * nmg_rt_inout_str (int code)
const char * nmg_rt_state_str (int code)
void nmg_ck_hitmiss_list (const struct bu_list *hd)
void nmg_rt_print_hitmiss (struct hitmiss *a_hit)
void nmg_rt_print_hitlist (struct hitmiss *hl)
void isect_ray_cnurb (struct ray_data *rd, struct edgeuse *eu_p)
void isect_ray_lseg (struct ray_data *rd, struct edgeuse *eu_p)
void isect_ray_snurb_face (struct ray_data *rd, struct faceuse *fu, struct face_g_snurb *fg)
void isect_ray_planar_face (struct ray_data *rd, struct faceuse *fu_p, struct face_g_plane *fg_p)
void nmg_isect_ray_model (struct ray_data *rd)
void nmg_pl_hitmiss_list (const char *str, int num, const struct bu_list *hd, const struct xray *rp)
int nmg_class_ray_vs_shell (struct xray *rp, const struct shell *s, const int in_or_out_only, const struct bn_tol *tol)


Detailed Description

Support routines for raytracing an NMG.

Author - Lee A. Butler

Source - The U. S. Army Research Laboratory Aberdeen Proving Ground, Maryland 21005-5068 USA

Definition in file nmg_rt_isect.c.


Define Documentation

#define HIT_EDGE_VERTEX rd,
eu_p,
vu_p   ) 
 

Value:

{\
        if (rt_g.NMG_debug & DEBUG_RT_ISECT) bu_log("hit_edge_vertex\n"); \
        if (*eu_p->up.magic_p == NMG_SHELL_MAGIC || \
            (*eu_p->up.magic_p == NMG_LOOPUSE_MAGIC && \
             *eu_p->up.lu_p->up.magic_p == NMG_SHELL_MAGIC)) \
                ray_hit_vertex(rd, vu_p, NMG_VERT_ENTER_LEAVE); \
        else \
                ray_hit_vertex(rd, vu_p, NMG_VERT_UNKNOWN); \
        GET_HITMISS(myhit); \
        NMG_INDEX_ASSIGN(rd->hitmiss, eu_p->e_p, myhit); \
        myhit->hit.hit_private = (genptr_t)eu_p->e_p; \
        BU_LIST_MAGIC_SET(&myhit->l, NMG_RT_HIT_SUB_MAGIC); \
        BU_LIST_INSERT(&rd->rd_miss, &myhit->l); \
        NMG_CK_HITMISS(myhit); \
        NMG_CK_HITMISS_LISTS(myhit, rd); }
When a vertex at an end of an edge gets hit by the ray, this macro is used to build the hit structures for the vertex and the edge.

Definition at line 1162 of file nmg_rt_isect.c.

Referenced by isect_ray_lseg().

#define FACE_MISS rd,
f_p   ) 
 

Value:

{\
        struct hitmiss *myhit; \
        GET_HITMISS(myhit, rd->ap); \
        NMG_INDEX_ASSIGN(rd->hitmiss, f_p, myhit); \
        myhit->hit.hit_private = (genptr_t)f_p; \
        BU_LIST_MAGIC_SET(&myhit->l, NMG_RT_HIT_SUB_MAGIC); \
        BU_LIST_INSERT(&rd->rd_miss, &myhit->l); \
        NMG_CK_HITMISS(myhit); \
        NMG_CK_HITMISS_LISTS(myhit, rd); }

Definition at line 1725 of file nmg_rt_isect.c.

#define UV_TOL   1.0e-6
 

this is the UV-space tolerance for the NURB intersector, a larger number will improve speed, but too large will produce errors. Perhaps a routine to calculate an appropriate UV_TOL could be constructed.

Definition at line 1906 of file nmg_rt_isect.c.


Function Documentation

const char* nmg_rt_inout_str int  code  ) 
 

Definition at line 61 of file nmg_rt_isect.c.

References HMG_HIT_ANY_ANY, HMG_HIT_IN_IN, HMG_HIT_IN_ON, HMG_HIT_IN_OUT, HMG_HIT_ON_IN, HMG_HIT_ON_OUT, HMG_HIT_OUT_IN, HMG_HIT_OUT_ON, and HMG_HIT_OUT_OUT.

Referenced by nmg_ck_hitmiss_list(), and nmg_rt_print_hitmiss().

const char* nmg_rt_state_str int  code  ) 
 

Definition at line 87 of file nmg_rt_isect.c.

References NMG_RAY_STATE_ANY, NMG_RAY_STATE_INSIDE, NMG_RAY_STATE_ON, and NMG_RAY_STATE_OUTSIDE.

Referenced by nmg_ck_hitmiss_list().

void nmg_ck_hitmiss_list const struct bu_list hd  ) 
 

N M G _ C K _ H I T M I S S _ L I S T

Ensure that the ray makes a valid set of state transitions.

Definition at line 108 of file nmg_rt_isect.c.

References BU_LIST_FOR, bu_log(), HMG_HIT_ANY_ANY, HMG_INBOUND_STATE, HMG_OUTBOUND_STATE, NMG_CK_HITMISS, NMG_RAY_STATE_OUTSIDE, nmg_rt_inout_str(), nmg_rt_state_str(), rt_bomb(), and state.

Here is the call graph for this function:

void isect_ray_cnurb struct ray_data rd,
struct edgeuse eu_p
 

Definition at line 1495 of file nmg_rt_isect.c.

void isect_ray_lseg struct ray_data rd,
struct edgeuse eu_p
 

Definition at line 1500 of file nmg_rt_isect.c.

References ray_data::ap, bn_isect_line_lseg(), BU_LIST_INSERT, BU_LIST_MAGIC_SET, bu_log(), vertex_g::coord, edgeuse::e_p, edgeuse::eumate_p, GET_HITMISS, hitmiss::hit, HIT_EDGE_VERTEX, hit::hit_private, ray_data::hitmiss, hitmiss::l, NMG_CK_HITMISS, NMG_CK_HITMISS_LISTS, NMG_INDEX_ASSIGN, NMG_RT_HIT_SUB_MAGIC, NMG_RT_MISS_MAGIC, xray::r_dir, xray::r_pt, ray_data::rd_miss, ray_data::rp, ray_data::tol, vertexuse::v_p, vertex::vg_p, VJOIN1, void(), and edgeuse::vu_p.

Here is the call graph for this function:

void isect_ray_snurb_face struct ray_data rd,
struct faceuse fu,
struct face_g_snurb fg
 

Definition at line 1909 of file nmg_rt_isect.c.

References application::a_resource, ray_data::ap, bn_vec_ortho(), BU_LIST_DEQUEUE, BU_LIST_FIRST, BU_LIST_INIT, BU_LIST_NON_EMPTY, bu_log(), face_g_snurb::ctl_points, faceuse::f_p, face_g_snurb::l, NMG_CK_FACE_G_SNURB, NMG_CK_FACEUSE, NMG_CK_RD, face_g_snurb::order, face_g_snurb::pt_type, xray::r_dir, xray::r_pt, ray_data::rp, rt_nurb_bezier(), RT_NURB_EXTRACT_COORDS, RT_NURB_IS_PT_RATIONAL, face_g_snurb::s_size, VCROSS, and VDOT.

Here is the call graph for this function:

void isect_ray_planar_face struct ray_data rd,
struct faceuse fu_p,
struct face_g_plane fg_p
 

Definition at line 2189 of file nmg_rt_isect.c.

References bn_isect_line3_plane(), BU_LIST_FOR, BU_LIST_INSERT, BU_LIST_MAGIC_SET, bu_log(), ray_data::classifying_ray, bn_tol::dist, DIST_PT_PLANE, faceuse::f_p, ray_data::face_subhit, loopuse::fu_p, GET_HITMISS, hitmiss::hit, hit::hit_dist, hit::hit_point, hit::hit_private, hitmiss::inbound_use, hitmiss::l, faceuse::l, faceuse::lu_hd, bu_list::magic, NMG_CK_HITMISS, NMG_CLASS_AinB, NMG_CLASS_AonBshared, NMG_CLASS_AoutB, nmg_class_pt_fu_except(), NMG_CLASS_Unknown, NMG_FPI_PERGEOM, NMG_GET_FU_PLANE, NMG_INDEX_ASSIGN, NMG_RT_HIT_SUB_MAGIC, NMG_RT_MISS_MAGIC, NULL, hitmiss::outbound_use, ray_data::plane_pt, xray::r_dir, xray::r_pt, ray_data::ray_dist_to_plane, ray_data::rp, rt_bomb(), ray_data::tol, V3ARGS, V4ARGS, and VMOVE.

Here is the call graph for this function:

void nmg_pl_hitmiss_list const char *  str,
int  num,
const struct bu_list hd,
const struct xray rp
 

N M G _ P L _ H I T M I S S _ L I S T

Definition at line 2561 of file nmg_rt_isect.c.

References BU_LIST_FOR, bu_list_len(), bu_log(), fp, hitmiss::hit, hit::hit_dist, NMG_CK_HITMISS, NULL, pdv_3cont(), pdv_3move(), perror(), pl_color(), xray::r_dir, xray::r_pt, and VJOIN1.

Referenced by nmg_class_ray_vs_shell().

Here is the call graph for this function:


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