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

Go to the source code of this file.

Macros

#define MIKE_TOL   0.0001
 

Functions

void nmg_translate_face (struct faceuse *fu, const fastf_t *Vec)
 
int nmg_extrude_face (struct faceuse *fu, const fastf_t *Vec, const struct bn_tol *tol)
 
struct vertexuse * nmg_find_vertex_in_lu (const struct vertex *v, const struct loopuse *lu)
 
void nmg_fix_overlapping_loops (struct shell *s, const struct bn_tol *tol)
 
void nmg_break_crossed_loops (struct shell *is, const struct bn_tol *tol)
 
struct shell * nmg_extrude_cleanup (struct shell *in_shell, const int is_void, const struct bn_tol *tol)
 
void nmg_hollow_shell (struct shell *s, const fastf_t thick, const int approximate, const struct bn_tol *tol)
 
struct shell * nmg_extrude_shell (struct shell *s, const fastf_t dist, const int normal_ward, const int approximate, const struct bn_tol *tol)
 

Detailed Description

Routines for extruding nmg's.

Definition in file nmg_extrude.c.

Macro Definition Documentation

#define MIKE_TOL   0.0001

Referenced by nmg_extrude_face().

Function Documentation

void nmg_translate_face ( struct faceuse *  fu,
const fastf_t Vec 
)

Translate a face using a vector's magnitude and direction.

Definition at line 93 of file nmg_extrude.c.

