BRL-CAD
#include "common.h"
#include <math.h>
#include "bio.h"
#include "vmath.h"
#include "nmg.h"
#include "raytrace.h"
Include dependency graph for nmg_mesh.c:

Go to the source code of this file.

Functions

int nmg_is_angle_in_wedge (double a, double b, double t)
 
struct edge_g_lseg * nmg_pick_best_edge_g (struct edgeuse *eu1, struct edgeuse *eu2, const struct bn_tol *tol)
 
void nmg_radial_join_eu (struct edgeuse *eu1, struct edgeuse *eu2, const struct bn_tol *tol)
 
int nmg_mesh_two_faces (register struct faceuse *fu1, register struct faceuse *fu2, const struct bn_tol *tol)
 
void nmg_mesh_faces (struct faceuse *fu1, struct faceuse *fu2, const struct bn_tol *tol)
 
int nmg_mesh_face_shell (struct faceuse *fu1, struct shell *s, const struct bn_tol *tol)
 
int nmg_mesh_shell_shell (struct shell *s1, struct shell *s2, const struct bn_tol *tol)
 

Detailed Description

Meshing routines for n-Manifold Geometry. This stuff is destined to be absorbed into nmg_fuse.c. "meshing" here refers to the sorting of faceuses around an edge as two edges sharing the same end points (vertex structs) are fused.

Definition in file nmg_mesh.c.

Function Documentation

int nmg_is_angle_in_wedge ( double  a,
double  b,
double  t 
)

Determine if T lies within angle AB, such that A < T < B. The angle B is expected to be "more ccw" than A. Because of the wrap from 2pi to 0, B may have a smaller numeric value.

Returns - -2 t is equal to a -1 t is equal to b 0 t is outside angle ab 1 t is inside angle ab

Definition at line 54 of file nmg_mesh.c.

Referenced by nmg_radial_join_eu().

struct edge_g_lseg* nmg_pick_best_edge_g ( struct edgeuse *  eu1,
struct edgeuse *  eu2,
const struct bn_tol tol 
)

Given two edgeuses with different edge geometry but running between the same two vertices, select the proper edge geometry to associate with.

Really, there are 3 geometries to be compared here: the vector between the two endpoints of this edge, and the two edge_g structures. Rather than always taking eu2 or eu1, select the one that best fits this one edge.

Consider fu1: B

  • /| eg2/ | / | D/ |

| / | A *-*-—* C E eg1

At the start of a face/face intersection, eg1 runs from A to C, and eg2 runs ADB. The line of intersection with the other face (fu2, not drawn) lies along eg1. Assume that edge AC needs to be broken at E, where E is just a little more than tol->dist away from A. Existing point D is found because it is within tol->dist of E, thanks to the cosine of angle BAC. So, edge AC is broken on vertex D, and the intersection list contains vertexuses A, E, and C.

Because D and E are the same point, fu1 has become a triangle with a little "spike" on the end. If this is handled simply by re-homing edge AE to eg2, it may cause trouble, because eg1 now runs EC, but the geometry for eg1 runs AC. If there are other vertices on edge eg1, the problem can not be resolved simply by recomputing the geometry of eg1. Since E (D) is within tolerance of eg1, it is not unreasonable just to leave eg1 alone.

The issue boils down to selecting whether the existing eg1 or eg2 best represents the direction of the little stub edge AD (shared with AE). In this case, eg2 is the correct choice, as AD (and AE) lie on line AB.

It would be disastrous to force all of eg1 to use the edge geometry of eg2, as the two lines are very different.

Definition at line 129 of file nmg_mesh.c.

References BN_CK_TOL, bu_log(), rt_g::NMG_debug, and RTG.

Referenced by nmg_radial_join_eu().

Here is the call graph for this function:

void nmg_radial_join_eu ( struct edgeuse *  eu1,
struct edgeuse *  eu2,
const struct bn_tol tol 
)

Make all the edgeuses around eu2's edge to refer to eu1's edge, taking care to organize them into the proper angular orientation, so that the attached faces are correctly arranged radially around the edge.

This depends on both edges being part of face loops, with vertex and face geometry already associated.

The two edgeuses being joined might well be from separate shells, so the issue of preserving (simple) faceuse orientation parity (SAME, OPPOSITE, OPPOSITE, SAME, ...) can't be used here – that only applies to faceuses from the same shell.

Some of the edgeuses around both edges may be wires.

Call to nmg_check_radial at end has been deleted. Note that after two radial EU's have been joined a third cannot be joined to them without creating unclosed space that nmg_check_radial will find.

Definition at line 197 of file nmg_mesh.c.

References BN_CK_TOL, bn_pt3_pt3_equal(), bu_bomb(), bu_log(), code(), eu1, rt_g::NMG_debug, nmg_eu_2vecs_perp(), nmg_euprint(), NMG_FACE_G_SNURB_MAGIC, nmg_find_fu_of_eu(), nmg_find_s_of_eu(), nmg_is_angle_in_wedge(), nmg_je(), nmg_measure_fu_angle(), nmg_pick_best_edge_g(), nmg_pr_fu_around_eu_vecs(), nmg_radial_join_eu_NEW(), nmg_two_face_fuse(), nmg_use_edge_g(), RTG, and V3ARGS.

Referenced by nmg_edge_fuse(), nmg_face_state_transition(), nmg_fcut_face(), nmg_find_eg_between_2fg(), nmg_fuse_inters(), nmg_glue_face_in_shell(), nmg_isect_2colinear_edge2p(), nmg_isect_edge2p_edge2p(), and nmg_mesh_two_faces().

Here is the call graph for this function:

int nmg_mesh_two_faces ( register struct faceuse *  fu1,
register struct faceuse *  fu2,
const struct bn_tol tol 
)

Actually do the work of meshing two faces. The two fu arguments may be the same, which causes the face to be meshed against itself.

The return is the number of edges meshed.

Definition at line 479 of file nmg_mesh.c.

References BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), eu1, eu2, rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_radial_join_eu(), RTG, and V3ARGS.

Referenced by nmg_face_cutjoin(), nmg_mesh_face_shell(), nmg_mesh_faces(), and nmg_mesh_shell_shell().

Here is the call graph for this function:

void nmg_mesh_faces ( struct faceuse *  fu1,
struct faceuse *  fu2,
const struct bn_tol tol 
)

Scan through all the edges of fu1 and fu2, ensuring that all edges involving the same vertex pair are indeed shared. This means worrying about merging ("meshing") all the faces in the proper radial orientation around the edge. XXX probably should return count;

Definition at line 552 of file nmg_mesh.c.

References BN_CK_TOL, bu_log(), rt_g::NMG_debug, nmg_mesh_two_faces(), nmg_pl_2fu(), and RTG.

Here is the call graph for this function:

int nmg_mesh_face_shell ( struct faceuse *  fu1,
struct shell *  s,
const struct bn_tol tol 
)

The return is the number of edges meshed.

Definition at line 586 of file nmg_mesh.c.

References BN_CK_TOL, BU_LIST_FOR, NMG_CK_SHELL(), and nmg_mesh_two_faces().

Here is the call graph for this function:

int nmg_mesh_shell_shell ( struct shell *  s1,
struct shell *  s2,
const struct bn_tol tol 
)

Mesh every edge in shell 1 with every edge in shell 2. The return is the number of edges meshed.

Does not use nmg_mesh_face_shell() to keep face/self meshing to the absolute minimum necessary.

Definition at line 614 of file nmg_mesh.c.

References BN_CK_TOL, BU_LIST_FOR, NMG_CK_SHELL(), nmg_mesh_two_faces(), and nmg_region_v_unique().

Here is the call graph for this function: