nmg_pt_fu.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 "plot3.h"

Include dependency graph for nmg_pt_fu.c:

Go to the source code of this file.

Data Structures

struct  ve_dist
struct  edge_info
struct  fpi

Defines

#define NMG_VE_DIST_MAGIC   0x102938
#define NMG_CK_VED(_p)   NMG_CKMAG(_p, NMG_VE_DIST_MAGIC, "vertex/edge_dist")
#define NMG_EDGE_INFO_MAGIC   0xe100
#define NMG_CK_EI(_p)   NMG_CKMAG(_p, NMG_EDGE_INFO_MAGIC, "edge_info")
#define NMG_FPI_MAGIC   12345678
#define NMG_CK_FPI(_fpi)
#define NMG_FPI_TOUCHED   27
#define NMG_FPI_MISSED   32768

Functions

int bn_distsq_pt3_lseg3 (fastf_t *dist, const fastf_t *a, const fastf_t *b, const fastf_t *p, const struct bn_tol *tol)
int nmg_eu_is_part_of_crack (const struct edgeuse *eu)
int nmg_class_pt_euvu (const fastf_t *pt, struct edgeuse *eu_in, const struct bn_tol *tol)
HIDDEN void make_near_list (struct edge_info *edge_list, struct bu_list *near1)
int nmg_class_pt_fu_except (const fastf_t *pt, const struct faceuse *fu, const struct loopuse *ignore_lu, void(*eu_func)(), void(*vu_func)(), const char *priv, const int call_on_hits, const int in_or_out_only, const struct bn_tol *tol)
int nmg_class_pt_lu_except (fastf_t *pt, const struct loopuse *lu, const struct edge *e_p, const struct bn_tol *tol)


Detailed Description

Routines for classifying a point with respect to a faceuse.

Author - Lee A. Butler

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

Definition in file nmg_pt_fu.c.


Define Documentation

#define NMG_VE_DIST_MAGIC   0x102938
 

Definition at line 62 of file nmg_pt_fu.c.

#define NMG_CK_VED _p   )     NMG_CKMAG(_p, NMG_VE_DIST_MAGIC, "vertex/edge_dist")
 

Definition at line 63 of file nmg_pt_fu.c.

Referenced by make_near_list(), and nmg_class_pt_lu_except().

#define NMG_EDGE_INFO_MAGIC   0xe100
 

Definition at line 75 of file nmg_pt_fu.c.

#define NMG_CK_EI _p   )     NMG_CKMAG(_p, NMG_EDGE_INFO_MAGIC, "edge_info")
 

Definition at line 76 of file nmg_pt_fu.c.

Referenced by make_near_list(), and nmg_class_pt_lu_except().

#define NMG_FPI_MAGIC   12345678
 

Definition at line 90 of file nmg_pt_fu.c.

Referenced by nmg_class_pt_lu_except().

#define NMG_CK_FPI _fpi   ) 
 

Value:

NMG_CKMAG(_fpi, NMG_FPI_MAGIC, "fu_pt_info") ; \
        BN_CK_TOL( _fpi->tol ); \
        BU_CK_LIST_HEAD(&_fpi->ve_dh)

Definition at line 91 of file nmg_pt_fu.c.

#define NMG_FPI_TOUCHED   27
 

Definition at line 96 of file nmg_pt_fu.c.

#define NMG_FPI_MISSED   32768
 

Definition at line 97 of file nmg_pt_fu.c.


Function Documentation

int bn_distsq_pt3_lseg3 fastf_t dist,
const fastf_t a,
const fastf_t b,
const fastf_t p,
const struct bn_tol tol
 

B N _ D I S T S Q _ P T 3 _ L S E G 3 _ J R A

Find the square of the distance from a point P to a line segment described by the two endpoints A and B.

P * /. / . / . / . (dist) / . / . *------*--------* A PCA B

There are six distinct cases, with these return codes - 0 P is within tolerance of lseg AB. *dist = 0. 1 P is within tolerance of point A. *dist = 0. 2 P is within tolerance of point B. *dist = 0. 3 PCA is within tolerance of A. *dist = |P-A|**2. 4 PCA is within tolerance of B. *dist = |P-B|**2. 5 P is "above/below" lseg AB. *dist=|PCA-P|**2.

This routine was formerly called bn_dist_pt_lseg(). This is a special version that returns the square of the distance and does not actually calculate PCA.

Definition at line 139 of file nmg_pt_fu.c.

References BN_CK_TOL, bu_log(), DEBUG_MATH, bn_tol::dist, bn_tol::dist_sq, MAGSQ, RT_G_DEBUG, V3ARGS, VDOT, and VSUB2.

Here is the call graph for this function:

int nmg_class_pt_euvu const fastf_t pt,
struct edgeuse eu_in,
const struct bn_tol tol
 

N M G _ C L A S S _ P T _ E U V U

Classify a point with respect to an EU where the VU is the closest to the point. The EU and its left vector form an XY coordinate system in the face, with EU along the X-axis and its left vector along the Y-axis. Use these to decompose the direction of the prev_eu into X and Y coordinates (xo,yo) then do the same for the vector to the point to be classed (xpt,ypt). If (xpt,ypt) makes a smaller angle with EU than does (xo,yo), then PT is in the face, otherwise it is out.

It is assumed that eu is from an OT_SAME faceuse, and that the PCA of PT to EU is at eu->vu_p.

Definition at line 382 of file nmg_pt_fu.c.