References bu_bomb(), bu_free(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_malloc(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl::l, lu, bu_list::magic, NMG_CK_LOOPUSE(), NMG_EDGE_G_CNURB_MAGIC, NMG_EDGE_G_LSEG_MAGIC, nmg_edge_g_tabulate(), NMG_EDGEUSE_MAGIC, nmg_face_g(), nmg_loop_plane_area(), NMG_VERTEXUSE_MAGIC, and OSL::Strings::v.

Referenced by nmg_extrude_face().

Here is the call graph for this function:

int nmg_extrude_face ( struct faceuse *  fu,
const fastf_t Vec,
const struct bn_tol tol 
)

Duplicate a given NMG face, move it by specified vector, and create a solid bounded by these faces.

Definition at line 179 of file nmg_extrude.c.

References BN_CK_TOL, bu_bomb(), bu_calloc(), bu_free(), BU_LIST_FIRST_MAGIC, BU_LIST_FOR2, bu_log(), eu2, lu, MIKE_TOL, NEAR_ZERO, nmg_calc_face_g(), nmg_cface(), NMG_CK_LOOPUSE(), nmg_dup_face(), NMG_EDGEUSE_MAGIC, nmg_gluefaces(), nmg_reverse_face(), and nmg_translate_face().

Referenced by rt_ebm_tess(), and rt_extrude_tess().

Here is the call graph for this function:

struct vertexuse* nmg_find_vertex_in_lu ( const struct vertex *  v,
const struct loopuse *  lu 
)

find a use of vertex v in loopuse lu

Definition at line 266 of file nmg_extrude.c.

References BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, and NMG_VERTEXUSE_MAGIC.

Referenced by nmg_classify_lu_lu(), nmg_fix_overlapping_loops(), and nmg_kill_anti_loops().

void nmg_fix_overlapping_loops ( struct shell *  s,
const struct bn_tol tol 
)

Looks at each faceuse in the shell and checks if loopuses in that faceuse overlap each other. This code can only handle faceuses that have at most one OT_SAME loopuse and one OT_OPPOSITE loopuse, so nmg_split_loops_into_faces is called to simplify the faceuses.

Overlapping OT_SAME and OT_OPPOSITE loops are broken into some number of OT_SAME loopuses. An edgeuse (from the OT_SAME loopuse) departing from a point where the loops intersect and outside the OT_OPPOSITE loopuse is found as a starting point. Edgeuses from this loopuse are moved to a new loopuse until another intersect point is encountered. At that point, another loop is started using the next edgeuse and the current loopuse is continued by following the other loopuse. this is continued until the original edgeuse is encountered.

If overlapping loops are found, new loopuses are created and the original loopuses are killed

Definition at line 414 of file nmg_extrude.c.

References bn_isect_lseg3_lseg3(), bu_bomb(), bu_free(), BU_LIST_APPEND, BU_LIST_DEQUEUE, BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_INSERT, BU_LIST_IS_EMPTY, BU_LIST_IS_HEAD, BU_LIST_NOT_HEAD, BU_LIST_PNEXT, bu_log(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_reset(), eu1, eu2, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), nmg_classify_pt_loop(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_find_vertex_in_lu(), nmg_klu(), nmg_kvu(), nmg_mlv(), nmg_orientation(), nmg_pr_fu_briefly(), nmg_split_loops_into_faces(), nmg_vertex_gv(), RTG, and ZERO.

Referenced by nmg_extrude_cleanup().

Here is the call graph for this function:

void nmg_break_crossed_loops ( struct shell *  is,
const struct bn_tol tol 
)

Extrusion may create crossed loops within a face. This routine intersects each edge within a loop with every other edge in the loop

Definition at line 700 of file nmg_extrude.c.

References BN_CK_TOL, bn_isect_lseg3_lseg3(), BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_NOT_HEAD, BU_LIST_PNEXT, eu1, eu2, lu, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), NMG_EDGEUSE_MAGIC, nmg_find_pt_in_shell(), nmg_vertex_gv(), and ZERO.

Here is the call graph for this function:

struct shell* nmg_extrude_cleanup ( struct shell *  in_shell,
const int  is_void,
const struct bn_tol tol 
)

Clean up after nmg_extrude_shell. intersects each face with every other face in the shell and makes new face boundaries at the intersections. decomposes the result into separate shells. where faces have intersected, new shells will be created. These shells are detected and killed

Definition at line 803 of file nmg_extrude.c.

References BN_CK_TOL, bu_bomb(), BU_LIST_FIRST, BU_LIST_FOR, BU_LIST_LAST, BU_LIST_NON_EMPTY, BU_LIST_NOT_HEAD, BU_LIST_PLAST, BU_LIST_PNEXT, bu_log(), lu, nmg_bad_face_normals(), NMG_CK_SHELL(), rt_g::NMG_debug, nmg_decompose_shell(), nmg_find_model(), nmg_fix_overlapping_loops(), nmg_isect_shell_self(), nmg_js(), nmg_kr(), nmg_ks(), nmg_loop_touches_self(), nmg_mrsv(), nmg_mv_shell_to_region(), nmg_rebound(), nmg_shell_is_void(), nmg_split_lu_at_vu(), orientation, and RTG.

Referenced by nmg_extrude_shell(), and nmg_hollow_shell().

Here is the call graph for this function:

void nmg_hollow_shell ( struct shell *  s,
const fastf_t  thick,
const int  approximate,
const struct bn_tol tol 
)

Hollows out a shell producing a wall thickness of thickness "thick" by creating a new "inner" shell and combining the two shells.

If the original shell is closed, the new shell is simply merged with the original shell. If the original shell is open, then faces are constructed along the free edges of the two shells to make a closed shell.

if approximate is non-zero, new vertex geometry at vertices where more than three faces intersect may be approximated by a point of minimum distance from the intersecting faces.

Definition at line 982 of file nmg_extrude.c.

References BN_CK_TOL, bu_bomb(), bu_calloc(), bu_free(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_ins(), lu, nmg_check_closed_shell(), NMG_CK_LOOPUSE(), NMG_CK_SHELL(), nmg_close_shell(), rt_g::NMG_debug, nmg_decompose_shell(), nmg_dup_shell(), nmg_extrude_cleanup(), nmg_find_model(), nmg_in_vert(), nmg_invert_shell(), nmg_js(), nmg_kr(), nmg_ks(), nmg_mrsv(), nmg_mv_shell_to_region(), nmg_open_shells_connect(), nmg_region_a(), nmg_shell_coplanar_face_merge(), nmg_shell_is_void(), nmg_simplify_shell(), NMG_VERTEXUSE_MAGIC, nmg_vmodel(), and RTG.

Here is the call graph for this function:

struct shell* nmg_extrude_shell ( struct shell *  s,
const fastf_t  dist,
const int  normal_ward,
const int  approximate,
const struct bn_tol tol 
)

Extrudes a shell (s) by a distance (dist) in the direction of the face normals if normal_ward, or the opposite direction if !normal_ward. The shell (s) is modified by adjusting the plane equations for each face and calculating new vertex geometry. if approximate is non-zero, new vertex geometry, for vertices where more than three faces intersect, will be approximated by a point with minimum distance from the intersecting faces. if approximate is zero, additional faces and/or edges may be added to the shell.

returns: a pointer to the modified shell on success NULL on failure

Definition at line 1181 of file nmg_extrude.c.

References BN_CK_TOL, bu_calloc(), bu_free(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_NON_EMPTY, BU_LIST_NOT_HEAD, BU_LIST_PNEXT, bu_log(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_ins(), bn_tol::dist, bu_ptbl::l, lu, bu_list::magic, NEAR_ZERO, NMG_CK_SHELL(), nmg_decompose_shell(), NMG_EDGEUSE_MAGIC, nmg_extrude_cleanup(), nmg_face_g(), nmg_find_model(), nmg_in_vert(), nmg_js(), nmg_kr(), nmg_ks(), nmg_loop_plane_area(), nmg_mrsv(), nmg_mv_shell_to_region(), nmg_pr_fu_briefly(), nmg_region_a(), nmg_shell_is_void(), nmg_vertex_tabulate(), out, s, and V3ARGS.

Here is the call graph for this function: