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

Macros

#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 /* fpi\0 */
 
#define NMG_CK_FPI(_fpi)
 
#define NMG_FPI_TOUCHED   27
 
#define NMG_FPI_MISSED   32768
 

Functions

int nmg_class_pt_fu_except (const point_t pt, const struct faceuse *fu, const struct loopuse *ignore_lu, void(*eu_func)(struct edgeuse *, point_t, const char *), void(*vu_func)(struct vertexuse *, point_t, const char *), const char *priv, const int call_on_hits, const int in_or_out_only, const struct bn_tol *tol)
 
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, const struct bn_tol *tol)
 
int nmg_class_pt_fu_except (const fastf_t *pt, const struct faceuse *fu, const struct loopuse *ignore_lu, void(*eu_func)(struct edgeuse *, point_t, const char *), void(*vu_func)(struct vertexuse *, point_t, const char *), 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.

Definition in file nmg_pt_fu.c.

Macro Definition Documentation

#define NMG_VE_DIST_MAGIC   0x102938

Definition at line 54 of file nmg_pt_fu.c.

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

Definition at line 55 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 67 of file nmg_pt_fu.c.

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

Definition at line 68 of file nmg_pt_fu.c.

Referenced by make_near_list(), and nmg_class_pt_lu_except().

#define NMG_FPI_MAGIC   12345678 /* fpi\0 */

Definition at line 82 of file nmg_pt_fu.c.

Referenced by nmg_class_pt_fu_except(), and 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)
#define BN_CK_TOL(_p)
Definition: tol.h:82
#define NMG_FPI_MAGIC
Definition: nmg_pt_fu.c:82
#define BU_CK_LIST_HEAD(_p)
Definition: list.h:142

Definition at line 83 of file nmg_pt_fu.c.

#define NMG_FPI_TOUCHED   27

Definition at line 88 of file nmg_pt_fu.c.

#define NMG_FPI_MISSED   32768

Definition at line 89 of file nmg_pt_fu.c.

Function Documentation

int nmg_class_pt_fu_except ( const point_t  pt,
const struct faceuse *  fu,
const struct loopuse *  ignore_lu,
void(*)(struct edgeuse *, point_t, const char *)  eu_func,
void(*)(struct vertexuse *, point_t, const char *)  vu_func,
const char *  priv,
const int  call_on_hits,
const int  in_or_out_only,
const struct bn_tol tol 
)
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 
)

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 127 of file nmg_pt_fu.c.

References BN_CK_TOL, and bn_tol::dist_sq.

int nmg_eu_is_part_of_crack ( const struct edgeuse *  eu)

Definition at line 276 of file nmg_pt_fu.c.

References BU_LIST_FOR, lu, NMG_CK_LOOPUSE(), and NMG_LOOPUSE_MAGIC.

Referenced by nmg_class_pt_euvu(), and nmg_split_touchingloops().

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 
)

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 319 of file nmg_pt_fu.c.

References BN_CK_TOL, bu_bomb(), BU_LIST_PNEXT_CIRC, BU_LIST_PPREV_CIRC, bu_log(), lu, NMG_CK_LOOPUSE(), nmg_class_name(), rt_g::NMG_debug, nmg_eu_is_part_of_crack(), nmg_find_eu_leftvec(), NMG_LOOPUSE_MAGIC, RTG, UNLIKELY, and V3ARGS.

Here is the call graph for this function:

HIDDEN void make_near_list ( struct edge_info edge_list,
struct bu_list near1,
const struct bn_tol tol 
)

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 732 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(), ve_dist::dist, bn_tol::dist_sq, edge_info::eu_p, edge_info::l, ve_dist::magic_p, NMG_CK_EI, NMG_CK_VED, edge_info::nmg_class, nmg_class_name(), rt_g::NMG_debug, RTG, ve_dist::status, UNLIKELY, ve_dist::v1, ve_dist::v2, V3ARGS, and edge_info::ved_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(*)(struct edgeuse *, point_t, const char *)  eu_func,
void(*)(struct vertexuse *, point_t, const char *)  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 1229 of file nmg_pt_fu.c.

References BN_CK_TOL, bu_bomb(), bu_free(), BU_LIST_DEQUEUE, BU_LIST_FOR, BU_LIST_INIT, BU_LIST_WHILE, bu_log(), bn_tol::dist, fpi::eu_func, fpi::fu_p, fpi::hits, ve_dist::l, lu, fpi::magic, NMG_CK_LOOPUSE(), nmg_class_name(), rt_g::NMG_debug, NMG_FPI_MAGIC, nmg_orientation(), nmg_pr_fu_briefly(), fpi::norm, fpi::priv, fpi::pt, RTG, fpi::tol, V3ARGS, fpi::ve_dh, and fpi::vu_func.

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 
)

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 1386 of file nmg_pt_fu.c.

References bu_bomb(), bu_free(), BU_LIST_DEQUEUE, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_INIT, BU_LIST_WHILE, bu_log(), ve_dist::dist, bn_tol::dist, bn_tol::dist_sq, fpi::eu_func, fpi::fu_p, fpi::hits, edge_info::l, ve_dist::l, fpi::magic, NMG_CK_EI, NMG_CK_LOOPUSE(), NMG_CK_VED, nmg_class_name(), rt_g::NMG_debug, NMG_FPI_MAGIC, nmg_orientation(), NMG_VERTEXUSE_MAGIC, fpi::norm, fpi::priv, fpi::pt, RTG, fpi::tol, V3ARGS, fpi::ve_dh, edge_info::ved_p, and fpi::vu_func.

Referenced by nmg_classify_lu_lu(), nmg_get_interior_pt(), nmg_is_crack_outie(), and nmg_lu_is_convex().

Here is the call graph for this function: