BRL-CAD
#include "common.h"
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "bio.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.

Macros

#define HIT_EDGE_VERTEX(rd, eu_p, vu_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)
 
HIDDEN void nmg_rt_isect_plfu (struct faceuse *fu, fastf_t *pt, fastf_t *plane_pt)
 
HIDDEN void pleu (struct edgeuse *eu, fastf_t *pt, fastf_t *plane_pt)
 
void nmg_rt_print_hitmiss (struct hitmiss *a_hit)
 
void nmg_rt_print_hitlist (struct bu_list *hd)
 
HIDDEN void hit_ins (struct ray_data *rd, struct hitmiss *newhit)
 
HIDDEN struct hitmissray_miss_vertex (struct ray_data *rd, struct vertexuse *vu_p)
 
HIDDEN void get_pole_dist_to_face (struct ray_data *rd, struct vertexuse *vu, fastf_t *Pole, fastf_t *Pole_prj_pt, double *Pole_dist, fastf_t *Pole_pca, fastf_t *pointA, fastf_t *leftA, fastf_t *pointB, fastf_t *leftB, fastf_t *polar_height_vect, char *Pole_name)
 
HIDDEN void plot_neighborhood (fastf_t *North_Pole, fastf_t *North_pl_pt, fastf_t *North_pca, fastf_t *South_Pole, fastf_t *South_pl_pt, fastf_t *South_pca, fastf_t *pointA, fastf_t *pointB, fastf_t *norm, fastf_t *pt, fastf_t *leftA, fastf_t *leftB)
 
HIDDEN void vertex_neighborhood (struct ray_data *rd, struct vertexuse *vu_p, struct hitmiss *myhit)
 
HIDDEN void ray_hit_vertex (struct ray_data *rd, struct vertexuse *vu_p, int status)
 
HIDDEN int isect_ray_vertexuse (struct ray_data *rd, struct vertexuse *vu_p)
 
HIDDEN void colinear_edge_ray (struct ray_data *rd, struct edgeuse *eu_p)
 
HIDDEN void edge_hit_ray_state (struct ray_data *rd, struct edgeuse *eu, struct hitmiss *myhit)
 
HIDDEN void ray_hit_edge (struct ray_data *rd, struct edgeuse *eu_p, double dist_along_ray, fastf_t *pt)
 
void isect_ray_lseg (struct ray_data *rd, struct edgeuse *eu_p)
 
HIDDEN void isect_ray_edgeuse (struct ray_data *rd, struct edgeuse *eu_p)
 
HIDDEN void isect_ray_loopuse (struct ray_data *rd, struct loopuse *lu_p)
 
HIDDEN void eu_touch_func (struct edgeuse *eu, fastf_t *pt, char *priv)
 
HIDDEN void vu_touch_func (struct vertexuse *vu, fastf_t *pt, char *priv)
 
HIDDEN void record_face_hit (struct ray_data *rd, struct hitmiss *myhit, fastf_t *plane_pt, double dist, struct faceuse *fu_p, fastf_t *norm)
 
void isect_ray_snurb_face (struct ray_data *rd, struct faceuse *fu, struct face_g_snurb *fg)
 
HIDDEN void isect_ray_planar_face (struct ray_data *rd, struct faceuse *fu_p)
 
HIDDEN void isect_ray_faceuse (struct ray_data *rd, struct faceuse *fu_p)
 
HIDDEN void nmg_isect_ray_shell (struct ray_data *rd, const struct shell *s_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)
 
HIDDEN int guess_class_from_hitlist_max (struct ray_data *rd, int *hari_kari, int in_or_out_only)
 
HIDDEN int guess_class_from_hitlist_min (struct ray_data *rd, int *hari_kari, int in_or_out_only)
 
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.

Definition in file nmg_rt_isect.c.

Macro Definition Documentation