References BN_CK_TOL, BU_LIST_PNEXT_CIRC, BU_LIST_PPREV_CIRC, bu_log(), vertex_g::coord, DEBUG_PT_FU, edgeuse::eumate_p, edgeuse::l, edgeuse::lu_p, edgeuse::magic_p, NMG_CK_EDGEUSE, NMG_CK_LOOPUSE, NMG_CK_VERTEX, NMG_CLASS_AinB, NMG_CLASS_AoutB, nmg_class_name(), NMG_CLASS_Unknown, nmg_eu_is_part_of_crack(), nmg_find_eu_leftvec(), NMG_LOOPUSE_MAGIC, rt_bomb(), edgeuse::up, V3ARGS, vertexuse::v_p, VDOT, vertex::vg_p, VSUB2, and edgeuse::vu_p.

Here is the call graph for this function:

HIDDEN void make_near_list struct edge_info edge_list,
struct bu_list near1
 

Make a list of all edgeuses which are at the same distance as the first element on the list. Toss out opposing pairs of edgeuses of the same edge.

Definition at line 827 of file nmg_pt_fu.c.

References BU_CK_LIST_HEAD, bu_free(), BU_LIST_APPEND, BU_LIST_DEQUEUE, BU_LIST_FIRST, BU_LIST_FOR, BU_LIST_IS_EMPTY, BU_LIST_NOT_HEAD, BU_LIST_PLAST, BU_LIST_PNEXT, bu_log(), edge_info::class, vertex_g::coord, DEBUG_PT_FU, ve_dist::dist, edge_info::eu_p, edgeuse::eumate_p, edge_info::l, ve_dist::magic_p, NMG_CK_EI, NMG_CK_VED, nmg_class_name(), ve_dist::status, ve_dist::v1, ve_dist::v2, V3ARGS, vertexuse::v_p, edge_info::ved_p, vertex::vg_p, and edgeuse::vu_p.

Here is the call graph for this function:

int nmg_class_pt_fu_except const fastf_t pt,
const struct faceuse fu,
const struct loopuse ignore_lu,
void(*)()  eu_func,
void(*)()  vu_func,
const char *  priv,
const int  call_on_hits,
const int  in_or_out_only,
const struct bn_tol tol
 

Classify a point on a face's plane as being inside/outside the area of the face.

For each loopuse, compute IN/ON/OUT

if any loop has pt classified as "ON" return "ON" (actually returns "IN" -jra)

ignore all OT_SAME loops w/pt classified as "OUT" ignore all OT_OPPOSITE loops w/pt classified as "IN" If (# OT_SAME loops == # OT_OPPOSITE loops) pt is "OUT" else if (# OT_SAME loops - 1 == # OT_OPPOSITE loops) pt is "IN" else Error! panic!

Values for "call_on_hits" 1 find all elements pt touches, call user routine for each geom. 2 find all elements pt touches, call user routine for each use

in_or_out_only: non-zero pt is known NOT to be on an EU of FU 0 pt may be on an EU of FU

Returns - NMG_CLASS_AonB, etc...

Definition at line 1336 of file nmg_pt_fu.c.

References BN_CK_TOL, bu_log(), DEBUG_PT_FU, bn_tol::dist, DIST_PT_PLANE, faceuse::f_p, face::g, face::max_pt, face::min_pt, NMG_CK_FACE, NMG_CK_FACE_G_PLANE, NMG_CK_FACEUSE, NMG_CK_LOOPUSE, NMG_CLASS_AoutB, NMG_CLASS_Unknown, NMG_GET_FU_PLANE, fpi::norm, faceuse::orientation, OT_SAME, face::plane_p, rt_bomb(), V3ARGS, V3PT_IN_RPP, and V4ARGS.

Here is the call graph for this function:

int nmg_class_pt_lu_except fastf_t pt,
const struct loopuse lu,
const struct edge e_p,
const struct bn_tol tol
 

N M G _ C L A S S _ P T _ L U _ E X C E P T

Classify a point as being in/on/out of the area bounded by a loop, ignoring any uses of a particular edge in the loop.

This routine must be called with a face-loop of edges! It will not work properly on crack loops.

Definition at line 1502 of file nmg_pt_fu.c.

References BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_INIT, bu_log(), vertex_g::coord, DEBUG_PT_FU, ve_dist::dist, bn_tol::dist, DIST_PT_PLANE, bn_tol::dist_sq, loopuse::down_hd, edgeuse::e_p, fpi::eu_func, edge::eu_p, edgeuse::eumate_p, fpi::fu_p, loopuse::fu_p, fpi::hits, edge_info::l, loopuse::l_p, loop::lg_p, fpi::magic, loop_g::max_pt, loop_g::min_pt, NMG_CK_EDGE, NMG_CK_EI, NMG_CK_FACEUSE, NMG_CK_LOOPUSE, NMG_CK_VED, NMG_CLASS_AinB, NMG_CLASS_AonBshared, NMG_CLASS_AoutB, NMG_CLASS_Unknown, NMG_FPI_MAGIC, NMG_GET_FU_PLANE, nmg_orientation(), NMG_VERTEXUSE_MAGIC, fpi::norm, loopuse::orientation, OT_OPPOSITE, OT_SAME, fpi::priv, fpi::pt, rt_bomb(), fpi::tol, loopuse::up, V3ARGS, V3PT_IN_RPP, V4ARGS, vertexuse::v_p, fpi::ve_dh, edge_info::ved_p, vertex::vg_p, VMOVE, void(), fpi::vu_func, and edgeuse::vu_p.

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