nmg_class.c File Reference

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

Include dependency graph for nmg_class.c:

Go to the source code of this file.

Data Structures

struct  neighbor

Defines

#define INSIDE   32
#define ON_SURF   64
#define OUTSIDE   128

Functions

const char * nmg_class_status (int status)
void nmg_pr_class_status (char *prefix, int status)
int nmg_class_lu_fu (const struct loopuse *lu, const struct bn_tol *tol)
int nmg_class_pt_s (const fastf_t *pt, const struct shell *s, const int in_or_out_only, const struct bn_tol *tol)
int nmg_2lu_identical (const struct edgeuse *eu1, const struct edgeuse *eu2)
void nmg_reclassify_lu_eu (struct loopuse *lu, long int **classlist, int newclass)
void nmg_class_shells (struct shell *sA, struct shell *sB, long int **classlist, const struct bn_tol *tol)
int nmg_classify_pt_loop (const point_t pt, const struct loopuse *lu, const struct bn_tol *tol)
int nmg_get_interior_pt (fastf_t *pt, const struct loopuse *lu, const struct bn_tol *tol)
int nmg_classify_lu_lu (const struct loopuse *lu1, const struct loopuse *lu2, const struct bn_tol *tol)
int nmg_classify_s_vs_s (struct shell *s2, struct shell *s, const struct bn_tol *tol)

Variables

int nmg_class_nothing_broken


Detailed Description

Subroutines to classify one object with respect to another. Possible classifications are AinB, AoutB, AinBshared, AinBanti.

The first set of routines (nmg_class_pt_xxx) are used to classify an arbitrary point specified by it's Cartesian coordinates, against various kinds of NMG elements. nmg_class_pt_f() and nmg_class_pt_s() are available to applications programmers for direct use, and have no side effects.

The second set of routines (class_xxx_vs_s) are used only to support the routine nmg_class_shells() mid-way through the NMG Boolean algorithm. These routines operate with special knowledge about the state of the data structures after the intersector has been called, and depends on all geometric equivalences to have been converted into shared topology.

Authors - Lee A. Butler Michael John Muuss

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

Definition in file nmg_class.c.


Define Documentation

#define INSIDE   32
 

Definition at line 71 of file nmg_class.c.

Referenced by nmg_class_status().

#define ON_SURF   64
 

Definition at line 72 of file nmg_class.c.

#define OUTSIDE   128
 

Definition at line 73 of file nmg_class.c.

Referenced by nmg_class_status().


Function Documentation

const char* nmg_class_status int  status  ) 
 

N M G _ C L A S S _ S T A T U S

Convert classification status to string.

Definition at line 112 of file nmg_class.c.

References INSIDE, ON_SURF, and OUTSIDE.

Referenced by nmg_pr_class_status().

void nmg_pr_class_status char *  prefix,
int  status
 

N M G _ P R _ C L A S S _ S T A T U S

Definition at line 129 of file nmg_class.c.

References bu_log(), and nmg_class_status().

Here is the call graph for this function:

int nmg_class_lu_fu const struct loopuse lu,
const struct bn_tol tol
 

N M G _ C L A S S _ L U _ F U

This is intended as an internal routine to support nmg_lu_reorient().

Given a loopuse in a face, pick one of it's vertexuses, and classify that point with respect to all the rest of the loopuses in the face. The containment status of that point is the status of the loopuse.

If the first vertex chosen is "ON" another loop boundary, choose the next vertex and try again. Only return an "ON" status if _all_ the vertices are ON.

The point is "A", and the face is "B".

Returns - NMG_CLASS_AinB lu is INSIDE the area of the face. NMG_CLASS_AonBshared ALL of lu is ON other loop boundaries. NMG_CLASS_AoutB lu is OUTSIDE the area of the face.

Called by - nmg_mod.c, nmg_lu_reorient()

Definition at line 517 of file nmg_class.c.

References BN_CK_TOL, BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_PNEXT_CIRC, bu_log(), vertex_g::coord, DEBUG_CLASSIFY, bn_tol::dist, DIST_PT_PLANE, loopuse::down_hd, faceuse::f_p, loopuse::fu_p, face::g, edgeuse::l, NMG_CK_EDGEUSE, NMG_CK_FACE, NMG_CK_FACE_G_PLANE, NMG_CK_FACEUSE, NMG_CK_LOOPUSE, NMG_CK_VERTEX, NMG_CK_VERTEX_G, NMG_CK_VERTEXUSE, NMG_CLASS_AonBshared, nmg_class_name(), nmg_class_pt_fu_except(), NMG_GET_FU_PLANE, NMG_VERTEXUSE_MAGIC, NULL, face::plane_p, loopuse::up, V3ARGS, vertexuse::v_p, vertex::vg_p, VPRINT, and edgeuse::vu_p.

Here is the call graph for this function:

int nmg_class_pt_s const fastf_t pt,
const struct shell s,
const int  in_or_out_only,
const struct bn_tol tol
 

N M G _ C L A S S _ P T _ S

This is intended as a general user interface routine. Given the Cartesian coordinates for a point in space, return the classification for that point with respect to a shell.

The algorithm used is to fire a ray from the point, and count the number of times it crosses a face.

The flag "in_or_out_only" specifies that the point is known to not be on the shell, therfore only returns of NMG_CLASS_AinB or NMG_CLASS_AoutB are acceptable.

The point is "A", and the face is "B".

Returns - NMG_CLASS_AinB pt is INSIDE the volume of the shell. NMG_CLASS_AonBshared pt is ON the shell boundary. NMG_CLASS_AoutB pt is OUTSIDE the volume of the shell.

Definition at line 632 of file nmg_class.c.

References BN_CK_TOL, bu_calloc(), bu_free(), BU_LIST_FOR, bu_log(), DEBUG_CLASSIFY, bn_tol::dist, DIST_PT_PLANE, faceuse::f_p, shell::fu_hd, nmgregion::m_p, MAGNITUDE, nmgregion_a::max_pt, shell_a::max_pt, model::maxindex, nmgregion_a::min_pt, shell_a::min_pt, NMG_CK_MODEL, NMG_CK_REGION_A, NMG_CK_SHELL, NMG_CLASS_AinB, NMG_CLASS_AonBshared, NMG_CLASS_AoutB, nmg_class_name(), nmg_class_pt_fu_except(), nmg_class_ray_vs_shell(), NMG_CLASS_Unknown, NMG_GET_FU_PLANE, NMG_INDEX_SET, NMG_INDEX_TEST, NULL, faceuse::orientation, OT_SAME, xray::r_dir, shell::r_p, xray::r_pt, nmgregion::ra_p, rt_bomb(), shell::sa_p, V3ARGS, V3PT_IN_RPP_TOL, VMOVE, void(), VSUB2, and VUNITIZE.

Here is the call graph for this function:

void nmg_reclassify_lu_eu struct loopuse lu,
long int **  classlist,
int  newclass
 

N M G _ R E C L A S S I F Y _ L U _ E U

Make all the edges and vertices of a loop carry the same classification as the loop. There is no intrinsic way to tell if an edge is "shared" or "antishared", except by reference to it's loopuse, but the heritage of the edgeuse makes a difference to the boolean evaluator.

"newclass" should only be AonBshared or AonBanti.

Definition at line 1403 of file nmg_class.c.

References BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), DEBUG_BASIC, loopuse::down_hd, edgeuse::e_p, NMG_CK_EDGE, NMG_CK_EDGEUSE, NMG_CK_LOOPUSE, NMG_CK_VERTEX, NMG_CK_VERTEXUSE, nmg_class_name(), NMG_INDEX_CLEAR, NMG_INDEX_SET, NMG_INDEX_TEST, NMG_VERTEXUSE_MAGIC, rt_bomb(), vertexuse::v_p, and edgeuse::vu_p.

Here is the call graph for this function:

void nmg_class_shells struct shell sA,
struct shell sB,
long int **  classlist,
const struct bn_tol tol
 

N M G _ C L A S S _ S H E L L S

Classify one shell WRT the other shell

Implicit return - Each element's classification will be represented by a SET entry in the appropriate classlist[] array.

Called by - nmg_bool.c

Definition at line 2157 of file nmg_class.c.

References BN_CK_TOL, BU_LIST_FIRST, BU_LIST_NON_EMPTY, BU_LIST_NOT_HEAD, BU_LIST_PNEXT, BU_LIST_PNEXT_PNEXT, bu_log(), shell::eu_hd, edgeuse::eumate_p, shell::fu_hd, faceuse::fumate_p, shell::lu_hd, loopuse::lumate_p, NMG_CK_SHELL, void(), and shell::vu_p.

Here is the call graph for this function:

int nmg_get_interior_pt fastf_t pt,
const struct loopuse lu,
const struct bn_tol tol
 

N M G _ G E T _ I N T E R I O R _ P T

Find any point that is interior to LU

Returns: 0 - All is well 1 - Loop is not part of a faceuse 2 - Loop is a single vertexuse 3 - Loop is a crack 4 - Just plain can't find an interior point

Definition at line 2284 of file nmg_class.c.

References BN_CK_TOL, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, vertex_g::coord, bn_tol::dist, loopuse::down_hd, loopuse::magic_p, NMG_CK_EDGEUSE, NMG_CK_LOOPUSE, NMG_CK_VERTEX_G, nmg_class_pt_lu_except(), NMG_EDGEUSE_MAGIC, NMG_FACEUSE_MAGIC, nmg_loop_is_a_crack(), NULL, loopuse::up, vertexuse::v_p, VADD2, vertex::vg_p, VMOVE, VSCALE, VSETALL, and edgeuse::vu_p.

Here is the call graph for this function:


Variable Documentation

int nmg_class_nothing_broken
 

Definition at line 1550 of file nmg_plot.c.


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