#define HIT_EDGE_VERTEX (   rd,
  eu_p,
  vu_p 
)
Value:
{ \
if (RTG.NMG_debug & DEBUG_RT_ISECT) bu_log("hit_edge_vertex\n"); \
*eu_p->up.lu_p->up.magic_p == NMG_SHELL_MAGIC)) \
else \
NMG_GET_HITMISS(myhit, rd->ap); \
NMG_INDEX_ASSIGN(rd->hitmiss, eu_p->e_p, myhit); \
myhit->hit.hit_private = (void *)eu_p->e_p; \
\
BU_LIST_INSERT(&rd->rd_miss, &myhit->l); \
}
void bu_log(const char *,...) _BU_ATTR_PRINTF12
Definition: log.c:176
#define BU_LIST_INSERT(old, new)
Definition: list.h:183
#define NMG_SHELL_MAGIC
Definition: magic.h:142
#define BU_LIST_MAGIC_SET(_l, _magic)
Definition: list.h:129
Definition: raytrace.h:248
#define NMG_LOOPUSE_MAGIC
Definition: magic.h:130
if(share_geom)
Definition: nmg_mod.c:3829
uint32_t NMG_debug
debug bits for NMG's see nmg.h
Definition: raytrace.h:1699
#define NMG_RT_HIT_SUB_MAGIC
Definition: magic.h:139
oldeumate e_p
Definition: nmg_mod.c:3936
oldeumate e_p eu_p
Definition: nmg_mod.c:3940
#define NMG_VERT_UNKNOWN
Definition: raytrace.h:2329
HIDDEN void ray_hit_vertex(struct ray_data *rd, struct vertexuse *vu_p, int status)
Definition: nmg_rt_isect.c:960
eu1 up magic_p
Definition: nmg_mod.c:3915
else
Definition: nmg_mod.c:3872
#define NMG_GET_HITMISS(_p, _ap)
Definition: raytrace.h:2465
#define NMG_VERT_ENTER_LEAVE
Definition: raytrace.h:2327
struct rt_g RTG
Definition: globals.c:39

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 1132 of file nmg_rt_isect.c.

Referenced by isect_ray_lseg().

#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 1786 of file nmg_rt_isect.c.

Referenced by isect_ray_snurb_face(), and rt_nurb_shot().

Function Documentation

const char* nmg_rt_state_str ( int  code)
void nmg_ck_hitmiss_list ( const struct bu_list hd)

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

Definition at line 95 of file nmg_rt_isect.c.

References bu_bomb(), BU_LIST_FOR, bu_log(), HMG_HIT_ANY_ANY, HMG_INBOUND_STATE, HMG_OUTBOUND_STATE, hitmiss::in_out, NMG_CK_HITMISS, NMG_RAY_STATE_OUTSIDE, nmg_rt_inout_str(), and nmg_rt_state_str().

Here is the call graph for this function:

HIDDEN void nmg_rt_isect_plfu ( struct faceuse *  fu,
fastf_t pt,
fastf_t plane_pt 
)

Definition at line 127 of file nmg_rt_isect.c.

References bu_bomb(), bu_calloc(), bu_free(), bu_log(), nmg_pl_fu(), pd_3space(), pdv_3line(), pl_color(), and pl_erase().

Referenced by ray_hit_edge(), and record_face_hit().

Here is the call graph for this function:

HIDDEN void pleu ( struct edgeuse *  eu,
fastf_t pt,
fastf_t plane_pt 
)

Definition at line 166 of file nmg_rt_isect.c.

References bu_bomb(), bu_calloc(), bu_free(), bu_log(), nmg_find_model(), nmg_pl_eu(), pd_3space(), pdv_3line(), pl_color(), and pl_erase().

Referenced by ray_hit_edge().

Here is the call graph for this function:

void nmg_rt_print_hitmiss ( struct hitmiss a_hit)

Definition at line 211 of file nmg_rt_isect.c.

References bu_identify_magic(), bu_log(), hitmiss::hit, hit::hit_dist, hit::hit_point, hit::hit_private, hitmiss::in_out, hitmiss::inbound_norm, NMG_CK_HITMISS, NMG_HITMISS_SEG_IN, NMG_HITMISS_SEG_OUT, nmg_rt_inout_str(), hitmiss::outbound_norm, hitmiss::start_stop, and VPRINT.

Referenced by hit_ins(), nmg_bsegs(), nmg_class_ray_vs_shell(), nmg_ray_segs(), nmg_rt_print_hitlist(), and unresolved().

Here is the call graph for this function:

void nmg_rt_print_hitlist ( struct bu_list hd)

Definition at line 234 of file nmg_rt_isect.c.

References BU_LIST_FOR, bu_log(), and nmg_rt_print_hitmiss().

Referenced by check_hitstate(), hit_ins(), isect_ray_vertexuse(), and nmg_isect_ray_model().

Here is the call graph for this function:

HIDDEN void hit_ins ( struct ray_data rd,
struct hitmiss newhit 
)

insert the new hit point in the correct place in the list of hits so that the list is always in sorted order

Definition at line 251 of file nmg_rt_isect.c.

References BU_LIST_FOR, BU_LIST_INSERT, BU_LIST_MAGIC_SET, BU_LIST_NOT_HEAD, bu_log(), hitmiss::hit, hit::hit_dist, hit::hit_magic, hitmiss::l, rt_g::NMG_debug, NMG_RT_HIT_MAGIC, nmg_rt_print_hitlist(), nmg_rt_print_hitmiss(), ray_data::rd_hit, RT_HIT_MAGIC, and RTG.

Referenced by isect_ray_snurb_face(), ray_hit_edge(), ray_hit_vertex(), and record_face_hit().

Here is the call graph for this function:

HIDDEN struct hitmiss* ray_miss_vertex ( struct ray_data rd,
struct vertexuse *  vu_p 
)

The ray missed this vertex. Build the appropriate miss structure.

Definition at line 293 of file nmg_rt_isect.c.

References ray_data::ap, BU_LIST_INSERT, BU_LIST_MAGIC_EQUAL, BU_LIST_MAGIC_SET, bu_log(), hitmiss::dist_in_plane, hitmiss::hit, hit::hit_private, ray_data::hitmiss, hitmiss::inbound_use, hitmiss::l, rt_g::NMG_debug, NMG_GET_HITMISS, NMG_RT_HIT_MAGIC, NMG_RT_HIT_SUB_MAGIC, NMG_RT_MISS_MAGIC, hitmiss::outbound_use, ray_data::rd_miss, and RTG.

Referenced by isect_ray_lseg(), isect_ray_vertexuse(), and ray_hit_edge().

Here is the call graph for this function:

HIDDEN void get_pole_dist_to_face ( struct ray_data rd,
struct vertexuse *  vu,
fastf_t Pole,
fastf_t Pole_prj_pt,
double *  Pole_dist,
fastf_t Pole_pca,
fastf_t pointA,
fastf_t leftA,
fastf_t pointB,
fastf_t leftB,
fastf_t polar_height_vect,
char *  Pole_name 
)

Support routine for vertex_neighborhood()

Definition at line 348 of file nmg_rt_isect.c.

References bn_dist_pt3_lseg3(), bu_bomb(), bu_log(), code(), rt_g::NMG_debug, RTG, SMALL_FASTF, ray_data::tol, VPRINT, and VSETALL.

Referenced by vertex_neighborhood().

Here is the call graph for this function:

HIDDEN void plot_neighborhood ( fastf_t North_Pole,
fastf_t North_pl_pt,
fastf_t North_pca,
fastf_t South_Pole,
fastf_t South_pl_pt,
fastf_t South_pca,
fastf_t pointA,
fastf_t pointB,
fastf_t norm,
fastf_t pt,
fastf_t leftA,
fastf_t leftB 
)

Definition at line 573 of file nmg_rt_isect.c.

References bu_log(), pdv_3cont(), pdv_3line(), pdv_3move(), pl_color(), and pl_label().

Referenced by vertex_neighborhood().

Here is the call graph for this function:

HIDDEN void vertex_neighborhood ( struct ray_data rd,
struct vertexuse *  vu_p,
struct hitmiss myhit 
)

Examine the vertex neighborhood to classify the ray as IN/ON/OUT of the NMG both before and after hitting the vertex.

There is a conceptual sphere about the vertex. For reasons associated with tolerancing, the sphere has a radius equal to the magnitude of the maximum dimension of the NMG bounding RPP.

The point where the ray enters this sphere is called the "North Pole" and the point where it exits the sphere is called the "South Pole"

For each face which uses this vertex we compute 2 "distance" metrics:

project the "north pole" and "south pole" down onto the plane of the face:

                                /
                               /
                              /North Pole
                             / |
            Face Normal  ^  /  |
                         | /   | Projection of North Pole
 Plane of face                   |/    V to plane

------------------------------—*----------------------------— Projection of ^ / Vertex South Pole | / to plane | / |/ /South Pole / / / / / / |/_ Ray

If the projected polar point is inside the two edgeuses at this vertexuse, then the distance to the face is the projection distance.

else Each of the two edgeuses at this vertexuse implies an infinite ray originating at the vertex. Find the point of closest approach (PCA) of each ray to the projection point. For whichever ray passes closer to the projection point, find the distance from the original pole point to the PCA. This is the "distance to the face" metric for this face from the given pole point.

We compute this metric for the North and South poles for all faces at the vertex. The face with the smallest distance to the north (south) pole is used to determine the state of the ray before (after) it hits the vertex.

If the north (south) pole is "outside" the plane of the closest face, then the ray state is "outside" before (after) the ray hits the vertex.

Definition at line 707 of file nmg_rt_isect.c.

References BN_VECT_ARE_PERP, bu_bomb(), BU_LIST_FOR, BU_LIST_PNEXT_CIRC, BU_LIST_PPREV_CIRC, bu_log(), get_pole_dist_to_face(), hitmiss::hit, hit::hit_normal, hit::hit_private, 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, hitmiss::inbound_norm, hitmiss::inbound_use, MAX_FASTF, rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_find_eu_leftvec(), nmg_find_fu_of_vu(), nmg_find_model(), nmg_model_bb(), NMG_RAY_STATE_INSIDE, NMG_RAY_STATE_ON, NMG_RAY_STATE_OUTSIDE, hitmiss::outbound_norm, hitmiss::outbound_use, plot_neighborhood(), xray::r_dir, ray_data::rp, RTG, SMALL_FASTF, ray_data::tol, and VPRINT.

Referenced by ray_hit_vertex().

Here is the call graph for this function:

HIDDEN void ray_hit_vertex ( struct ray_data rd,
struct vertexuse *  vu_p,
int  status 
)

Once it has been decided that the ray hits the vertex, this routine takes care of recording that fact.

Definition at line 960 of file nmg_rt_isect.c.

References ray_data::ap, BU_LIST_DEQUEUE, BU_LIST_MAGIC_EQUAL, BU_LIST_MAGIC_SET, bu_log(), hitmiss::hit, hit::hit_dist, hit_ins(), hit::hit_point, hit::hit_private, ray_data::hitmiss, if(), hitmiss::inbound_use, hitmiss::l, NMG_CK_HITMISS, rt_g::NMG_debug, NMG_GET_HITMISS, NMG_RT_HIT_MAGIC, hitmiss::outbound_use, xray::r_dir, xray::r_pt, ray_data::rp, RTG, OSL::Strings::v, V3ARGS, and vertex_neighborhood().

Referenced by colinear_edge_ray(), isect_ray_vertexuse(), and vu_touch_func().

Here is the call graph for this function:

HIDDEN int isect_ray_vertexuse ( struct ray_data rd,
struct vertexuse *  vu_p 
)

Called in one of the following situations: 1) Zero length edge 2) Vertexuse child of Loopuse 3) Vertexuse child of Shell

return: 1 vertex was hit 0 vertex was missed

Definition at line 1026 of file nmg_rt_isect.c.

References bn_dist_line3_pt3(), BU_LIST_MAGIC_EQUAL, bu_log(), bn_tol::dist, ray_data::hitmiss, rt_g::NMG_debug, NMG_HIT_LIST, NMG_RT_HIT_MAGIC, nmg_rt_print_hitlist(), NMG_VERT_UNKNOWN, xray::r_dir, xray::r_pt, ray_hit_vertex(), ray_miss_vertex(), ray_data::rp, RTG, and ray_data::tol.

Referenced by isect_ray_loopuse(), isect_ray_lseg(), and nmg_isect_ray_shell().

Here is the call graph for this function:

HIDDEN void colinear_edge_ray ( struct ray_data rd,
struct edgeuse *  eu_p 
)

As the name implies, this routine is called when the ray and an edge are colinear. It handles marking the vertices as hit, remembering that this is a seg_in/seg_out pair, and builds the hit on the edge.

Definition at line 1087 of file nmg_rt_isect.c.

References ray_data::ap, BU_LIST_INSERT, BU_LIST_MAGIC_SET, bu_log(), hitmiss::hit, hit::hit_dist, hit::hit_private, ray_data::hitmiss, hitmiss::l, rt_g::NMG_debug, NMG_GET_HITMISS, NMG_HITMISS_SEG_IN, NMG_HITMISS_SEG_OUT, NMG_RT_HIT_SUB_MAGIC, NMG_VERT_ENTER, NMG_VERT_LEAVE, hitmiss::other, ray_hit_vertex(), ray_data::rd_miss, RTG, and hitmiss::start_stop.

Referenced by isect_ray_lseg().

Here is the call graph for this function:

HIDDEN void edge_hit_ray_state ( struct ray_data rd,
struct edgeuse *  eu,
struct hitmiss myhit 
)
HIDDEN void ray_hit_edge ( struct ray_data rd,
struct edgeuse *  eu_p,
double  dist_along_ray,
fastf_t pt 
)

record a hit on an edge.

Definition at line 1360 of file nmg_rt_isect.c.

References ray_data::ap, BU_LIST_DEQUEUE, bu_log(), edge_hit_ray_state(), hitmiss::hit, hit::hit_dist, hit_ins(), hit::hit_point, hit::hit_private, ray_data::hitmiss, hitmiss::inbound_use, hitmiss::l, magic, rt_g::NMG_debug, nmg_find_fu_of_eu(), NMG_GET_HITMISS, NMG_RT_HIT_MAGIC, NMG_RT_HIT_SUB_MAGIC, nmg_rt_isect_plfu(), NMG_RT_MISS_MAGIC, hitmiss::outbound_use, pleu(), xray::r_pt, ray_miss_vertex(), ray_data::rp, and RTG.

Referenced by eu_touch_func(), and isect_ray_lseg().

Here is the call graph for this function:

void isect_ray_lseg ( struct ray_data rd,
struct edgeuse *  eu_p 
)
HIDDEN void isect_ray_edgeuse ( struct ray_data rd,
struct edgeuse *  eu_p 
)

Intersect ray with edgeuse. If they pass within tolerance, a hit is generated.

Definition at line 1531 of file nmg_rt_isect.c.

References bu_bomb(), BU_LIST_MAGIC_EQUAL, bu_log(), ray_data::hitmiss, isect_ray_lseg(), nmg_bu_bomb, rt_g::NMG_debug, NMG_EDGE_G_CNURB_MAGIC, NMG_EDGE_G_LSEG_MAGIC, NMG_RT_HIT_MAGIC, NMG_RT_HIT_SUB_MAGIC, NMG_RT_MISS_MAGIC, and RTG.

Referenced by isect_ray_loopuse(), and nmg_isect_ray_shell().

Here is the call graph for this function:

HIDDEN void isect_ray_loopuse ( struct ray_data rd,
struct loopuse *  lu_p 
)

Definition at line 1599 of file nmg_rt_isect.c.

References BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), eu_p, isect_ray_edgeuse(), isect_ray_vertexuse(), nmg_bu_bomb, NMG_CK_LOOPUSE(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, NMG_VERTEXUSE_MAGIC, and RTG.

Referenced by isect_ray_planar_face(), and nmg_isect_ray_shell().

Here is the call graph for this function:

HIDDEN void eu_touch_func ( struct edgeuse *  eu,
fastf_t pt,
char *  priv 
)

Definition at line 1628 of file nmg_rt_isect.c.

References BU_LIST_PNEXT_CIRC, bu_log(), ray_data::face_subhit, rt_g::NMG_debug, ray_data::ray_dist_to_plane, ray_hit_edge(), and RTG.

Referenced by isect_ray_planar_face().

Here is the call graph for this function:

HIDDEN void vu_touch_func ( struct vertexuse *  vu,
fastf_t pt,
char *  priv 
)

Definition at line 1660 of file nmg_rt_isect.c.

References bu_log(), ray_data::face_subhit, rt_g::NMG_debug, NMG_VERT_UNKNOWN, ray_hit_vertex(), and RTG.

Referenced by isect_ray_planar_face().

Here is the call graph for this function:

HIDDEN void record_face_hit ( struct ray_data rd,
struct hitmiss myhit,
fastf_t plane_pt,
double  dist,
struct faceuse *  fu_p,
fastf_t norm 
)
HIDDEN void nmg_isect_ray_shell ( struct ray_data rd,
const struct shell *  s_p 
)

Implicit return: adds hit points to the hit-list "hl"

Definition at line 2318 of file nmg_rt_isect.c.

References BU_LIST_FOR, bu_log(), eu_p, isect_ray_edgeuse(), isect_ray_faceuse(), isect_ray_loopuse(), isect_ray_vertexuse(), NMG_CK_SHELL(), rt_g::NMG_debug, ray_data::rd_invdir, ray_data::rp, rt_in_rpp(), and RTG.

Referenced by nmg_class_ray_vs_shell(), and nmg_isect_ray_model().

Here is the call graph for this function:

void nmg_isect_ray_model ( struct ray_data rd)

Definition at line 2361 of file nmg_rt_isect.c.

References BU_LIST_FOR, BU_LIST_IS_EMPTY, bu_log(), NMG_CK_HITMISS_LISTS, rt_g::NMG_debug, nmg_isect_ray_shell(), nmg_rt_print_hitlist(), xray::r_dir, xray::r_pt, ray_data::rd_hit, ray_data::rd_invdir, ray_data::rd_m, ray_data::rp, rt_in_rpp(), and RTG.

Referenced by rt_nmg_shot().

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 
)

Definition at line 2412 of file nmg_rt_isect.c.

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

Referenced by nmg_class_ray_vs_shell().

Here is the call graph for this function:

HIDDEN int guess_class_from_hitlist_max ( struct ray_data rd,
int *  hari_kari,
int  in_or_out_only 
)

Definition at line 2451 of file nmg_rt_isect.c.

References BU_LIST_FOR, bu_log(), 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, NEAR_ZERO, NMG_CK_HITMISS, NMG_CK_RD, rt_g::NMG_debug, nmg_rt_inout_str(), ray_data::rd_hit, RTG, ray_data::tol, and ZERO.

Referenced by nmg_class_ray_vs_shell().

Here is the call graph for this function:

HIDDEN int guess_class_from_hitlist_min ( struct ray_data rd,
int *  hari_kari,
int  in_or_out_only 
)

Definition at line 2542 of file nmg_rt_isect.c.

References BU_LIST_FOR, bu_log(), 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, NEAR_ZERO, NMG_CK_HITMISS, NMG_CK_RD, rt_g::NMG_debug, nmg_rt_inout_str(), ray_data::rd_hit, RTG, ray_data::tol, and ZERO.

Referenced by nmg_class_ray_vs_shell().

Here is the call graph for this function:

int nmg_class_ray_vs_shell ( struct xray rp,
const struct shell *  s,
const int  in_or_out_only,
const struct bn_tol tol 
)

Intended as a support routine for nmg_class_pt_s() in nmg_class.c

Intersect a ray with a shell, and return whether the ray start point is inside or outside or ON the shell. Count the number of crossings (hit points) along the ray, both in the negative and positive directions. If an even number, point is outside, if an odd number point is inside. If the negative-going and positive-going assessments don't agree, this is a problem.

If "in_or_out_only" is non-zero, then we will not look for a classification of "ON" the shell.

The caller must be prepared for a return of NMG_CLASS_Unknown, in which case it should pick a less difficult ray direction to fire and try again.

Returns NMG_CLASS_Unknown if we can't tell or NMG_CLASS_xxx for the classification of the pt w.r.t. the shell.

Definition at line 2654 of file nmg_rt_isect.c.

References application::a_resource, ray_data::ap, BN_CK_TOL, bu_calloc(), bu_free(), BU_LIST_DEQUEUE, BU_LIST_FOR, BU_LIST_INIT, BU_LIST_IS_INITIALIZED, BU_LIST_WHILE, bu_log(), ray_data::classifying_ray, guess_class_from_hitlist_max(), guess_class_from_hitlist_min(), hitmiss::hit, hit::hit_dist, ray_data::hitmiss, ray_data::magic, ray_data::manifolds, NMG_CK_HITMISS, NMG_CK_SHELL(), nmg_class_name(), rt_g::NMG_debug, nmg_find_model(), NMG_FREE_HITLIST, nmg_isect_ray_shell(), nmg_manifolds(), nmg_pl_hitmiss_list(), NMG_RAY_DATA_MAGIC, nmg_rt_print_hitmiss(), xray::r_dir, xray::r_pt, ray_data::rd_hit, ray_data::rd_invdir, ray_data::rd_m, ray_data::rd_miss, resource::re_nmgfree, ray_data::rp, RT_APPLICATION_INIT, rt_uniresource, RTG, ray_data::seghead, SMALL_FASTF, ray_data::stp, ray_data::tol, V3ARGS, X, Y, Z, and ZERO.

Referenced by nmg_class_pt_s().

Here is the call graph for this function: