Compare commits
81
Commits
subprocess
...
bioh
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33747b9352 | ||
|
|
c5d8c5dabf | ||
|
|
e0838ebba7 | ||
|
|
dc1c9fe55c | ||
|
|
ba8a985ea2 | ||
|
|
f1eda66b84 | ||
|
|
4cc15c7035 | ||
|
|
17618118f0 | ||
|
|
04f6955b9d | ||
|
|
009f76571e | ||
|
|
52377f751a | ||
|
|
1777062f31 | ||
|
|
006aaffca0 | ||
|
|
dd847031f6 | ||
|
|
c17292818a | ||
|
|
2da8af9789 | ||
|
|
61d56d87a4 | ||
|
|
1d14a54691 | ||
|
|
0a591ef8bf | ||
|
|
4bfd4640f6 | ||
|
|
f4fc5d6402 | ||
|
|
ba972de5e8 | ||
|
|
e8c752fcda | ||
|
|
7d7ba6a3b9 | ||
|
|
2c3d337af5 | ||
|
|
707bbf4e5d | ||
|
|
3ecd5bfd25 | ||
|
|
000dcd9794 | ||
|
|
13ffbd3b83 | ||
|
|
c96847b0a8 | ||
|
|
b06f3c7392 | ||
|
|
195fa3ff37 | ||
|
|
eaf340864a | ||
|
|
046ef48a3f | ||
|
|
1f5cad2ce4 | ||
|
|
a00f28d3fc | ||
|
|
9f1a2d7917 | ||
|
|
6c94f5f7a5 | ||
|
|
d1379db2f1 | ||
|
|
7aa120c5f5 | ||
|
|
90b17fe02f | ||
|
|
b1608a18b4 | ||
|
|
0848769c0e | ||
|
|
0db64350e1 | ||
|
|
8adf0647df | ||
|
|
1d40696801 | ||
|
|
32b6760e16 | ||
|
|
2ef0c32ecb | ||
|
|
17bd59492c | ||
|
|
b38dccf59f | ||
|
|
cafcdb708c | ||
|
|
776c21826f | ||
|
|
94822ecf88 | ||
|
|
320875f574 | ||
|
|
5cc4ec40ee | ||
|
|
164c090371 | ||
|
|
91aafbfd0f | ||
|
|
2958f58b92 | ||
|
|
58e114000d | ||
|
|
3a3a00bfee | ||
|
|
f8c2ac4818 | ||
|
|
f05e0c2437 | ||
|
|
36ed9d91f3 | ||
|
|
e8cd12b559 | ||
|
|
233623ff01 | ||
|
|
e2799171c8 | ||
|
|
0fcffe1963 | ||
|
|
629b413d06 | ||
|
|
1da1b384d0 | ||
|
|
9b8040fd53 | ||
|
|
5f0b46a0cb | ||
|
|
43782837d2 | ||
|
|
f99a74e0ad | ||
|
|
fc9f9bc65a | ||
|
|
ac85b9fa25 | ||
|
|
e739b5f4b4 | ||
|
|
755e9422cb | ||
|
|
f852e42b38 | ||
|
|
da7723a7f1 | ||
|
|
4117a9f897 | ||
|
|
aabb85e549 |
@@ -11,6 +11,7 @@ set(bg_headers
|
||||
tri_ray.h
|
||||
tri_tri.h
|
||||
trimesh.h
|
||||
vlist.h
|
||||
)
|
||||
BRLCAD_MANAGE_FILES(bg_headers ${INCLUDE_DIR}/brlcad/bg)
|
||||
|
||||
|
||||
@@ -0,0 +1,291 @@
|
||||
/* V L I S T . H
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 2004-2020 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
|
||||
#ifndef BG_VLIST_H
|
||||
#define BG_VLIST_H
|
||||
|
||||
#include "common.h"
|
||||
#include <stdio.h> /* for FILE */
|
||||
#include "vmath.h"
|
||||
#include "bu/magic.h"
|
||||
#include "bu/vls.h"
|
||||
#include "bg/defines.h"
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/** @addtogroup bg_vlist
|
||||
*
|
||||
* @brief
|
||||
* Definitions for handling lists of vectors (really vertices, or
|
||||
* points) and polygons in 3-space. Intended for common handling of
|
||||
* wireframe display information, in the full resolution that is
|
||||
* calculated in.
|
||||
*/
|
||||
/** @{ */
|
||||
/** @file bg/vlist.h */
|
||||
|
||||
/* Opaque container that stores unused vlists for re-use */
|
||||
struct bg_vlist_queue_impl;
|
||||
struct bg_vlist_queue {
|
||||
struct bg_vlist_queue_impl *i;
|
||||
};
|
||||
|
||||
/* Establish a queue to hold free vlist entries - generally, this is the first
|
||||
* object to create when working with vlists. */
|
||||
BG_EXPORT extern struct bg_vlist_queue *
|
||||
bg_vlist_queue_create();
|
||||
|
||||
/* Remove a vlist queue. Will invalidate all queue-related vlist operations
|
||||
* using this queue - generally, this is the last object to free. */
|
||||
BG_EXPORT extern void
|
||||
bg_vlist_queue_destroy(struct bg_vlist_queue *);
|
||||
|
||||
|
||||
/* Opaque container that stores bg_vlists. Used internally - not manipulated
|
||||
* by calling applications. The caller may associate a bg_vlist_queue with one
|
||||
* or more vlists. If there is a queue associated:
|
||||
*
|
||||
* 1. Point/cmd additions will first use memory from the queue - only if
|
||||
* none are available will new entities be allocated.
|
||||
* 2. A bg_vlist_destroy call will place the internal memory in the queue,
|
||||
* rather than freeing it.
|
||||
*
|
||||
* TODO: multithreaded operations using bg_vlists with a queue are not
|
||||
* currently supported. Should be able to make that work transparently
|
||||
* from the caller's perspective...
|
||||
*/
|
||||
struct bg_vlist_impl;
|
||||
struct bg_vlist {
|
||||
struct bg_vlist_impl *i;
|
||||
};
|
||||
|
||||
/* q is where to get/put free vlist entries - if NULL, all memory is managed
|
||||
* locally in this specific vlist */
|
||||
BG_EXPORT extern struct bg_vlist *
|
||||
bg_vlist_create(struct bg_vlist_queue *q);
|
||||
|
||||
/* destroy vlist - do this for all vlists using a queue before destroying the
|
||||
* queue */
|
||||
BG_EXPORT extern void
|
||||
bg_vlist_destroy(struct bg_vlist *l);
|
||||
|
||||
|
||||
/* Values for cmd[] */
|
||||
typedef enum {
|
||||
/* Points */
|
||||
BG_VLIST_POINT_DRAW, /**< @brief Draw a single point */
|
||||
BG_VLIST_POINT_SIZE, /**< @brief specify point pixel size */
|
||||
/* Wireframes */
|
||||
BG_VLIST_LINE_MOVE, /**< @brief specify new line */
|
||||
BG_VLIST_LINE_DRAW, /**< @brief subsequent line vertex */
|
||||
BG_VLIST_LINE_WIDTH, /**< @brief specify line pixel width */
|
||||
/* Triangles */
|
||||
BG_VLIST_TRI_NORM, /**< @brief pt[] has surface normal */
|
||||
BG_VLIST_TRI_MOVE, /**< @brief move to first triangle vertex */
|
||||
BG_VLIST_TRI_DRAW, /**< @brief subsequent triangle vertex */
|
||||
BG_VLIST_TRI_END, /**< @brief last vert (repeats 1st), draw poly */
|
||||
BG_VLIST_TRI_VERTNORM, /**< @brief per-vertex normal, for interpolation */
|
||||
/* Polygons */
|
||||
BG_VLIST_POLY_NORM, /**< @brief pt[] has surface normal */
|
||||
BG_VLIST_POLY_MOVE, /**< @brief move to first poly vertex */
|
||||
BG_VLIST_POLY_DRAW, /**< @brief subsequent poly vertex */
|
||||
BG_VLIST_POLY_END, /**< @brief last vert (repeats 1st), draw poly */
|
||||
BG_VLIST_POLY_VERTNORM, /**< @brief per-vertex normal, for interpolation */
|
||||
/* Display Modes */
|
||||
BG_VLIST_DISPLAY_MAT, /**< @brief specify the model matrix */
|
||||
BG_VLIST_MODEL_MAT, /**< @brief specify the display matrix */
|
||||
BG_VLIST_NULL /**< @brief no-op command */
|
||||
} bg_vlist_cmd_t;
|
||||
|
||||
/* The vlist specification is serial and state based - if a matrix or point
|
||||
* size is set via command, it applies to the points/segments defined after that
|
||||
* command is introduced. */
|
||||
|
||||
BG_EXPORT extern size_t
|
||||
bg_vlist_npts(struct bg_vlist *v);
|
||||
|
||||
BG_EXPORT extern size_t
|
||||
bg_vlist_ncmds(struct bg_vlist *v);
|
||||
|
||||
BG_EXPORT extern int
|
||||
bg_vlist_append(struct bg_vlist *v, bg_vlist_cmd_t cmd, point_t *p);
|
||||
|
||||
BG_EXPORT extern int
|
||||
bg_vlist_insert(struct bg_vlist *v, size_t i, bg_vlist_cmd_t cmd, point_t *p);
|
||||
|
||||
BG_EXPORT extern bg_vlist_cmd_t
|
||||
bg_vlist_get(point_t *op, struct bg_vlist *v, size_t i);
|
||||
|
||||
BG_EXPORT extern int
|
||||
bg_vlist_set(struct bg_vlist *v, size_t i, point_t *op, bg_vlist_cmd_t cmd);
|
||||
|
||||
BG_EXPORT extern size_t
|
||||
bg_vlist_find(struct bg_vlist *v, size_t start_ind, bg_vlist_cmd_t cmd, point_t *p);
|
||||
|
||||
BG_EXPORT extern int
|
||||
bg_vlist_rm(struct bg_vlist *v, size_t i);
|
||||
|
||||
/* Analytic functions */
|
||||
|
||||
/* Returns the index of the closest point in the vlist to the test point. If
|
||||
* cp is not NULL, also calculates and returns the closest point on the vlist
|
||||
* polylines. */
|
||||
BG_EXPORT extern long
|
||||
bg_vlist_closest_pt(point_t *cp, struct bg_vlist *v, point_t *tp);
|
||||
|
||||
/* Calculate and return the bounding box and polyline length of the vlist */
|
||||
BG_EXPORT extern int
|
||||
bg_vlist_bbox(point_t *bmin, point_t *bmax, double *poly_length, struct bg_vlist *v);
|
||||
|
||||
/**
|
||||
* Convert a string to a vlist.
|
||||
*
|
||||
* 'scale' is the width, in mm, of one character.
|
||||
*
|
||||
* @param vhead vhead
|
||||
* @param free_hd source of free vlists
|
||||
* @param string string of chars to be plotted
|
||||
* @param origin lower left corner of 1st char
|
||||
* @param rot Transform matrix (WARNING: may xlate)
|
||||
* @param scale scale factor to change 1x1 char sz
|
||||
*
|
||||
*/
|
||||
BG_EXPORT extern struct bg_vlist *
|
||||
bg_vlist_3string(
|
||||
const char *string,
|
||||
const point_t origin,
|
||||
const mat_t rot,
|
||||
double scale,
|
||||
struct bg_vlist_queue *q
|
||||
);
|
||||
|
||||
/**
|
||||
* Convert string to vlist in 2D
|
||||
*
|
||||
* A simpler interface, for those cases where the text lies in the X-Y
|
||||
* plane.
|
||||
*
|
||||
* @param vhead vhead
|
||||
* @param free_hd source of free vlists
|
||||
* @param string string of chars to be plotted
|
||||
* @param x lower left corner of 1st char
|
||||
* @param y lower left corner of 1st char
|
||||
* @param scale scale factor to change 1x1 char sz
|
||||
* @param theta degrees ccw from X-axis
|
||||
*
|
||||
*/
|
||||
BG_EXPORT extern struct bg_vlist *
|
||||
bg_vlist_2string(
|
||||
const char *string,
|
||||
double x,
|
||||
double y,
|
||||
double scale,
|
||||
double theta,
|
||||
struct bg_vlist_queue *q
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns string description of a vlist cmd.
|
||||
*/
|
||||
BG_EXPORT extern const char *
|
||||
bg_vlist_cmd_str(bg_vlist_cmd_t cmd);
|
||||
|
||||
/**
|
||||
* Validate an bg_vlist chain for having reasonable values inside.
|
||||
*
|
||||
* Returns -
|
||||
* Number of point/command sets in use or -1 if invalid.
|
||||
*/
|
||||
BG_EXPORT extern long
|
||||
bg_vlist_valid(const struct bu_list *vhead);
|
||||
|
||||
|
||||
/**
|
||||
* Duplicate the contents of a vlist. Note that the copy may be more
|
||||
* densely packed than the source.
|
||||
*/
|
||||
BG_EXPORT extern void
|
||||
bg_vlist_copy(struct bg_vlist *dest, const struct bg_vlist *src);
|
||||
|
||||
|
||||
/**
|
||||
* Convert a vlist chain into a blob of network-independent binary,
|
||||
* for transmission to another machine.
|
||||
*
|
||||
* The result is stored in a vls string, so that both the address and
|
||||
* length are available conveniently.
|
||||
*/
|
||||
BG_EXPORT extern void
|
||||
bg_vlist_export(
|
||||
struct bu_vls *vls,
|
||||
struct bg_vlist *v,
|
||||
const char *name
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Convert a blob of network-independent binary prepared by
|
||||
* vls_vlist() and received from another machine, into a vlist chain.
|
||||
*/
|
||||
BG_EXPORT extern void
|
||||
bg_vlist_import(
|
||||
struct bg_vlist *vout,
|
||||
struct bg_vlist_queue *q,
|
||||
struct bu_vls *input
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Output a bg_vlblock object in extended UNIX-plot format, including
|
||||
* color.
|
||||
*/
|
||||
BG_EXPORT extern void
|
||||
bg_vlblock_plot3(
|
||||
FILE *fp,
|
||||
const struct bg_vlblock *vbp
|
||||
);
|
||||
|
||||
/**
|
||||
* Output a vlist as an extended 3-D floating point UNIX-Plot file.
|
||||
* You provide the file. Uses libplot3 routines to create the
|
||||
* UNIX-Plot output.
|
||||
*/
|
||||
BG_EXPORT extern void
|
||||
bg_vlist_plot3(
|
||||
FILE *fp,
|
||||
const struct bu_list *vhead
|
||||
);
|
||||
|
||||
/** @} */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* BG_VLIST_H */
|
||||
/** @} */
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -33,6 +33,7 @@
|
||||
#define DM_BVIEW_H
|
||||
|
||||
#include "common.h"
|
||||
#include "bu/color.h"
|
||||
#include "bu/list.h"
|
||||
#include "bu/vls.h"
|
||||
#include "bu/observer.h"
|
||||
@@ -254,6 +255,7 @@ struct bview {
|
||||
size_t gv_bot_threshold;
|
||||
int gv_hidden;
|
||||
void *dmp; /* Display manager pointer, if one is associated with this view */
|
||||
void *objs; /* Stub - intended eventually to point to an RTree with the bview_objs associated with the view */
|
||||
void *u_data; /* Caller data associated with this view */
|
||||
struct bu_ptbl *callbacks;
|
||||
};
|
||||
@@ -270,6 +272,28 @@ struct bview_solid_data {
|
||||
void *freesolid;
|
||||
};
|
||||
|
||||
|
||||
/* Conceptually this is intended to eventually replace parts of struct solid,
|
||||
* bview_solid_data and bn_vlblock. */
|
||||
#define BVIEW_OBJ_DEFAULT 0
|
||||
#define BVIEW_OBJ_DISABLE 1ULL << 0
|
||||
#define BVIEW_OBJ_ILLUM 1ULL << 1
|
||||
#define BVIEW_OBJ_DASHED 1ULL << 2
|
||||
#define BVIEW_OBJ_WIREFRAME 1ULL << 3
|
||||
#define BVIEW_OBJ_SHADED 1ULL << 4
|
||||
#define BVIEW_OBJ_HIDDEN_LINE 1ULL << 5
|
||||
#define BVIEW_OBJ_TRANSP 1ULL << 6
|
||||
|
||||
struct bview_obj {
|
||||
struct bu_vls name; /**< @brief Unique object name */
|
||||
void *shape_data; /**< @brief Associated shape data (usually vlist) */
|
||||
struct bu_color c; /**< @brief Color used for drawing */
|
||||
unsigned long long flags; /**< @brief Visualization related flags */
|
||||
double transparency; /**< @brief holds a transparency value in the range [0.0, 1.0] */
|
||||
struct bview *bv; /**< @brief Associated bview (if any) */
|
||||
void *u_data; /**< @brief User data associated with this object */
|
||||
};
|
||||
|
||||
#endif /* DM_BVIEW_H */
|
||||
|
||||
/** @} */
|
||||
|
||||
+4
-55
@@ -116,73 +116,21 @@ struct ged_callback_state;
|
||||
#define INV_GED 0.00048828125
|
||||
#define INV_4096 0.000244140625
|
||||
|
||||
/* FIXME: leftovers from dg.h */
|
||||
#define RT_VDRW_PREFIX "_VDRW"
|
||||
#define RT_VDRW_PREFIX_LEN 6
|
||||
#define RT_VDRW_MAXNAME 31
|
||||
#define RT_VDRW_DEF_COLOR 0xffff00
|
||||
|
||||
|
||||
struct ged_subprocess {
|
||||
uint32_t magic; /**< @brief magic number */
|
||||
struct bu_process *p;
|
||||
void *chan;
|
||||
int aborted;
|
||||
int done;
|
||||
struct ged *gedp;
|
||||
int stdin_active;
|
||||
int stdout_active;
|
||||
int stderr_active;
|
||||
};
|
||||
|
||||
/* FIXME: should be private */
|
||||
struct ged_qray_color {
|
||||
unsigned char r;
|
||||
unsigned char g;
|
||||
unsigned char b;
|
||||
};
|
||||
|
||||
/* FIXME: should be private */
|
||||
struct ged_qray_fmt {
|
||||
char type;
|
||||
struct bu_vls fmt;
|
||||
};
|
||||
|
||||
struct vd_curve {
|
||||
struct bu_list l;
|
||||
char vdc_name[RT_VDRW_MAXNAME+1]; /**< @brief name array */
|
||||
long vdc_rgb; /**< @brief color */
|
||||
struct bu_list vdc_vhd; /**< @brief head of list of vertices */
|
||||
};
|
||||
#define VD_CURVE_NULL ((struct vd_curve *)NULL)
|
||||
|
||||
/* FIXME: should be private */
|
||||
struct ged_drawable {
|
||||
struct bu_list *gd_headDisplay; /**< @brief head of display list */
|
||||
struct bu_list *gd_headVDraw; /**< @brief head of vdraw list */
|
||||
struct vd_curve *gd_currVHead; /**< @brief current vdraw head */
|
||||
|
||||
char **gd_rt_cmd; /* DEPRECATED - will be removed, do not use */
|
||||
int gd_rt_cmd_len; /* DEPRECATED - will be removed, do not use */
|
||||
|
||||
void (*gd_rtCmdNotify)(int aborted); /**< @brief function called when rt command completes */
|
||||
|
||||
int gd_uplotOutputMode; /**< @brief output mode for unix plots */
|
||||
|
||||
/* qray state */
|
||||
struct bu_vls gd_qray_basename; /**< @brief basename of query ray vlist */
|
||||
struct bu_vls gd_qray_script; /**< @brief query ray script */
|
||||
char gd_qray_effects; /**< @brief t for text, g for graphics or b for both */
|
||||
int gd_qray_cmd_echo; /**< @brief 0 - don't echo command, 1 - echo command */
|
||||
struct ged_qray_fmt *gd_qray_fmts;
|
||||
struct ged_qray_color gd_qray_odd_color;
|
||||
struct ged_qray_color gd_qray_even_color;
|
||||
struct ged_qray_color gd_qray_void_color;
|
||||
struct ged_qray_color gd_qray_overlap_color;
|
||||
int gd_shaded_mode; /**< @brief 1 - draw bots shaded by default */
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct ged_drawable;
|
||||
GED_EXPORT struct bu_list *ged_drawable_head_dl(struct ged *gedp);
|
||||
|
||||
struct ged_cmd;
|
||||
|
||||
@@ -276,6 +224,7 @@ struct ged {
|
||||
void *ged_io_data; /**< brief caller supplied data */
|
||||
|
||||
// Other callbacks...
|
||||
void (*ged_rtCmdNotify)(int aborted); /**< @brief function called when rt command completes */
|
||||
// Tcl command strings - these are libtclcad level callbacks that execute user supplied Tcl commands if set:
|
||||
// gdv_callback, gdv_edit_motion_delta_callback, go_more_args_callback, go_rt_end_callback
|
||||
//
|
||||
|
||||
+10
-24
@@ -32,49 +32,35 @@
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
/**
|
||||
* Definitions for librt.a which are global to the library regardless
|
||||
* of how many different models are being worked on
|
||||
*/
|
||||
struct rt_g {
|
||||
/* DEPRECATED: rtg_parallel is not used by LIBRT any longer (and will be removed) */
|
||||
int8_t rtg_parallel; /**< @brief !0 = trying to use multi CPUs */
|
||||
struct bu_list rtg_vlfree; /**< @brief head of bn_vlist freelist */
|
||||
struct rt_wdb rtg_headwdb; /**< @brief head of database object list */
|
||||
};
|
||||
#define RT_G_INIT_ZERO { 0, BU_LIST_INIT_ZERO, RT_WDB_INIT_ZERO }
|
||||
|
||||
/**
|
||||
* global ray-trace geometry state
|
||||
*/
|
||||
RT_EXPORT extern struct rt_g RTG;
|
||||
/* head of LIBRT global bn_vlist freelist */
|
||||
RT_EXPORT extern struct bu_list rtg_vlfree; /**< @brief head of bn_vlist freelist */
|
||||
|
||||
/**
|
||||
* Applications that are going to use RT_ADD_VLIST and RT_GET_VLIST
|
||||
* are required to execute this macro once, first:
|
||||
*
|
||||
* BU_LIST_INIT(&RTG.rtg_vlfree);
|
||||
* BU_LIST_INIT(&rtg_vlfree);
|
||||
*
|
||||
* Note that RT_GET_VLIST and RT_FREE_VLIST are non-PARALLEL.
|
||||
*/
|
||||
#define RT_GET_VLIST(p) BN_GET_VLIST(&RTG.rtg_vlfree, p)
|
||||
#define RT_GET_VLIST(p) BN_GET_VLIST(&rtg_vlfree, p)
|
||||
|
||||
/** Place an entire chain of bn_vlist structs on the freelist */
|
||||
#define RT_FREE_VLIST(hd) BN_FREE_VLIST(&RTG.rtg_vlfree, hd)
|
||||
#define RT_FREE_VLIST(hd) BN_FREE_VLIST(&rtg_vlfree, hd)
|
||||
|
||||
#define RT_ADD_VLIST(hd, pnt, draw) BN_ADD_VLIST(&RTG.rtg_vlfree, hd, pnt, draw)
|
||||
#define RT_ADD_VLIST(hd, pnt, draw) BN_ADD_VLIST(&rtg_vlfree, hd, pnt, draw)
|
||||
|
||||
/** set the transformation matrix to display matrix */
|
||||
#define RT_VLIST_SET_DISP_MAT(_dest_hd, _ref_pt) BN_VLIST_SET_DISP_MAT(&RTG.rtg_vlfree, _dest_hd, _ref_pt)
|
||||
#define RT_VLIST_SET_DISP_MAT(_dest_hd, _ref_pt) BN_VLIST_SET_DISP_MAT(&rtg_vlfree, _dest_hd, _ref_pt)
|
||||
|
||||
/** set the transformation matrix to model matrix */
|
||||
#define RT_VLIST_SET_MODEL_MAT(_dest_hd) BN_VLIST_SET_MODEL_MAT(&RTG.rtg_vlfree, _dest_hd)
|
||||
#define RT_VLIST_SET_MODEL_MAT(_dest_hd) BN_VLIST_SET_MODEL_MAT(&rtg_vlfree, _dest_hd)
|
||||
|
||||
/** Set a point size to apply to the vlist elements that follow. */
|
||||
#define RT_VLIST_SET_POINT_SIZE(hd, size) BN_VLIST_SET_POINT_SIZE(&RTG.rtg_vlfree, hd, size)
|
||||
#define RT_VLIST_SET_POINT_SIZE(hd, size) BN_VLIST_SET_POINT_SIZE(&rtg_vlfree, hd, size)
|
||||
|
||||
/** Set a line width to apply to the vlist elements that follow. */
|
||||
#define RT_VLIST_SET_LINE_WIDTH(hd, width) BN_VLIST_SET_LINE_WIDTH(&RTG.rtg_vlfree, hd, width)
|
||||
#define RT_VLIST_SET_LINE_WIDTH(hd, width) BN_VLIST_SET_LINE_WIDTH(&rtg_vlfree, hd, width)
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
||||
Regular → Executable
Regular → Executable
+2
-2
@@ -219,7 +219,7 @@ nmg_to_adrt_gcvwrite(struct nmgregion *r, const struct db_full_path *pathp, int
|
||||
NMG_CK_MODEL(m);
|
||||
|
||||
/* triangulate model */
|
||||
nmg_triangulate_model(m, &RTG.rtg_vlfree, &tol);
|
||||
nmg_triangulate_model(m, &rtg_vlfree, &tol);
|
||||
|
||||
/* FIXME: where is this released? */
|
||||
BU_ALLOC(mesh, struct adrt_mesh_s);
|
||||
@@ -272,7 +272,7 @@ load_g(struct tie_s *tie, const char *db, int argc, const char **argv, struct ad
|
||||
|
||||
/* make empty NMG model */
|
||||
the_model = nmg_mm();
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree); /* for vlist macros */
|
||||
BU_LIST_INIT(&rtg_vlfree); /* for vlist macros */
|
||||
|
||||
/*
|
||||
* these should probably encode so the result can be passed back to client
|
||||
|
||||
@@ -1579,7 +1579,6 @@ main(int argc, char *argv[])
|
||||
|
||||
rewind(ifp);
|
||||
bu_vls_trunc(&line, 0);
|
||||
BU_LIST_INIT(&RTG.rtg_headwdb.l);
|
||||
|
||||
interp = Tcl_CreateInterp();
|
||||
tret = tclcad_init(interp, 0, &msg);
|
||||
|
||||
@@ -193,7 +193,7 @@ nmg_to_dxf(struct nmgregion *r, const struct db_full_path *pathp, int UNUSED(reg
|
||||
triangulate:
|
||||
if (do_triangulate) {
|
||||
/* triangulate model */
|
||||
nmg_triangulate_model(m, &RTG.rtg_vlfree, &tol);
|
||||
nmg_triangulate_model(m, &rtg_vlfree, &tol);
|
||||
|
||||
/* Count triangles */
|
||||
tri_count = 0;
|
||||
@@ -216,7 +216,7 @@ nmg_to_dxf(struct nmgregion *r, const struct db_full_path *pathp, int UNUSED(reg
|
||||
}
|
||||
}
|
||||
|
||||
nmg_vertex_tabulate(&verts, &r->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_vertex_tabulate(&verts, &r->l.magic, &rtg_vlfree);
|
||||
|
||||
color_num = find_closest_color(color);
|
||||
|
||||
@@ -410,7 +410,7 @@ main(int argc, char *argv[])
|
||||
tol.perp = 1e-6;
|
||||
tol.para = 1 - tol.perp;
|
||||
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree); /* for vlist macros */
|
||||
BU_LIST_INIT(&rtg_vlfree); /* for vlist macros */
|
||||
|
||||
/* Get command line arguments. */
|
||||
while ((c = bu_getopt(argc, argv, "a:n:o:pr:vx:D:P:X:ih?")) != -1) {
|
||||
|
||||
+4
-4
@@ -102,11 +102,11 @@ nmg_to_acad(struct nmgregion *r, const struct db_full_path *pathp, int region_id
|
||||
NMG_CK_MODEL(m);
|
||||
|
||||
/* triangulate model */
|
||||
nmg_triangulate_model(m, &RTG.rtg_vlfree, &tol);
|
||||
nmg_triangulate_model(m, &rtg_vlfree, &tol);
|
||||
|
||||
|
||||
/* list all vertices in result */
|
||||
nmg_vertex_tabulate(&verts, &r->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_vertex_tabulate(&verts, &r->l.magic, &rtg_vlfree);
|
||||
|
||||
/* Get number of vertices */
|
||||
|
||||
@@ -280,7 +280,7 @@ process_region(const struct db_full_path *pathp, union tree *curtree, struct db_
|
||||
|
||||
printf("Attempting to process region %s\n", db_path_to_string(pathp));
|
||||
fflush(stdout);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &RTG.rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
if (ret_tree != curtree) {
|
||||
db_free_tree(curtree, &rt_uniresource);
|
||||
}
|
||||
@@ -506,7 +506,7 @@ main(int argc, char **argv)
|
||||
tol.para = 1 - tol.perp;
|
||||
|
||||
the_model = nmg_mm();
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree); /* for vlist macros */
|
||||
BU_LIST_INIT(&rtg_vlfree); /* for vlist macros */
|
||||
|
||||
/* Get command line arguments. */
|
||||
while ((c = bu_getopt(argc, argv, "a:n:o:r:vx:D:P:X:e:ih?")) != -1) {
|
||||
|
||||
+2
-2
@@ -85,7 +85,7 @@ nmg_to_egg(struct nmgregion *r, const struct db_full_path *pathp, int UNUSED(reg
|
||||
NMG_CK_MODEL(m);
|
||||
|
||||
/* triangulate model */
|
||||
nmg_triangulate_model(m, &RTG.rtg_vlfree, &conv_data->tol);
|
||||
nmg_triangulate_model(m, &rtg_vlfree, &conv_data->tol);
|
||||
|
||||
/* Write pertinent info for this region */
|
||||
fprintf(conv_data->fp, " <VertexPool> %s {\n", (region_name+1));
|
||||
@@ -223,7 +223,7 @@ main(int argc, char *argv[])
|
||||
|
||||
/* make empty NMG model */
|
||||
the_model = nmg_mm();
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree); /* for vlist macros */
|
||||
BU_LIST_INIT(&rtg_vlfree); /* for vlist macros */
|
||||
|
||||
/* Get command line arguments. */
|
||||
while ((i = bu_getopt(argc, argv, "a:89n:o:r:vx:D:P:X:h?")) != -1) {
|
||||
|
||||
+4
-4
@@ -91,7 +91,7 @@ nmg_to_nff(struct nmgregion *r, const struct db_full_path *pathp, int UNUSED(reg
|
||||
NMG_CK_MODEL(m);
|
||||
|
||||
/* triangulate model */
|
||||
nmg_triangulate_model(m, &RTG.rtg_vlfree, &tol);
|
||||
nmg_triangulate_model(m, &rtg_vlfree, &tol);
|
||||
|
||||
/* output triangles */
|
||||
for (BU_LIST_FOR(s, shell, &r->s_hd)) {
|
||||
@@ -183,8 +183,8 @@ process_boolean(union tree *curtree, struct db_tree_state *tsp, const struct db_
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
|
||||
(void)nmg_model_fuse(*tsp->ts_m, &RTG.rtg_vlfree, tsp->ts_tol);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &RTG.rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
(void)nmg_model_fuse(*tsp->ts_m, &rtg_vlfree, tsp->ts_tol);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
|
||||
} else {
|
||||
/* catch */
|
||||
@@ -388,7 +388,7 @@ main(int argc, char *argv[])
|
||||
tol.para = 1 - tol.perp;
|
||||
|
||||
the_model = nmg_mm();
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree); /* for vlist macros */
|
||||
BU_LIST_INIT(&rtg_vlfree); /* for vlist macros */
|
||||
|
||||
/* Get command line arguments. */
|
||||
while ((c = bu_getopt(argc, argv, "a:n:o:r:vx:D:X:e:ih?")) != -1) {
|
||||
|
||||
+6
-6
@@ -214,7 +214,7 @@ main(int argc, const char **argv)
|
||||
tol.para = 1 - tol.perp;
|
||||
|
||||
the_model = nmg_mm();
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree); /* for vlist macros */
|
||||
BU_LIST_INIT(&rtg_vlfree); /* for vlist macros */
|
||||
|
||||
/* Get command line arguments. */
|
||||
++argv; --argc;
|
||||
@@ -321,17 +321,17 @@ nmg_to_obj(struct nmgregion *r, const struct db_full_path *pathp, int UNUSED(reg
|
||||
NMG_CK_MODEL(m);
|
||||
|
||||
/* triangulate model */
|
||||
nmg_triangulate_model(m, &RTG.rtg_vlfree, &tol);
|
||||
nmg_triangulate_model(m, &rtg_vlfree, &tol);
|
||||
|
||||
/* list all vertices in result */
|
||||
nmg_vertex_tabulate(&verts, &r->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_vertex_tabulate(&verts, &r->l.magic, &rtg_vlfree);
|
||||
|
||||
/* Get number of vertices */
|
||||
numverts = BU_PTBL_LEN(&verts);
|
||||
|
||||
/* get list of vertexuse normals */
|
||||
if (do_normals)
|
||||
nmg_vertexuse_normal_tabulate(&norms, &r->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_vertexuse_normal_tabulate(&norms, &r->l.magic, &rtg_vlfree);
|
||||
|
||||
/* BEGIN CHECK SECTION */
|
||||
/* Check vertices */
|
||||
@@ -569,8 +569,8 @@ process_boolean(union tree *curtree, struct db_tree_state *tsp, const struct db_
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
|
||||
(void)nmg_model_fuse(*tsp->ts_m, &RTG.rtg_vlfree, tsp->ts_tol);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &RTG.rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
(void)nmg_model_fuse(*tsp->ts_m, &rtg_vlfree, tsp->ts_tol);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
|
||||
} else {
|
||||
/* catch */
|
||||
|
||||
+15
-15
@@ -164,7 +164,7 @@ static int bot=0;
|
||||
nmg_vertex_gv(*_v[1], _ep1->pt); \
|
||||
if (!(*_v[2])->vg_p) \
|
||||
nmg_vertex_gv(*_v[2], _ep2->pt); \
|
||||
if (nmg_calc_face_g(_fu,&RTG.rtg_vlfree)) { \
|
||||
if (nmg_calc_face_g(_fu,&rtg_vlfree)) { \
|
||||
if (debug > 3) \
|
||||
bu_log("Killing degenerate face\n"); \
|
||||
(void)nmg_kfu(_fu); \
|
||||
@@ -199,7 +199,7 @@ static int bot=0;
|
||||
nmg_vertex_gv(*_v[2], _ep2->pt); \
|
||||
if (!(*_v[3])->vg_p) \
|
||||
nmg_vertex_gv(*_v[3], _ep3->pt); \
|
||||
if (nmg_calc_face_g(_fu,&RTG.rtg_vlfree)) { \
|
||||
if (nmg_calc_face_g(_fu,&rtg_vlfree)) { \
|
||||
if (debug > 3) \
|
||||
bu_log("Killing degenerate face\n"); \
|
||||
(void)nmg_kfu(_fu); \
|
||||
@@ -431,7 +431,7 @@ Get_extremes(struct shell *s, struct application *ap, struct hitmiss **hitmiss,
|
||||
VINVDIR(rd.rd_invdir, rp->r_dir);
|
||||
rd.magic = NMG_RAY_DATA_MAGIC;
|
||||
|
||||
nmg_isect_ray_model((struct nmg_ray_data *)&rd,&RTG.rtg_vlfree);
|
||||
nmg_isect_ray_model((struct nmg_ray_data *)&rd,&rtg_vlfree);
|
||||
|
||||
if (BU_LIST_IS_EMPTY(&rd.rd_hit))
|
||||
ret = 0;
|
||||
@@ -674,7 +674,7 @@ shrink_hit(struct application *ap, struct partition *PartHeadp, struct seg *UNUS
|
||||
if (fu->orientation != OT_SAME)
|
||||
continue;
|
||||
|
||||
nmg_calc_face_g(fu,&RTG.rtg_vlfree);
|
||||
nmg_calc_face_g(fu,&rtg_vlfree);
|
||||
f = fu->f_p;
|
||||
nmg_face_bb(f, &tol);
|
||||
|
||||
@@ -719,7 +719,7 @@ shrink_hit(struct application *ap, struct partition *PartHeadp, struct seg *UNUS
|
||||
if (fu->orientation != OT_SAME)
|
||||
continue;
|
||||
|
||||
nmg_calc_face_g(fu,&RTG.rtg_vlfree);
|
||||
nmg_calc_face_g(fu,&rtg_vlfree);
|
||||
f = fu->f_p;
|
||||
nmg_face_bb(f, &tol);
|
||||
|
||||
@@ -938,7 +938,7 @@ Split_side_faces(struct shell *s, struct bu_ptbl *tab)
|
||||
if (vu1_cut->v_p == eu1->eumate_p->vu_p->v_p)
|
||||
eu1 = BU_LIST_PNEXT_CIRC(edgeuse, &eu1->l);
|
||||
/* cut loop */
|
||||
new_lu = nmg_cut_loop(vu1_cut, vu2_cut, &RTG.rtg_vlfree);
|
||||
new_lu = nmg_cut_loop(vu1_cut, vu2_cut, &rtg_vlfree);
|
||||
lu->orientation = OT_SAME;
|
||||
lu->lumate_p->orientation = OT_SAME;
|
||||
new_lu->orientation = OT_SAME;
|
||||
@@ -972,9 +972,9 @@ shrink_wrap(struct shell *s)
|
||||
bu_ptbl_init(&verts, 128, "verts");
|
||||
Split_side_faces(s, &verts);
|
||||
|
||||
nmg_triangulate_shell(s, &RTG.rtg_vlfree, &tol);
|
||||
nmg_triangulate_shell(s, &rtg_vlfree, &tol);
|
||||
|
||||
nmg_split_loops_into_faces(&s->l.magic, &RTG.rtg_vlfree, &tol);
|
||||
nmg_split_loops_into_faces(&s->l.magic, &rtg_vlfree, &tol);
|
||||
|
||||
sd.s = s;
|
||||
sd.manifolds = nmg_manifolds(m);
|
||||
@@ -1165,8 +1165,8 @@ refine_hit(struct application *ap, struct partition *PartHeadp, struct seg *UNUS
|
||||
}
|
||||
if (!new_vu2)
|
||||
bu_exit(1, "ERROR: Cannot find VU in lu2\n");
|
||||
new_lu1 = nmg_cut_loop(new_vu1, vu1, &RTG.rtg_vlfree);
|
||||
new_lu2 = nmg_cut_loop(new_vu2, vu2, &RTG.rtg_vlfree);
|
||||
new_lu1 = nmg_cut_loop(new_vu1, vu1, &rtg_vlfree);
|
||||
new_lu2 = nmg_cut_loop(new_vu2, vu2, &rtg_vlfree);
|
||||
ref_data->lu1->orientation = OT_SAME;
|
||||
ref_data->lu2->orientation = OT_SAME;
|
||||
new_lu1->orientation = OT_SAME;
|
||||
@@ -1209,8 +1209,8 @@ refine_hit(struct application *ap, struct partition *PartHeadp, struct seg *UNUS
|
||||
}
|
||||
}
|
||||
|
||||
(void)nmg_split_loops_into_faces(&ref_data->fu1->l.magic, &RTG.rtg_vlfree, &tol);
|
||||
(void)nmg_split_loops_into_faces(&ref_data->fu2->l.magic, &RTG.rtg_vlfree, &tol);
|
||||
(void)nmg_split_loops_into_faces(&ref_data->fu1->l.magic, &rtg_vlfree, &tol);
|
||||
(void)nmg_split_loops_into_faces(&ref_data->fu2->l.magic, &rtg_vlfree, &tol);
|
||||
|
||||
for (BU_LIST_FOR(vu, vertexuse, &new_vu->v_p->vu_hd)) {
|
||||
struct faceuse *fu;
|
||||
@@ -1229,7 +1229,7 @@ refine_hit(struct application *ap, struct partition *PartHeadp, struct seg *UNUS
|
||||
|
||||
bu_ptbl_ins(ref_data->new_edges, (long *)eu->e_p);
|
||||
|
||||
nmg_calc_face_g(fu,&RTG.rtg_vlfree);
|
||||
nmg_calc_face_g(fu,&rtg_vlfree);
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -1252,7 +1252,7 @@ refine_edges(struct shell *s)
|
||||
|
||||
m = nmg_find_model(&s->l.magic);
|
||||
|
||||
nmg_edge_tabulate(&edges_1, &s->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_edge_tabulate(&edges_1, &s->l.magic, &rtg_vlfree);
|
||||
cur = &edges_1;
|
||||
bu_ptbl_init(&edges_2, 64, "edges_2");
|
||||
next = &edges_2;
|
||||
@@ -1540,7 +1540,7 @@ Make_shell(void)
|
||||
|
||||
if (decimation_tol > 0.0) {
|
||||
bu_log("%d edges eliminated by decimation to tolerance of %gmm\n",
|
||||
nmg_edge_collapse(m, &tol, decimation_tol, min_angle, &RTG.rtg_vlfree), decimation_tol);
|
||||
nmg_edge_collapse(m, &tol, decimation_tol, min_angle, &rtg_vlfree), decimation_tol);
|
||||
}
|
||||
|
||||
if (do_extra_rays || edge_tol > 0.0 || decimation_tol > 0.0)
|
||||
|
||||
+4
-4
@@ -626,7 +626,7 @@ main(int argc, char **argv)
|
||||
nmg_eue_dist = 2.0;
|
||||
}
|
||||
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree); /* for vlist macros */
|
||||
BU_LIST_INIT(&rtg_vlfree); /* for vlist macros */
|
||||
|
||||
/* Get command line arguments. */
|
||||
while ((c = bu_getopt(argc, argv, "a:bd:en:o:r:vx:X:u:h?")) != -1) {
|
||||
@@ -1026,14 +1026,14 @@ nmg_2_vrml(struct db_tree_state *tsp, const struct db_full_path *pathp, struct m
|
||||
}
|
||||
|
||||
if (!is_light) {
|
||||
nmg_triangulate_model(m, &RTG.rtg_vlfree, tol2);
|
||||
nmg_triangulate_model(m, &rtg_vlfree, tol2);
|
||||
fprintf(fp_out, "\t\t\t}\n");
|
||||
fprintf(fp_out, "\t\t\tgeometry IndexedFaceSet {\n");
|
||||
fprintf(fp_out, "\t\t\t\tcoord Coordinate {\n");
|
||||
}
|
||||
|
||||
/* get list of vertices */
|
||||
nmg_vertex_tabulate(&verts, &m->magic, &RTG.rtg_vlfree);
|
||||
nmg_vertex_tabulate(&verts, &m->magic, &rtg_vlfree);
|
||||
if (!is_light) {
|
||||
fprintf(fp_out, "\t\t\t\t\tpoint [");
|
||||
} else {
|
||||
@@ -1286,7 +1286,7 @@ process_boolean(union tree *curtree, struct db_tree_state *tsp, const struct db_
|
||||
/* Begin bomb protection */
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &RTG.rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
} else {
|
||||
/* catch */
|
||||
char *name = db_path_to_string(pathp);
|
||||
|
||||
+4
-4
@@ -378,7 +378,7 @@ main(int argc, char **argv)
|
||||
nmg_eue_dist = 2.0;
|
||||
}
|
||||
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree); /* for vlist macros */
|
||||
BU_LIST_INIT(&rtg_vlfree); /* for vlist macros */
|
||||
|
||||
/* Get command line arguments. */
|
||||
while ((c = bu_getopt(argc, argv, "d:a:n:o:r:vx:P:X:u:h?")) != -1) {
|
||||
@@ -551,7 +551,7 @@ process_non_light(struct model *m) {
|
||||
*/
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
if (nmg_triangulate_fu(fu, &RTG.rtg_vlfree, &tol)) {
|
||||
if (nmg_triangulate_fu(fu, &rtg_vlfree, &tol)) {
|
||||
if (nmg_kfu(fu)) {
|
||||
(void) nmg_ks(s);
|
||||
shell_is_dead = 1;
|
||||
@@ -714,7 +714,7 @@ nmg_2_vrml(FILE *fp, const struct db_full_path *pathp, struct model *m, struct m
|
||||
/* FIXME: need code to handle light */
|
||||
|
||||
/* get list of vertices */
|
||||
nmg_vertex_tabulate(&verts, &m->magic, &RTG.rtg_vlfree);
|
||||
nmg_vertex_tabulate(&verts, &m->magic, &rtg_vlfree);
|
||||
|
||||
fprintf(fp, "\t\t<IndexedFaceSet coordIndex=\"\n");
|
||||
first = 1;
|
||||
@@ -930,7 +930,7 @@ process_boolean(union tree *curtree, struct db_tree_state *tsp, const struct db_
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &RTG.rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
|
||||
} else {
|
||||
/* catch */
|
||||
|
||||
@@ -245,7 +245,7 @@ output_nmg(struct nmgregion *r, const struct db_full_path *pathp, int UNUSED(reg
|
||||
NMG_CK_MODEL(m);
|
||||
|
||||
/* triangulate model */
|
||||
nmg_triangulate_model(m, &RTG.rtg_vlfree, &tol);
|
||||
nmg_triangulate_model(m, &rtg_vlfree, &tol);
|
||||
|
||||
/* Output triangles */
|
||||
if (verbose) {
|
||||
@@ -346,8 +346,8 @@ process_boolean(union tree *curtree, struct db_tree_state *tsp, const struct db_
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
|
||||
(void)nmg_model_fuse(*tsp->ts_m, &RTG.rtg_vlfree, tsp->ts_tol);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &RTG.rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
(void)nmg_model_fuse(*tsp->ts_m, &rtg_vlfree, tsp->ts_tol);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
|
||||
} else {
|
||||
/* catch */
|
||||
|
||||
@@ -62,7 +62,7 @@ Add_inner_shell(struct nmgregion *r, int entityno)
|
||||
face_count++;
|
||||
}
|
||||
|
||||
nmg_gluefaces(fu, face_count, &RTG.rtg_vlfree, &tol);
|
||||
nmg_gluefaces(fu, face_count, &rtg_vlfree, &tol);
|
||||
|
||||
bu_free((char *)fu, "Add_inner_shell: faceuse list");
|
||||
bu_free((char *)face_de, "Add_inner_shell: face DE's");
|
||||
|
||||
@@ -89,16 +89,16 @@ brep(int entityno)
|
||||
Orient_loops(r);
|
||||
|
||||
/* orient shells */
|
||||
nmg_fix_normals(s_outer, &RTG.rtg_vlfree, &tol);
|
||||
nmg_fix_normals(s_outer, &rtg_vlfree, &tol);
|
||||
for (i = 0; i < num_of_voids; i++) {
|
||||
nmg_fix_normals(void_shells[i], &RTG.rtg_vlfree, &tol);
|
||||
nmg_fix_normals(void_shells[i], &rtg_vlfree, &tol);
|
||||
nmg_invert_shell(void_shells[i]);
|
||||
}
|
||||
|
||||
if (do_bots) {
|
||||
/* Merge all shells into one */
|
||||
for (i = 0; i < num_of_voids; i++)
|
||||
nmg_js(s_outer, void_shells[i], &RTG.rtg_vlfree, &tol);
|
||||
nmg_js(s_outer, void_shells[i], &rtg_vlfree, &tol);
|
||||
|
||||
/* write out BOT */
|
||||
if (mk_bot_from_nmg(fdout, dir[entityno]->name, s_outer))
|
||||
|
||||
@@ -407,7 +407,7 @@ Draw_entities(struct model *m, int de_list[], size_t no_of_des, fastf_t x, fastf
|
||||
s = BU_LIST_FIRST(shell, &r->s_hd);
|
||||
|
||||
BU_LIST_INIT(&vhead);
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree);
|
||||
BU_LIST_INIT(&rtg_vlfree);
|
||||
|
||||
sina = sin(ang);
|
||||
cosa = cos(ang);
|
||||
|
||||
@@ -118,14 +118,14 @@ extrude(int entityno)
|
||||
pt_ptr = pt_ptr->next;
|
||||
}
|
||||
|
||||
if (nmg_calc_face_g(fu, &RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu, &rtg_vlfree)) {
|
||||
bu_log("Extrude: Failed to calculate face geometry\n");
|
||||
nmg_km(m);
|
||||
bu_free((char *)curv_pts, "curve_pts");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (nmg_extrude_face(fu, evect, &RTG.rtg_vlfree, &tol)) {
|
||||
if (nmg_extrude_face(fu, evect, &rtg_vlfree, &tol)) {
|
||||
bu_log("Extrude: extrusion failed\n");
|
||||
nmg_km(m);
|
||||
bu_free((char *)curv_pts, "curve_pts");
|
||||
|
||||
@@ -223,7 +223,7 @@ main(int argc, char *argv[])
|
||||
tol.para = 1 - tol.perp;
|
||||
|
||||
the_model = nmg_mm();
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree); /* for vlist macros */
|
||||
BU_LIST_INIT(&rtg_vlfree); /* for vlist macros */
|
||||
|
||||
prog_name = argv[0];
|
||||
|
||||
@@ -451,8 +451,8 @@ process_boolean(struct db_tree_state *tsp, union tree *curtree, const struct db_
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
|
||||
(void)nmg_model_fuse(*tsp->ts_m, &RTG.rtg_vlfree, tsp->ts_tol);
|
||||
result = nmg_booltree_evaluate(curtree, &RTG.rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
(void)nmg_model_fuse(*tsp->ts_m, &rtg_vlfree, tsp->ts_tol);
|
||||
result = nmg_booltree_evaluate(curtree, &rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
|
||||
} else {
|
||||
/* catch */
|
||||
|
||||
@@ -63,7 +63,7 @@ Get_outer_shell(struct nmgregion *r, int entityno)
|
||||
face_count++;
|
||||
}
|
||||
|
||||
nmg_gluefaces(fu, face_count, &RTG.rtg_vlfree, &tol);
|
||||
nmg_gluefaces(fu, face_count, &rtg_vlfree, &tol);
|
||||
|
||||
bu_free((char *)fu, "Get_outer_shell: faceuse list");
|
||||
bu_free((char *)face_de, "Get_outer_shell: face DE's");
|
||||
|
||||
@@ -774,7 +774,7 @@ nmgregion_to_iges(char *name,
|
||||
return 0;
|
||||
|
||||
/* Find outer shells and void shells and their associations */
|
||||
outer_shell_count = nmg_find_outer_and_void_shells(r, &shells, &RTG.rtg_vlfree, &tol);
|
||||
outer_shell_count = nmg_find_outer_and_void_shells(r, &shells, &rtg_vlfree, &tol);
|
||||
|
||||
brep_de = (int *)bu_calloc(outer_shell_count, sizeof(int), "nmgregion_to_iges: brep_de");
|
||||
|
||||
@@ -1094,7 +1094,7 @@ write_vertex_list(struct nmgregion *r,
|
||||
dir_entry[i] = DEFAULT;
|
||||
|
||||
/* Built list of vertex structs */
|
||||
nmg_vertex_tabulate(vtab, &r->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_vertex_tabulate(vtab, &r->l.magic, &rtg_vlfree);
|
||||
|
||||
/* write parameter data for vertex list entity */
|
||||
bu_vls_printf(&str, "502,%ld", (long int)BU_PTBL_LEN(vtab));
|
||||
@@ -1244,7 +1244,7 @@ write_edge_list(struct nmgregion *r,
|
||||
dir_entry[i] = DEFAULT;
|
||||
|
||||
/* Build list of edge structures */
|
||||
nmg_edge_tabulate(etab, &r->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_edge_tabulate(etab, &r->l.magic, &rtg_vlfree);
|
||||
|
||||
bu_vls_printf(&str, "504,%ld", (long int)BU_PTBL_LEN(etab));
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ Make_planar_face(struct shell *s, int entityno, int face_orient)
|
||||
dist = DIST_PNT_PLANE(outside_pt, pl);
|
||||
VJOIN1(outside_pt, outside_pt, -dist, pl);
|
||||
|
||||
if (nmg_class_pnt_lu_except(outside_pt, lu, (struct edge *)NULL, &RTG.rtg_vlfree, &tol) != NMG_CLASS_AoutB) {
|
||||
if (nmg_class_pnt_lu_except(outside_pt, lu, (struct edge *)NULL, &rtg_vlfree, &tol) != NMG_CLASS_AoutB) {
|
||||
nmg_reverse_face(fu);
|
||||
if (fu->orientation != OT_SAME) {
|
||||
fu = fu->fumate_p;
|
||||
|
||||
@@ -45,7 +45,7 @@ Find_inner_loops(struct faceuse *fu, struct loop_list *lptr)
|
||||
if (lu == lptr->lu)
|
||||
continue;
|
||||
|
||||
if (nmg_classify_lu_lu(lu, lptr->lu, &RTG.rtg_vlfree, &tol) == NMG_CLASS_AinB) {
|
||||
if (nmg_classify_lu_lu(lu, lptr->lu, &rtg_vlfree, &tol) == NMG_CLASS_AinB) {
|
||||
|
||||
if (lptr->inner_loops == (struct loop_list *)NULL) {
|
||||
BU_ALLOC(lptr->inner_loops, struct loop_list);
|
||||
@@ -74,7 +74,7 @@ Find_inner_loops(struct faceuse *fu, struct loop_list *lptr)
|
||||
prev = (struct loop_list *)NULL;
|
||||
while (inner1) {
|
||||
if (inner->lu != inner1->lu) {
|
||||
if (nmg_classify_lu_lu(inner1->lu, inner->lu, &RTG.rtg_vlfree, &tol) == NMG_CLASS_AinB) {
|
||||
if (nmg_classify_lu_lu(inner1->lu, inner->lu, &rtg_vlfree, &tol) == NMG_CLASS_AinB) {
|
||||
struct loop_list *tmp;
|
||||
|
||||
/* inner1->lu is inside inner->lu,
|
||||
@@ -138,7 +138,7 @@ Orient_face_loops(struct faceuse *fu)
|
||||
for (BU_LIST_FOR(lu1, loopuse, &fu->lu_hd)) {
|
||||
if (lu1 == lu)
|
||||
continue;
|
||||
if (nmg_classify_lu_lu(lu, lu1, &RTG.rtg_vlfree, &tol) == NMG_CLASS_AinB) {
|
||||
if (nmg_classify_lu_lu(lu, lu1, &rtg_vlfree, &tol) == NMG_CLASS_AinB) {
|
||||
outer = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1397,7 +1397,7 @@ Convtrimsurfs()
|
||||
bu_log("Converted %zu Trimmed Surfaces successfully out of %zu total Trimmed Surfaces\n", convsurf, totsurfs);
|
||||
|
||||
if (convsurf) {
|
||||
(void)nmg_vertex_fuse(&m->magic, &RTG.rtg_vlfree, &tol);
|
||||
(void)nmg_vertex_fuse(&m->magic, &rtg_vlfree, &tol);
|
||||
|
||||
if (!BU_STR_EMPTY(curr_file->obj_name))
|
||||
mk_nmg(fdout, curr_file->obj_name, m);
|
||||
|
||||
@@ -202,7 +202,7 @@ nmg_to_psurf(struct nmgregion *r, FILE *fp_psurf)
|
||||
map = (int *)bu_calloc(r->m_p->maxindex, sizeof(int), "Jack vert map");
|
||||
|
||||
/* Built list of vertex structs */
|
||||
nmg_vertex_tabulate(&vtab, &r->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_vertex_tabulate(&vtab, &r->l.magic, &rtg_vlfree);
|
||||
|
||||
/* FIXME: What to do if 0 vertices? */
|
||||
|
||||
@@ -238,8 +238,8 @@ process_boolean(union tree *curtree, struct db_tree_state *tsp, const struct db_
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
|
||||
(void)nmg_model_fuse(*tsp->ts_m, &RTG.rtg_vlfree, tsp->ts_tol);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &RTG.rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
(void)nmg_model_fuse(*tsp->ts_m, &rtg_vlfree, tsp->ts_tol);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
|
||||
} else {
|
||||
/* catch */
|
||||
@@ -387,7 +387,7 @@ union tree *do_region_end(struct db_tree_state *tsp, const struct db_full_path *
|
||||
(int)(tsp->ts_mater.ma_color[1] * 255),
|
||||
(int)(tsp->ts_mater.ma_color[2] * 255));
|
||||
BU_LIST_INIT(&vhead);
|
||||
nmg_r_to_vlist(&vhead, r, 0, &RTG.rtg_vlfree);
|
||||
nmg_r_to_vlist(&vhead, r, 0, &rtg_vlfree);
|
||||
bn_vlist_to_uplot(fp, &vhead);
|
||||
fclose(fp);
|
||||
RT_FREE_VLIST(&vhead);
|
||||
@@ -454,7 +454,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
the_model = nmg_mm();
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree); /* for vlist macros */
|
||||
BU_LIST_INIT(&rtg_vlfree); /* for vlist macros */
|
||||
|
||||
/* Get command line arguments. */
|
||||
while ((c = bu_getopt(argc, argv, optstring)) != -1) {
|
||||
|
||||
@@ -280,7 +280,7 @@ psurf_to_nmg(struct model *m, FILE *fp, char *jfile)
|
||||
jfile, i+1);
|
||||
}
|
||||
|
||||
nmg_vertex_fuse(&m->magic, &RTG.rtg_vlfree, &tol);
|
||||
nmg_vertex_fuse(&m->magic, &rtg_vlfree, &tol);
|
||||
|
||||
/* Associate the face geometry. */
|
||||
for (i = 0, fail = 0; i < face; i++)
|
||||
@@ -309,11 +309,11 @@ psurf_to_nmg(struct model *m, FILE *fp, char *jfile)
|
||||
/* Compute "geometry" for region and shell */
|
||||
nmg_region_a(r, &tol);
|
||||
|
||||
nmg_break_e_on_v(&m->magic, &RTG.rtg_vlfree, &tol);
|
||||
nmg_break_e_on_v(&m->magic, &rtg_vlfree, &tol);
|
||||
empty_model = nmg_kill_zero_length_edgeuses(m);
|
||||
|
||||
/* Glue edges of outward pointing face uses together. */
|
||||
if (!empty_model) nmg_edge_fuse(&m->magic, &RTG.rtg_vlfree, &tol);
|
||||
if (!empty_model) nmg_edge_fuse(&m->magic, &rtg_vlfree, &tol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -949,7 +949,7 @@ get_cquad4(void)
|
||||
nmg_vertex_gv(g_pts[gin2].v[pid_index], pt2);
|
||||
if (!g_pts[gin3].v[pid_index]->vg_p)
|
||||
nmg_vertex_gv(g_pts[gin3].v[pid_index], pt3);
|
||||
nmg_calc_face_g(fu, &RTG.rtg_vlfree);
|
||||
nmg_calc_face_g(fu, &rtg_vlfree);
|
||||
|
||||
v[0] = &g_pts[gin1].v[pid_index];
|
||||
v[1] = &g_pts[gin3].v[pid_index];
|
||||
@@ -959,7 +959,7 @@ get_cquad4(void)
|
||||
|
||||
if (!g_pts[gin4].v[pid_index]->vg_p)
|
||||
nmg_vertex_gv(g_pts[gin4].v[pid_index], pt4);
|
||||
nmg_calc_face_g(fu, &RTG.rtg_vlfree);
|
||||
nmg_calc_face_g(fu, &rtg_vlfree);
|
||||
}
|
||||
|
||||
|
||||
@@ -1047,7 +1047,7 @@ get_ctria3(void)
|
||||
if (!g_pts[gin3].v[pid_index]->vg_p)
|
||||
nmg_vertex_gv(g_pts[gin3].v[pid_index], pt3);
|
||||
|
||||
nmg_calc_face_g(fu, &RTG.rtg_vlfree);
|
||||
nmg_calc_face_g(fu, &rtg_vlfree);
|
||||
}
|
||||
|
||||
|
||||
@@ -1336,10 +1336,10 @@ main(int argc, char **argv)
|
||||
|
||||
m = nmg_find_model(&psh->s->l.magic);
|
||||
nmg_rebound(m, &tol);
|
||||
nmg_fix_normals(psh->s, &RTG.rtg_vlfree, &tol);
|
||||
nmg_fix_normals(psh->s, &rtg_vlfree, &tol);
|
||||
if (psh->thick > tol.dist) {
|
||||
nmg_model_face_fuse(m, &RTG.rtg_vlfree, &tol);
|
||||
nmg_hollow_shell(psh->s, psh->thick*conv[units], 1, &RTG.rtg_vlfree, &tol);
|
||||
nmg_model_face_fuse(m, &rtg_vlfree, &tol);
|
||||
nmg_hollow_shell(psh->s, psh->thick*conv[units], 1, &rtg_vlfree, &tol);
|
||||
}
|
||||
sprintf(name, "pshell.%d", psh->pid);
|
||||
if (polysolids)
|
||||
|
||||
@@ -162,11 +162,11 @@ ascii_to_brlcad(FILE *fpin, struct rt_wdb *fpout, char *reg_name, char *grp_name
|
||||
nmg_face_g( fu, pl );
|
||||
|
||||
if (!NEAR_ZERO(MAGNITUDE(Ext), 0.001))
|
||||
nmg_extrude_face(BU_LIST_FIRST(faceuse, &s->fu_hd), Ext, &RTG.rtg_vlfree, &tol);
|
||||
nmg_extrude_face(BU_LIST_FIRST(faceuse, &s->fu_hd), Ext, &rtg_vlfree, &tol);
|
||||
|
||||
nmg_region_a(r, &tol); /* Calculate geometry for region and shell. */
|
||||
|
||||
nmg_fix_normals( s, &RTG.rtg_vlfree, &tol ); /* insure that faces have outward pointing normals */
|
||||
nmg_fix_normals( s, &rtg_vlfree, &tol ); /* insure that faces have outward pointing normals */
|
||||
|
||||
create_brlcad_db(fpout, m, reg_name, grp_name);
|
||||
|
||||
|
||||
+5
-5
@@ -1355,7 +1355,7 @@ populate_triangle_indexes(struct ga_t *ga,
|
||||
if (fu != NULL) {
|
||||
|
||||
/* do simple or robust triangulation based on whether face is concave or convex */
|
||||
if (nmg_lu_is_convex(BU_LIST_FIRST(loopuse, &fu->lu_hd), &RTG.rtg_vlfree, tol)) {
|
||||
if (nmg_lu_is_convex(BU_LIST_FIRST(loopuse, &fu->lu_hd), &rtg_vlfree, tol)) {
|
||||
|
||||
/* compute number of new triangles to create */
|
||||
if (gfi->num_vertices_arr[face_idx] > 3) {
|
||||
@@ -2879,7 +2879,7 @@ output_to_nmg(struct ga_t *ga,
|
||||
if ((verbose > 1) || debug) {
|
||||
bu_log("Running nmg_model_fuse on (%ld) faces from obj file face grouping name (%s), obj file face grouping index (%zu)\n", BU_PTBL_LEN(&faces), bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index + 1);
|
||||
}
|
||||
num_entities_fused = nmg_model_fuse(m, &RTG.rtg_vlfree, tol);
|
||||
num_entities_fused = nmg_model_fuse(m, &rtg_vlfree, tol);
|
||||
if ((verbose > 1) || debug) {
|
||||
bu_log("Completed nmg_model_fuse for obj file face grouping name (%s), obj file face grouping index (%zu)\n", bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index + 1);
|
||||
bu_log("Fused (%d) entities in obj file face grouping name (%s), obj file face grouping index (%zu)\n",
|
||||
@@ -2890,7 +2890,7 @@ output_to_nmg(struct ga_t *ga,
|
||||
if ((verbose > 1) || debug) {
|
||||
bu_log("Running nmg_gluefaces on (%ld) faces from obj file face grouping name (%s), obj file face grouping index (%zu)\n", BU_PTBL_LEN(&faces), bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index + 1);
|
||||
}
|
||||
nmg_gluefaces((struct faceuse **)BU_PTBL_BASEADDR(&faces), BU_PTBL_LEN(&faces), &RTG.rtg_vlfree, tol);
|
||||
nmg_gluefaces((struct faceuse **)BU_PTBL_BASEADDR(&faces), BU_PTBL_LEN(&faces), &rtg_vlfree, tol);
|
||||
if ((verbose > 1) || debug) {
|
||||
bu_log("Completed nmg_gluefaces for obj file face grouping name (%s), obj file face grouping index (%zu)\n", bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index + 1);
|
||||
}
|
||||
@@ -2899,7 +2899,7 @@ output_to_nmg(struct ga_t *ga,
|
||||
if ((verbose > 1) || debug) {
|
||||
bu_log("Running nmg_mark_edges_real with approx (%ld) faces from obj file face grouping name (%s), obj file face grouping index (%zu)\n", BU_PTBL_LEN(&faces), bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index + 1);
|
||||
}
|
||||
(void)nmg_mark_edges_real(&s->l.magic, &RTG.rtg_vlfree);
|
||||
(void)nmg_mark_edges_real(&s->l.magic, &rtg_vlfree);
|
||||
if ((verbose > 1) || debug) {
|
||||
bu_log("Completed nmg_mark_edges_real for obj file face grouping name (%s), obj file face grouping index (%zu)\n", bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index + 1);
|
||||
}
|
||||
@@ -2942,7 +2942,7 @@ output_to_nmg(struct ga_t *ga,
|
||||
if ((verbose > 1) || debug) {
|
||||
bu_log("Running nmg_fix_normals with approx (%ld) faces from obj file face grouping name (%s), obj file face grouping index (%zu)\n", BU_PTBL_LEN(&faces), bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index + 1);
|
||||
}
|
||||
nmg_fix_normals(s, &RTG.rtg_vlfree, tol);
|
||||
nmg_fix_normals(s, &rtg_vlfree, tol);
|
||||
if ((verbose > 1) || debug) {
|
||||
bu_log("Completed nmg_fix_normals for obj file face grouping name (%s), obj file face grouping index (%zu)\n", bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index + 1);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ main(int argc, char **argv)
|
||||
tol.para = 1 - tol.perp;
|
||||
|
||||
the_model = nmg_mm();
|
||||
BU_LIST_INIT( &RTG.rtg_vlfree ); /* for vlist macros */
|
||||
BU_LIST_INIT( &rtg_vlfree ); /* for vlist macros */
|
||||
|
||||
/* Get command line arguments. */
|
||||
while ((c = bu_getopt(argc, argv, "a:dn:p:r:vx:P:X:h?")) != -1) {
|
||||
@@ -212,8 +212,8 @@ process_boolean(union tree *curtree, struct db_tree_state *tsp, const struct db_
|
||||
if ( !BU_SETJUMP ) {
|
||||
/* try */
|
||||
|
||||
(void)nmg_model_fuse(*tsp->ts_m, &RTG.rtg_vlfree, tsp->ts_tol);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &RTG.rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
(void)nmg_model_fuse(*tsp->ts_m, &rtg_vlfree, tsp->ts_tol);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
|
||||
} else {
|
||||
/* catch */
|
||||
@@ -359,7 +359,7 @@ union tree *do_region_end(struct db_tree_state *tsp, const struct db_full_path *
|
||||
(int)(tsp->ts_mater.ma_color[1] * 255),
|
||||
(int)(tsp->ts_mater.ma_color[2] * 255) );
|
||||
BU_LIST_INIT( &vhead );
|
||||
nmg_r_to_vlist(&vhead, r, 0, &RTG.rtg_vlfree);
|
||||
nmg_r_to_vlist(&vhead, r, 0, &rtg_vlfree);
|
||||
bn_vlist_to_uplot( fp, &vhead );
|
||||
fclose(fp);
|
||||
if (verbose) bu_log("*** Wrote %s\n", bu_vls_addr(&file));
|
||||
@@ -404,7 +404,7 @@ nmg_to_psurf(struct nmgregion *r, FILE *fp_psurf)
|
||||
map = (int *)bu_calloc(r->m_p->maxindex, sizeof(int), "Jack vert map");
|
||||
|
||||
/* Built list of vertex structs */
|
||||
nmg_vertex_tabulate( &vtab, &r->l.magic, &RTG.rtg_vlfree );
|
||||
nmg_vertex_tabulate( &vtab, &r->l.magic, &rtg_vlfree );
|
||||
|
||||
/* FIXME: What to do if 0 vertices? */
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ int read_faces(struct model *m, FILE *fgeom)
|
||||
|
||||
if (fail) return -1;
|
||||
|
||||
nmg_gluefaces(outfaceuses, nfaces, &RTG.rtg_vlfree, &tol);
|
||||
nmg_gluefaces(outfaceuses, nfaces, &rtg_vlfree, &tol);
|
||||
nmg_region_a(r, &tol);
|
||||
|
||||
bu_free((char *)pts, "points list");
|
||||
|
||||
+21
-21
@@ -392,7 +392,7 @@ nmg_patch_coplanar_face_merge(struct shell *s, size_t *face_count, struct patch_
|
||||
struct loopuse *lu;
|
||||
|
||||
for (BU_LIST_FOR (lu, loopuse, &fu1->lu_hd))
|
||||
nmg_simplify_loop(lu, &RTG.rtg_vlfree);
|
||||
nmg_simplify_loop(lu, &rtg_vlfree);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -640,29 +640,29 @@ Build_solid(size_t l, char *name, char *mirror_name, int plate_mode, fastf_t *ce
|
||||
bu_free((char *)verts, "build_solid: verts");
|
||||
|
||||
/* fuse vertices */
|
||||
(void)nmg_vertex_fuse(&m->magic, &RTG.rtg_vlfree, tol);
|
||||
(void)nmg_vertex_fuse(&m->magic, &rtg_vlfree, tol);
|
||||
|
||||
/* FASTGEN targets may have vertices that should be part of an
|
||||
* adjoining edge. Use nmg_break_long_edges to fix this
|
||||
*/
|
||||
i = nmg_break_edges(&m->magic, &RTG.rtg_vlfree, tol);
|
||||
i = nmg_break_edges(&m->magic, &rtg_vlfree, tol);
|
||||
if (debug > 2)
|
||||
bu_log("nmg_break_edges broke %zu edges\n", i);
|
||||
|
||||
/* glue all the faces together */
|
||||
nmg_gluefaces((struct faceuse **)BU_PTBL_BASEADDR(&faces), BU_PTBL_LEN(&faces), &RTG.rtg_vlfree, tol);
|
||||
nmg_gluefaces((struct faceuse **)BU_PTBL_BASEADDR(&faces), BU_PTBL_LEN(&faces), &rtg_vlfree, tol);
|
||||
|
||||
for (BU_LIST_FOR (s, shell, &r->s_hd))
|
||||
nmg_make_faces_within_tol(s, &RTG.rtg_vlfree, tol);
|
||||
nmg_make_faces_within_tol(s, &rtg_vlfree, tol);
|
||||
|
||||
if (!plate_mode) {
|
||||
/* make sure the normals are correct */
|
||||
for (BU_LIST_FOR (s, shell, &r->s_hd))
|
||||
nmg_fix_normals(s, &RTG.rtg_vlfree, tol);
|
||||
nmg_fix_normals(s, &rtg_vlfree, tol);
|
||||
|
||||
/* make sure we are dealing with closed shells */
|
||||
for (BU_LIST_FOR (s, shell, &r->s_hd))
|
||||
nmg_close_shell(s, &RTG.rtg_vlfree, tol);
|
||||
nmg_close_shell(s, &rtg_vlfree, tol);
|
||||
|
||||
/* free the memory for the face list */
|
||||
bu_ptbl_free(&faces);
|
||||
@@ -679,8 +679,8 @@ Build_solid(size_t l, char *name, char *mirror_name, int plate_mode, fastf_t *ce
|
||||
if (polysolid) {
|
||||
mk_bot_from_nmg(outfp, name, s);
|
||||
} else {
|
||||
nmg_shell_coplanar_face_merge(s, tol, 0, &RTG.rtg_vlfree);
|
||||
if (!nmg_simplify_shell(s, &RTG.rtg_vlfree)) {
|
||||
nmg_shell_coplanar_face_merge(s, tol, 0, &rtg_vlfree);
|
||||
if (!nmg_simplify_shell(s, &rtg_vlfree)) {
|
||||
struct model *m_copy = nmg_clone_model(m);
|
||||
mk_nmg(outfp, name, m_copy); /* frees m_copy */
|
||||
}
|
||||
@@ -688,7 +688,7 @@ Build_solid(size_t l, char *name, char *mirror_name, int plate_mode, fastf_t *ce
|
||||
|
||||
/* if this solid is mirrored, don't go through the entire process again */
|
||||
if (mirror_name[0]) {
|
||||
nmg_mirror_model(m, &RTG.rtg_vlfree);
|
||||
nmg_mirror_model(m, &rtg_vlfree);
|
||||
|
||||
if (polysolid) {
|
||||
mk_bot_from_nmg(outfp, mirror_name, s);
|
||||
@@ -806,7 +806,7 @@ Build_solid(size_t l, char *name, char *mirror_name, int plate_mode, fastf_t *ce
|
||||
|
||||
nmg_patch_coplanar_face_merge(s, &face_count, p_faces, tol, 0);
|
||||
|
||||
if (nmg_simplify_shell(s, &RTG.rtg_vlfree))
|
||||
if (nmg_simplify_shell(s, &rtg_vlfree))
|
||||
return 1;
|
||||
|
||||
/* Calculate bounding boxes */
|
||||
@@ -821,7 +821,7 @@ Build_solid(size_t l, char *name, char *mirror_name, int plate_mode, fastf_t *ce
|
||||
}
|
||||
|
||||
/* Duplicate shell */
|
||||
is = nmg_dup_shell(s, ©_tbl, &RTG.rtg_vlfree, tol);
|
||||
is = nmg_dup_shell(s, ©_tbl, &rtg_vlfree, tol);
|
||||
|
||||
/* make a new flags array */
|
||||
bu_free((char *)flags, "build_solid: flags");
|
||||
@@ -870,10 +870,10 @@ Build_solid(size_t l, char *name, char *mirror_name, int plate_mode, fastf_t *ce
|
||||
if (fu->orientation == OT_SAME)
|
||||
bu_ptbl_ins(&faces, (long *)fu);
|
||||
}
|
||||
nmg_gluefaces((struct faceuse **)BU_PTBL_BASEADDR(&faces), BU_PTBL_LEN(&faces), &RTG.rtg_vlfree, tol);
|
||||
nmg_gluefaces((struct faceuse **)BU_PTBL_BASEADDR(&faces), BU_PTBL_LEN(&faces), &rtg_vlfree, tol);
|
||||
bu_ptbl_reset(&faces);
|
||||
|
||||
nmg_shell_coplanar_face_merge(is, tol, 0, &RTG.rtg_vlfree);
|
||||
nmg_shell_coplanar_face_merge(is, tol, 0, &rtg_vlfree);
|
||||
nmg_shell_a(is, tol);
|
||||
|
||||
/* make yet another version of the flags array */
|
||||
@@ -921,7 +921,7 @@ Build_solid(size_t l, char *name, char *mirror_name, int plate_mode, fastf_t *ce
|
||||
/* Adjust the vertices of new_v */
|
||||
if (debug > 2)
|
||||
bu_log("Moving (%f %f %f)", V3ARGS(new_v->vg_p->coord));
|
||||
if (nmg_in_vert(new_v, 1, &RTG.rtg_vlfree, tol)) {
|
||||
if (nmg_in_vert(new_v, 1, &rtg_vlfree, tol)) {
|
||||
/* FAILURE, kill the model and shell and return a failure notification */
|
||||
bu_log("nmg_in_vert failed on %s!\n", name);
|
||||
if (!nmg_ks(is)) {
|
||||
@@ -955,12 +955,12 @@ Build_solid(size_t l, char *name, char *mirror_name, int plate_mode, fastf_t *ce
|
||||
mk_nmg(outfp, tmp_name, m_copy); /* frees m_copy */
|
||||
}
|
||||
|
||||
nmg_make_faces_within_tol(is, &RTG.rtg_vlfree, tol);
|
||||
nmg_make_faces_within_tol(is, &rtg_vlfree, tol);
|
||||
|
||||
/* Close shell */
|
||||
if (debug)
|
||||
bu_log("Close shell\n");
|
||||
if (nmg_open_shells_connect(s, is, (const long **)copy_tbl, &RTG.rtg_vlfree, tol)) {
|
||||
if (nmg_open_shells_connect(s, is, (const long **)copy_tbl, &rtg_vlfree, tol)) {
|
||||
/* debugging: write an NMG of the outer shell named "name.BAD" */
|
||||
char bad[NAMESIZE+5];
|
||||
|
||||
@@ -986,7 +986,7 @@ Build_solid(size_t l, char *name, char *mirror_name, int plate_mode, fastf_t *ce
|
||||
}
|
||||
if (debug)
|
||||
bu_log("Re-glue faces\n");
|
||||
nmg_gluefaces((struct faceuse **)BU_PTBL_BASEADDR(&faces), BU_PTBL_LEN(&faces), &RTG.rtg_vlfree, tol);
|
||||
nmg_gluefaces((struct faceuse **)BU_PTBL_BASEADDR(&faces), BU_PTBL_LEN(&faces), &rtg_vlfree, tol);
|
||||
bu_ptbl_free(&faces);
|
||||
|
||||
/* Calculate bounding boxes */
|
||||
@@ -1003,8 +1003,8 @@ Build_solid(size_t l, char *name, char *mirror_name, int plate_mode, fastf_t *ce
|
||||
if (polysolid) {
|
||||
mk_bot_from_nmg(outfp, name, s);
|
||||
} else {
|
||||
nmg_shell_coplanar_face_merge(s, tol, 0, &RTG.rtg_vlfree);
|
||||
if (!nmg_simplify_shell(s, &RTG.rtg_vlfree)) {
|
||||
nmg_shell_coplanar_face_merge(s, tol, 0, &rtg_vlfree);
|
||||
if (!nmg_simplify_shell(s, &rtg_vlfree)) {
|
||||
struct model *m_copy = nmg_clone_model(m);
|
||||
mk_nmg(outfp, name, m_copy); /* frees m_copy */
|
||||
}
|
||||
@@ -1014,7 +1014,7 @@ Build_solid(size_t l, char *name, char *mirror_name, int plate_mode, fastf_t *ce
|
||||
if (mirror_name[0]) {
|
||||
if (debug)
|
||||
bu_log("Mirror model\n");
|
||||
nmg_mirror_model(m, &RTG.rtg_vlfree);
|
||||
nmg_mirror_model(m, &rtg_vlfree);
|
||||
|
||||
if (debug)
|
||||
bu_log("writing %s (mirrored) to BRL-CAD DB\n", mirror_name);
|
||||
|
||||
@@ -188,7 +188,7 @@ nmg_to_ply(struct nmgregion *r, const struct db_full_path *pathp, int UNUSED(reg
|
||||
NMG_CK_MODEL(m);
|
||||
|
||||
/* triangulate model */
|
||||
nmg_triangulate_model(m, &RTG.rtg_vlfree, &tol);
|
||||
nmg_triangulate_model(m, &rtg_vlfree, &tol);
|
||||
|
||||
/* Output triangles */
|
||||
if (verbose)
|
||||
@@ -415,8 +415,8 @@ process_boolean(union tree *curtree, struct db_tree_state *tsp, const struct db_
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
|
||||
(void)nmg_model_fuse(*tsp->ts_m, &RTG.rtg_vlfree, tsp->ts_tol);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &RTG.rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
(void)nmg_model_fuse(*tsp->ts_m, &rtg_vlfree, tsp->ts_tol);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
|
||||
} else {
|
||||
/* catch */
|
||||
|
||||
@@ -143,7 +143,7 @@ nmg_to_raw(struct nmgregion *r, const struct db_full_path *pathp, int UNUSED(reg
|
||||
fprintf(fp, "%s\n", (region_name+1));
|
||||
|
||||
/* triangulate model */
|
||||
nmg_triangulate_model(m, &RTG.rtg_vlfree, &tol);
|
||||
nmg_triangulate_model(m, &rtg_vlfree, &tol);
|
||||
|
||||
/* Check triangles */
|
||||
for (BU_LIST_FOR (s, shell, &r->s_hd))
|
||||
@@ -249,7 +249,7 @@ main(int argc, char *argv[])
|
||||
|
||||
/* make empty NMG model */
|
||||
the_model = nmg_mm();
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree); /* for vlist macros */
|
||||
BU_LIST_INIT(&rtg_vlfree); /* for vlist macros */
|
||||
|
||||
/* Get command line arguments. */
|
||||
while ((c = bu_getopt(argc, argv, "a:b8m:n:o:r:vx:D:X:i")) != -1) {
|
||||
|
||||
@@ -177,7 +177,7 @@ nmg_to_stl(struct nmgregion *r, const struct db_full_path *pathp, int UNUSED(reg
|
||||
fprintf(fp, "solid %s\n", (region_name+1));
|
||||
|
||||
/* triangulate model */
|
||||
nmg_triangulate_model(m, &RTG.rtg_vlfree, &tol);
|
||||
nmg_triangulate_model(m, &rtg_vlfree, &tol);
|
||||
|
||||
/* Check triangles */
|
||||
for (BU_LIST_FOR (s, shell, &r->s_hd))
|
||||
@@ -340,7 +340,7 @@ main(int argc, char *argv[])
|
||||
|
||||
/* make empty NMG model */
|
||||
the_model = nmg_mm();
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree); /* for vlist macros */
|
||||
BU_LIST_INIT(&rtg_vlfree); /* for vlist macros */
|
||||
|
||||
/* Get command line arguments. */
|
||||
while ((c = bu_getopt(argc, argv, "a:b8m:n:o:r:vx:D:X:ih?")) != -1) {
|
||||
|
||||
@@ -342,7 +342,7 @@ main(int argc, char **argv)
|
||||
NMG_CK_FACEUSE( fu );
|
||||
if ( fu->orientation == OT_SAME )
|
||||
{
|
||||
if ( nmg_calc_face_g( fu, &RTG.rtg_vlfree ) )
|
||||
if ( nmg_calc_face_g( fu, &rtg_vlfree ) )
|
||||
bu_log( "Failed to calculate plane eqn\n" );
|
||||
|
||||
/* save the face in a table */
|
||||
@@ -365,7 +365,7 @@ main(int argc, char **argv)
|
||||
nmg_break_long_edges( s, &tol );
|
||||
|
||||
/* glue all the faces together */
|
||||
nmg_gluefaces( (struct faceuse **)BU_PTBL_BASEADDR( &faces), BU_PTBL_LEN( &faces ), &RTG.rtg_vlfree, &tol );
|
||||
nmg_gluefaces( (struct faceuse **)BU_PTBL_BASEADDR( &faces), BU_PTBL_LEN( &faces ), &rtg_vlfree, &tol );
|
||||
|
||||
/* re-initialize the face list */
|
||||
bu_ptbl_reset( &faces );
|
||||
@@ -376,7 +376,7 @@ main(int argc, char **argv)
|
||||
/* fix the normals */
|
||||
s = BU_LIST_FIRST( shell, &r->s_hd );
|
||||
|
||||
nmg_fix_normals( s, &RTG.rtg_vlfree, &tol );
|
||||
nmg_fix_normals( s, &rtg_vlfree, &tol );
|
||||
|
||||
/* make a name for this solid */
|
||||
sprintf( name, "s.%d.%d", comp_code, Add_solid( comp_code ) );
|
||||
|
||||
+38
-2
@@ -26,7 +26,9 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "bio.h"
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -34,11 +36,43 @@ extern "C" {
|
||||
#include "linenoise.h"
|
||||
}
|
||||
|
||||
#include "bio.h"
|
||||
#include "bu.h"
|
||||
#include "ged.h"
|
||||
|
||||
#define DEFAULT_GSH_PROMPT "g> "
|
||||
|
||||
void
|
||||
collect_io(struct ged_subprocess *p, ged_io_func_t callback, void *data)
|
||||
{
|
||||
while (p && !p->done) {
|
||||
(*callback)(data, 0);
|
||||
long nlen = bu_vls_strlen(p->gedp->ged_result_str);
|
||||
if (nlen) {
|
||||
printf("%s", bu_vls_cstr(p->gedp->ged_result_str));
|
||||
bu_vls_trunc(p->gedp->ged_result_str, 0);
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
}
|
||||
|
||||
void gsh_create_io_handler(struct ged_subprocess *p, bu_process_io_t UNUSED(d), ged_io_func_t callback, void *data) {
|
||||
if (!callback) {
|
||||
bu_log("no callback specified\n");
|
||||
return;
|
||||
}
|
||||
p->done = 0;
|
||||
void *ddata = (!data) ? (void *)p : data;
|
||||
std::thread t(collect_io, p, callback, ddata);
|
||||
t.detach();
|
||||
}
|
||||
|
||||
void gsh_delete_io_handler(struct ged_subprocess *p, bu_process_io_t UNUSED(d))
|
||||
{
|
||||
p->done = 1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, const char **argv)
|
||||
{
|
||||
@@ -92,7 +126,7 @@ main(int argc, const char **argv)
|
||||
}
|
||||
|
||||
/* FIXME: To draw, we need to init this LIBRT global */
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree);
|
||||
BU_LIST_INIT(&rtg_vlfree);
|
||||
|
||||
/* Need a view for commands that expect a view */
|
||||
struct bview *gsh_view;
|
||||
@@ -107,6 +141,8 @@ main(int argc, const char **argv)
|
||||
bu_exit(EXIT_FAILURE, "File %s does not exist, expecting .g file\n", argv[0]) ;
|
||||
}
|
||||
gedp = ged_open("db", argv[0], 1);
|
||||
gedp->ged_create_io_handler = &gsh_create_io_handler;
|
||||
gedp->ged_delete_io_handler = &gsh_delete_io_handler;
|
||||
if (!gedp) {
|
||||
bu_vls_free(&msg);
|
||||
bu_dlclose(libged);
|
||||
|
||||
@@ -71,6 +71,7 @@ set(LIBBG_SOURCES
|
||||
trimesh.cpp
|
||||
trimesh_isect.cpp
|
||||
util.c
|
||||
vlist.cpp
|
||||
)
|
||||
|
||||
BRLCAD_ADDLIB(libbg "${LIBBG_SOURCES}" "libbn;libbu;${POLY2TRI_LIBRARIES}")
|
||||
|
||||
@@ -0,0 +1,977 @@
|
||||
/* V L I S T . C P P
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 2020 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file vlist.cpp
|
||||
*
|
||||
* Brief description
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
|
||||
#include "vmath.h"
|
||||
#include "bu/cv.h"
|
||||
#include "bu/malloc.h"
|
||||
#include "bu/list.h"
|
||||
#include "bu/log.h"
|
||||
#include "bu/str.h"
|
||||
#include "bn/plot3.h"
|
||||
#include "bg/lseg.h"
|
||||
#include "bg/vlist.h"
|
||||
|
||||
/* Internal implementation structures */
|
||||
|
||||
class vobj {
|
||||
public:
|
||||
point_t p = VINIT_ZERO;
|
||||
bg_vlist_cmd_t cmd = BG_VLIST_NULL;
|
||||
};
|
||||
|
||||
struct bg_vlist_queue_impl {
|
||||
std::queue<size_t> free_objs;
|
||||
std::vector<vobj> objs;
|
||||
};
|
||||
|
||||
struct bg_vlist_impl {
|
||||
std::vector<size_t> v;
|
||||
struct bg_vlist_queue *q;
|
||||
// If a vlist is not using a queue, the vobjs are
|
||||
// stored locally with the list
|
||||
std::vector<vobj> vlocal;
|
||||
};
|
||||
|
||||
|
||||
/* vlist queue functions */
|
||||
|
||||
struct bg_vlist_queue *
|
||||
bg_vlist_queue_create()
|
||||
{
|
||||
struct bg_vlist_queue *q = NULL;
|
||||
BU_GET(q, struct bg_vlist_queue);
|
||||
q->i = new struct bg_vlist_queue_impl;
|
||||
return q;
|
||||
}
|
||||
|
||||
void
|
||||
bg_vlist_queue_delete(struct bg_vlist_queue *q)
|
||||
{
|
||||
delete[] q->i;
|
||||
BU_PUT(q, struct bg_vlist_queue);
|
||||
}
|
||||
|
||||
|
||||
/* vlist functions */
|
||||
|
||||
struct bg_vlist *
|
||||
bg_vlist_create(struct bg_vlist_queue *q)
|
||||
{
|
||||
struct bg_vlist *v = NULL;
|
||||
BU_GET(v, struct bg_vlist);
|
||||
v->i = new struct bg_vlist_impl;
|
||||
v->i->q = q;
|
||||
return v;
|
||||
}
|
||||
|
||||
void
|
||||
bg_vlist_destroy(struct bg_vlist *v)
|
||||
{
|
||||
if (v->i->q) {
|
||||
// If we're using a queue, all of the objects
|
||||
// in this vlist will be available for reuse
|
||||
for (size_t i = 0; i < v->i->v.size(); i++) {
|
||||
vobj &nv = v->i->q->i->objs[v->i->v[i]];
|
||||
VSET(nv.p, 0, 0, 0);
|
||||
nv.cmd = BG_VLIST_NULL;
|
||||
v->i->q->i->free_objs.push(v->i->v[i]);
|
||||
}
|
||||
}
|
||||
delete[] v->i;
|
||||
BU_PUT(v, struct bg_vlist);
|
||||
}
|
||||
|
||||
size_t
|
||||
bg_vlist_npnts(struct bg_vlist *v)
|
||||
{
|
||||
size_t cnt = 0;
|
||||
|
||||
for (size_t i = 0; i < v->i->v.size(); i++) {
|
||||
bg_vlist_cmd_t cmd = bg_vlist_get(NULL, v, i);
|
||||
switch (cmd) {
|
||||
case BG_VLIST_POINT_DRAW:
|
||||
case BG_VLIST_TRI_MOVE:
|
||||
case BG_VLIST_TRI_DRAW:
|
||||
case BG_VLIST_POLY_MOVE:
|
||||
case BG_VLIST_POLY_DRAW:
|
||||
cnt++;
|
||||
break;
|
||||
default:
|
||||
// Note: not counting normal data as points
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
size_t
|
||||
bg_vlist_ncmds(struct bg_vlist *v)
|
||||
{
|
||||
size_t cnt = 0;
|
||||
|
||||
for (size_t i = 0; i < v->i->v.size(); i++) {
|
||||
bg_vlist_cmd_t cmd = bg_vlist_get(NULL, v, i);
|
||||
if (cmd == BG_VLIST_NULL) {
|
||||
continue;
|
||||
}
|
||||
cnt++;
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
int
|
||||
bg_vlist_append(struct bg_vlist *v, bg_vlist_cmd_t cmd, point_t *p)
|
||||
{
|
||||
if (!v) {
|
||||
return -1;
|
||||
}
|
||||
if (v->i->q) {
|
||||
size_t nobj = v->i->q->i->free_objs.front();
|
||||
v->i->q->i->free_objs.pop();
|
||||
vobj &nv = v->i->q->i->objs[nobj];
|
||||
nv.cmd = cmd;
|
||||
if (p) {
|
||||
VMOVE(nv.p, *p);
|
||||
}
|
||||
v->i->v.push_back(nobj);
|
||||
} else {
|
||||
vobj nv;
|
||||
nv.cmd = cmd;
|
||||
if (p) {
|
||||
VMOVE(nv.p, *p);
|
||||
}
|
||||
v->i->vlocal.push_back(nv);
|
||||
v->i->v.push_back(v->i->vlocal.size() - 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bg_vlist_insert(struct bg_vlist *v, size_t i, bg_vlist_cmd_t cmd, point_t *p)
|
||||
{
|
||||
if (!v) {
|
||||
return -1;
|
||||
}
|
||||
if (v->i->q) {
|
||||
size_t nobj = v->i->q->i->free_objs.front();
|
||||
v->i->q->i->free_objs.pop();
|
||||
vobj &nv = v->i->q->i->objs[nobj];
|
||||
nv.cmd = cmd;
|
||||
if (p) {
|
||||
VMOVE(nv.p, *p);
|
||||
}
|
||||
std::vector<size_t>::iterator v_it = v->i->v.begin()+i;
|
||||
v->i->v.insert(v_it, nobj);
|
||||
} else {
|
||||
vobj nv;
|
||||
nv.cmd = cmd;
|
||||
if (p) {
|
||||
VMOVE(nv.p, *p);
|
||||
}
|
||||
v->i->vlocal.push_back(nv);
|
||||
std::vector<size_t>::iterator v_it = v->i->v.begin()+i;
|
||||
v->i->v.insert(v_it, v->i->vlocal.size() - 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bg_vlist_cmd_t
|
||||
bg_vlist_get(point_t *op, struct bg_vlist *v, size_t i)
|
||||
{
|
||||
if (i > v->i->v.size() - 1) {
|
||||
return BG_VLIST_NULL;
|
||||
}
|
||||
|
||||
// Actual node info is either in the queue or the local vector
|
||||
vobj &cv = (v->i->q) ? v->i->q->i->objs[v->i->v[i]] : v->i->vlocal[v->i->v[i]];
|
||||
if (op) {
|
||||
VMOVE(*op, cv.p);
|
||||
}
|
||||
return cv.cmd;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
bg_vlist_set(struct bg_vlist *v, size_t i, point_t *p, bg_vlist_cmd_t cmd)
|
||||
{
|
||||
if (i > v->i->v.size() - 1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Actual node info is either in the queue or the local vector
|
||||
vobj &cv = (v->i->q) ? v->i->q->i->objs[v->i->v[i]] : v->i->vlocal[v->i->v[i]];
|
||||
if (p) {
|
||||
VMOVE(cv.p, *p);
|
||||
}
|
||||
if (cmd != BG_VLIST_NULL) {
|
||||
cv.cmd = cmd;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
size_t
|
||||
bg_vlist_find(struct bg_vlist *v, size_t start_ind, bg_vlist_cmd_t cmd, point_t *p)
|
||||
{
|
||||
for (size_t i = 0; i < v->i->v.size(); i++) {
|
||||
if (i < start_ind) {
|
||||
continue;
|
||||
}
|
||||
// Actual node info is either in the queue or the local vector
|
||||
vobj &cv = (v->i->q) ? v->i->q->i->objs[v->i->v[i]] : v->i->vlocal[v->i->v[i]];
|
||||
if (cmd != BG_VLIST_NULL && cv.cmd != cmd) {
|
||||
// If we have a non-NULL command, filter on it
|
||||
continue;
|
||||
}
|
||||
if (p && DIST_PNT_PNT_SQ(*p, cv.p) > VUNITIZE_TOL) {
|
||||
// If we have a non-NULL point, distance filter using it
|
||||
continue;
|
||||
}
|
||||
|
||||
// If we pass all the filters, we have a match
|
||||
return i;
|
||||
}
|
||||
return BG_VLIST_NULL;
|
||||
}
|
||||
|
||||
int
|
||||
bg_vlist_rm(struct bg_vlist *v, size_t i)
|
||||
{
|
||||
if (i > v->i->v.size() - 1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Actual node info is either in the queue or the local vector
|
||||
size_t vind = v->i->v[i];
|
||||
v->i->v.erase(v->i->v.begin() + i);
|
||||
vobj &cv = (v->i->q) ? v->i->q->i->objs[vind] : v->i->vlocal[vind];
|
||||
cv.cmd = BG_VLIST_NULL;
|
||||
VSET(cv.p, LONG_MAX, LONG_MAX, LONG_MAX);
|
||||
if (v->i->q) {
|
||||
v->i->q->i->free_objs.push(vind);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO - if we want to make these routines really efficient, we
|
||||
// should back vlists with an RTree...
|
||||
int long
|
||||
bg_vlist_closest_pt(point_t *cp, struct bg_vlist *v, point_t *tp)
|
||||
{
|
||||
if (!v)
|
||||
return -1;
|
||||
|
||||
point_t p1 = VINIT_ZERO;
|
||||
point_t p2 = VINIT_ZERO;
|
||||
long cind = -1;
|
||||
point_t cpnt, closest_seg_pt;
|
||||
double cdist, cseg;
|
||||
double seg_dist_sq = DBL_MAX;
|
||||
double pdist_min_sq = DBL_MAX;
|
||||
bool have_seg = false;
|
||||
for (size_t i = 0; i < v->i->v.size(); i++) {
|
||||
VMOVE(p1, p2);
|
||||
point_t *np = &p2;
|
||||
bg_vlist_cmd_t cmd = bg_vlist_get(np, v, i);
|
||||
switch (cmd) {
|
||||
case BG_VLIST_POINT_DRAW:
|
||||
// An individual point may be the closest point on its own, but
|
||||
// it does not contribute to a line seg.
|
||||
cdist = DIST_PNT_PNT_SQ(*tp, *np);
|
||||
if (pdist_min_sq > cdist) {
|
||||
pdist_min_sq = cdist;
|
||||
VMOVE(cpnt, *np);
|
||||
cind = i;
|
||||
}
|
||||
break;
|
||||
case BG_VLIST_LINE_MOVE:
|
||||
case BG_VLIST_TRI_MOVE:
|
||||
case BG_VLIST_POLY_MOVE:
|
||||
// Move points indicate the start of a segment.
|
||||
have_seg = true;
|
||||
cdist = DIST_PNT_PNT_SQ(*tp, *np);
|
||||
if (pdist_min_sq > cdist) {
|
||||
pdist_min_sq = cdist;
|
||||
VMOVE(cpnt, *np);
|
||||
cind = i;
|
||||
}
|
||||
break;
|
||||
case BG_VLIST_LINE_DRAW:
|
||||
case BG_VLIST_TRI_DRAW:
|
||||
case BG_VLIST_POLY_DRAW:
|
||||
// Draw commands indicate we have a new segment which is not
|
||||
// the last segment.
|
||||
if (!have_seg) {
|
||||
bu_log("Error: DRAW cmd in vlist with no previous MOVE cmd!\n");
|
||||
}
|
||||
cdist = DIST_PNT_PNT_SQ(*tp, *np);
|
||||
if (pdist_min_sq > cdist) {
|
||||
pdist_min_sq = cdist;
|
||||
VMOVE(cpnt, *np);
|
||||
cind = i;
|
||||
}
|
||||
cseg = bg_distsq_lseg3_pt(&cpnt, p1, p2, *tp);
|
||||
if (cseg < seg_dist_sq) {
|
||||
VMOVE(closest_seg_pt, cpnt);
|
||||
seg_dist_sq = cseg;
|
||||
}
|
||||
break;
|
||||
case BG_VLIST_TRI_END:
|
||||
case BG_VLIST_POLY_END:
|
||||
// Draw commands indicate we have a last segment and the point
|
||||
// we are heading to we have already seen.
|
||||
cseg = bg_distsq_lseg3_pt(&cpnt, p1, p2, *tp);
|
||||
if (cseg < seg_dist_sq) {
|
||||
VMOVE(closest_seg_pt, cpnt);
|
||||
seg_dist_sq = cseg;
|
||||
}
|
||||
// The segment is ended - if there is more data we will need to
|
||||
// initialize another segment.
|
||||
have_seg = false;
|
||||
break;
|
||||
default:
|
||||
// Anything else doesn't contribute to either of these
|
||||
// calculations
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// If we need to return the closest point, sort out whether it's from an lseg
|
||||
// or an individual point:
|
||||
if (cp) {
|
||||
if (pdist_min_sq < seg_dist_sq) {
|
||||
bg_vlist_get(cp, v, cind);
|
||||
} else {
|
||||
VMOVE(*cp, closest_seg_pt);
|
||||
}
|
||||
}
|
||||
|
||||
return cind;
|
||||
}
|
||||
|
||||
int
|
||||
bg_vlist_bbox(point_t *obmin, point_t *obmax, double *poly_length, struct bg_vlist *v)
|
||||
{
|
||||
if (!v)
|
||||
return -1;
|
||||
|
||||
double plength = 0.0;
|
||||
bool have_seg = false;
|
||||
point_t p1 = VINIT_ZERO;
|
||||
point_t p2 = VINIT_ZERO;
|
||||
point_t bmin, bmax;
|
||||
VSETALL(bmin, DBL_MAX);
|
||||
VSETALL(bmax, -DBL_MAX);
|
||||
for (size_t i = 0; i < v->i->v.size(); i++) {
|
||||
VMOVE(p1, p2);
|
||||
point_t *np = &p2;
|
||||
bg_vlist_cmd_t cmd = bg_vlist_get(np, v, i);
|
||||
switch (cmd) {
|
||||
case BG_VLIST_POINT_DRAW:
|
||||
// Individual points contribute to the bbox but not to the
|
||||
// length.
|
||||
have_seg = false;
|
||||
V_MIN(bmin[X], (*np)[X]);
|
||||
V_MAX(bmax[X], (*np)[X]);
|
||||
V_MIN(bmin[Y], (*np)[Y]);
|
||||
V_MAX(bmax[Y], (*np)[Y]);
|
||||
V_MIN(bmin[Z], (*np)[Z]);
|
||||
V_MAX(bmax[Z], (*np)[Z]);
|
||||
break;
|
||||
case BG_VLIST_LINE_MOVE:
|
||||
case BG_VLIST_TRI_MOVE:
|
||||
case BG_VLIST_POLY_MOVE:
|
||||
// Move points indicate the start of a segment.
|
||||
have_seg = true;
|
||||
V_MIN(bmin[X], (*np)[X]);
|
||||
V_MAX(bmax[X], (*np)[X]);
|
||||
V_MIN(bmin[Y], (*np)[Y]);
|
||||
V_MAX(bmax[Y], (*np)[Y]);
|
||||
V_MIN(bmin[Z], (*np)[Z]);
|
||||
V_MAX(bmax[Z], (*np)[Z]);
|
||||
break;
|
||||
case BG_VLIST_LINE_DRAW:
|
||||
case BG_VLIST_TRI_DRAW:
|
||||
case BG_VLIST_POLY_DRAW:
|
||||
// Draw commands indicate we have a new segment which is not
|
||||
// the last segment.
|
||||
if (!have_seg) {
|
||||
bu_log("Error: DRAW cmd in vlist with no previous MOVE cmd!\n");
|
||||
}
|
||||
V_MIN(bmin[X], (*np)[X]);
|
||||
V_MAX(bmax[X], (*np)[X]);
|
||||
V_MIN(bmin[Y], (*np)[Y]);
|
||||
V_MAX(bmax[Y], (*np)[Y]);
|
||||
V_MIN(bmin[Z], (*np)[Z]);
|
||||
V_MAX(bmax[Z], (*np)[Z]);
|
||||
plength += DIST_PNT_PNT(p1, p2);
|
||||
break;
|
||||
case BG_VLIST_TRI_END:
|
||||
case BG_VLIST_POLY_END:
|
||||
// Draw commands indicate we have a last segment and the point
|
||||
// we are heading to we have already seen.
|
||||
plength += DIST_PNT_PNT(p1, p2);
|
||||
// The segment is ended - if there is more data we will need to
|
||||
// initialize another segment.
|
||||
have_seg = false;
|
||||
break;
|
||||
default:
|
||||
// Anything else doesn't contribute to either of these
|
||||
// calculations
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (poly_length) {
|
||||
*poly_length = plength;
|
||||
}
|
||||
if (obmin && obmax) {
|
||||
VMOVE(*obmin, bmin);
|
||||
VMOVE(*obmax, bmax);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static int
|
||||
bn_vlist_bbox_internal(struct bn_vlist *vp, point_t *bmin, point_t *bmax, int *disp_mode)
|
||||
{
|
||||
size_t i;
|
||||
size_t nused = vp->nused;
|
||||
int *cmd = vp->cmd;
|
||||
point_t *pt = vp->pt;
|
||||
|
||||
for (i = 0; i < nused; i++, cmd++, pt++) {
|
||||
if(*disp_mode == 1 && *cmd != BN_VLIST_MODEL_MAT)
|
||||
continue;
|
||||
*disp_mode = 0;
|
||||
switch (*cmd) {
|
||||
case BN_VLIST_POLY_START:
|
||||
case BN_VLIST_POLY_VERTNORM:
|
||||
case BN_VLIST_TRI_START:
|
||||
case BN_VLIST_TRI_VERTNORM:
|
||||
case BN_VLIST_POINT_SIZE:
|
||||
case BN_VLIST_LINE_WIDTH:
|
||||
case BN_VLIST_MODEL_MAT:
|
||||
/* attribute, not location */
|
||||
break;
|
||||
case BN_VLIST_LINE_MOVE:
|
||||
case BN_VLIST_LINE_DRAW:
|
||||
case BN_VLIST_POLY_MOVE:
|
||||
case BN_VLIST_POLY_DRAW:
|
||||
case BN_VLIST_POLY_END:
|
||||
case BN_VLIST_TRI_MOVE:
|
||||
case BN_VLIST_TRI_DRAW:
|
||||
case BN_VLIST_TRI_END:
|
||||
V_MIN((*bmin)[X], (*pt)[X]);
|
||||
V_MAX((*bmax)[X], (*pt)[X]);
|
||||
V_MIN((*bmin)[Y], (*pt)[Y]);
|
||||
V_MAX((*bmax)[Y], (*pt)[Y]);
|
||||
V_MIN((*bmin)[Z], (*pt)[Z]);
|
||||
V_MAX((*bmax)[Z], (*pt)[Z]);
|
||||
break;
|
||||
case BN_VLIST_DISPLAY_MAT:
|
||||
*disp_mode = 1;
|
||||
/* fall through */
|
||||
case BN_VLIST_POINT_DRAW:
|
||||
V_MIN((*bmin)[X], (*pt)[X]-1.0);
|
||||
V_MAX((*bmax)[X], (*pt)[X]+1.0);
|
||||
V_MIN((*bmin)[Y], (*pt)[Y]-1.0);
|
||||
V_MAX((*bmax)[Y], (*pt)[Y]+1.0);
|
||||
V_MIN((*bmin)[Z], (*pt)[Z]-1.0);
|
||||
V_MAX((*bmax)[Z], (*pt)[Z]+1.0);
|
||||
break;
|
||||
default:
|
||||
return *cmd;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bn_vlist_bbox(struct bu_list *vlistp, point_t *bmin, point_t *bmax, int *length)
|
||||
{
|
||||
struct bn_vlist* vp;
|
||||
int cmd = 0;
|
||||
int disp_mode = 0;
|
||||
int len = 0;
|
||||
for (BU_LIST_FOR(vp, bn_vlist, vlistp)) {
|
||||
cmd = bn_vlist_bbox_internal(vp, bmin, bmax, &disp_mode);
|
||||
if (cmd) {
|
||||
break;
|
||||
}
|
||||
len += vp->nused;
|
||||
}
|
||||
if (length){
|
||||
*length = len;
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
|
||||
const char *
|
||||
bn_vlist_get_cmd_description(int cmd)
|
||||
{
|
||||
/* bn_vlist_cmd_descriptions contains descriptions of the first
|
||||
* num_described_cmds vlist cmds
|
||||
*/
|
||||
const int num_described_cmds = 13;
|
||||
static const char *bn_vlist_cmd_descriptions[] = {
|
||||
"line move ",
|
||||
"line draw ",
|
||||
"poly start",
|
||||
"poly move ",
|
||||
"poly draw ",
|
||||
"poly end ",
|
||||
"poly vnorm",
|
||||
"tri start",
|
||||
"tri move",
|
||||
"tri draw",
|
||||
"tri end",
|
||||
"tri vnorm",
|
||||
"point draw",
|
||||
"model mat",
|
||||
"display mat",
|
||||
};
|
||||
if (cmd < num_described_cmds) {
|
||||
return bn_vlist_cmd_descriptions[cmd];
|
||||
} else {
|
||||
return "**unknown*";
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
bn_ck_vlist(const struct bu_list *vhead)
|
||||
{
|
||||
register struct bn_vlist *vp;
|
||||
size_t npts = 0;
|
||||
|
||||
for (BU_LIST_FOR(vp, bn_vlist, vhead)) {
|
||||
size_t i;
|
||||
size_t nused = vp->nused;
|
||||
register int *cmd = vp->cmd;
|
||||
register point_t *pt = vp->pt;
|
||||
|
||||
BN_CK_VLIST(vp);
|
||||
npts += nused;
|
||||
|
||||
for (i = 0; i < nused; i++, cmd++, pt++) {
|
||||
register int j;
|
||||
|
||||
for (j=0; j < 3; j++) {
|
||||
/*
|
||||
* If (*pt)[j] is an IEEE NaN, then all comparisons
|
||||
* between it and any genuine number will return
|
||||
* FALSE. This test is formulated so that NaN values
|
||||
* will activate the "else" clause.
|
||||
*/
|
||||
if ((*pt)[j] > -INFINITY && (*pt)[j] < INFINITY) {
|
||||
/* Number is good */
|
||||
} else {
|
||||
bu_log(" %s (%g, %g, %g)\n",
|
||||
bn_vlist_get_cmd_description(*cmd),
|
||||
V3ARGS(*pt));
|
||||
bu_bomb("bn_ck_vlist() bad coordinate value\n");
|
||||
}
|
||||
/* XXX Need a define for largest command number */
|
||||
if (*cmd < 0 || *cmd > BN_VLIST_CMD_MAX) {
|
||||
bu_log("cmd = x%x (%d.)\n", *cmd, *cmd);
|
||||
bu_bomb("bn_ck_vlist() bad vlist command\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return npts;
|
||||
}
|
||||
|
||||
void
|
||||
bn_vlist_copy(struct bu_list *vlists, struct bu_list *dest, const struct bu_list *src)
|
||||
{
|
||||
struct bn_vlist *vp;
|
||||
|
||||
for (BU_LIST_FOR(vp, bn_vlist, src)) {
|
||||
size_t i;
|
||||
size_t nused = vp->nused;
|
||||
register int *cmd = vp->cmd;
|
||||
register point_t *pt = vp->pt;
|
||||
for (i = 0; i < nused; i++, cmd++, pt++) {
|
||||
BN_ADD_VLIST(vlists, dest, *pt, *cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bn_vlist_cleanup(struct bu_list *hd)
|
||||
{
|
||||
register struct bn_vlist *vp;
|
||||
|
||||
if (!BU_LIST_IS_INITIALIZED(hd)) {
|
||||
BU_LIST_INIT(hd);
|
||||
return;
|
||||
}
|
||||
|
||||
while (BU_LIST_WHILE(vp, bn_vlist, hd)) {
|
||||
BN_CK_VLIST(vp);
|
||||
BU_LIST_DEQUEUE(&(vp->l));
|
||||
bu_free((char *)vp, "bn_vlist");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bn_vlist_export(struct bu_vls *vls, struct bu_list *hp, const char *name)
|
||||
{
|
||||
register struct bn_vlist *vp;
|
||||
size_t nelem;
|
||||
size_t namelen;
|
||||
size_t nbytes;
|
||||
unsigned char *buf;
|
||||
unsigned char *bp;
|
||||
|
||||
BU_CK_VLS(vls);
|
||||
|
||||
/* Count number of element in the vlist */
|
||||
nelem = 0;
|
||||
for (BU_LIST_FOR(vp, bn_vlist, hp)) {
|
||||
nelem += vp->nused;
|
||||
}
|
||||
|
||||
/* Build output buffer for binary transmission
|
||||
* nelem[4], String[n+1], cmds[nelem*1], pts[3*nelem*8]
|
||||
*/
|
||||
namelen = strlen(name)+1;
|
||||
nbytes = namelen + 4 + nelem * (1+ELEMENTS_PER_VECT*SIZEOF_NETWORK_DOUBLE) + 2;
|
||||
|
||||
/* FIXME: this is pretty much an abuse of vls. should be using
|
||||
* vlb for variable-length byte buffers.
|
||||
*/
|
||||
bu_vls_setlen(vls, (int)nbytes);
|
||||
buf = (unsigned char *)bu_vls_addr(vls);
|
||||
*(uint32_t *)buf = htonl((uint32_t)nelem);
|
||||
bp = buf+sizeof(uint32_t);
|
||||
bu_strlcpy((char *)bp, name, namelen);
|
||||
bp += namelen;
|
||||
|
||||
/* Output cmds, as bytes */
|
||||
for (BU_LIST_FOR(vp, bn_vlist, hp)) {
|
||||
size_t i;
|
||||
size_t nused = vp->nused;
|
||||
register int *cmd = vp->cmd;
|
||||
for (i = 0; i < nused; i++) {
|
||||
*bp++ = *cmd++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Output points, as three 8-byte doubles */
|
||||
for (BU_LIST_FOR(vp, bn_vlist, hp)) {
|
||||
size_t i;
|
||||
size_t nused = vp->nused;
|
||||
register point_t *pt = vp->pt;
|
||||
|
||||
/* must be double for import and export */
|
||||
double point[ELEMENTS_PER_POINT];
|
||||
|
||||
for (i = 0; i < nused; i++) {
|
||||
VMOVE(point, pt[i]); /* convert fastf_t to double */
|
||||
bu_cv_htond(bp, (unsigned char *)point, ELEMENTS_PER_VECT);
|
||||
bp += ELEMENTS_PER_VECT*SIZEOF_NETWORK_DOUBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bn_vlist_import(struct bu_list *vlists, struct bu_list *hp, struct bu_vls *namevls, const unsigned char *buf)
|
||||
{
|
||||
register const unsigned char *bp;
|
||||
const unsigned char *pp; /* point pointer */
|
||||
size_t nelem;
|
||||
size_t namelen;
|
||||
size_t i;
|
||||
|
||||
/* must be double for import and export */
|
||||
double point[ELEMENTS_PER_POINT];
|
||||
|
||||
BU_CK_VLS(namevls);
|
||||
|
||||
nelem = ntohl(*(uint32_t *)buf);
|
||||
bp = buf+4;
|
||||
|
||||
namelen = strlen((char *)bp)+1;
|
||||
bu_vls_strncpy(namevls, (char *)bp, namelen);
|
||||
bp += namelen;
|
||||
|
||||
pp = bp + nelem*1;
|
||||
|
||||
for (i=0; i < nelem; i++) {
|
||||
int cmd;
|
||||
|
||||
cmd = *bp++;
|
||||
bu_cv_ntohd((unsigned char *)point, pp, ELEMENTS_PER_POINT);
|
||||
pp += ELEMENTS_PER_POINT*SIZEOF_NETWORK_DOUBLE;
|
||||
BN_ADD_VLIST(vlists, hp, point, cmd);
|
||||
}
|
||||
}
|
||||
|
||||
struct bn_vlblock *
|
||||
bn_vlblock_init(struct bu_list *free_vlist_hd, /**< where to get/put free vlists */
|
||||
int max_ent /**< maximum number of entities to get/put */)
|
||||
{
|
||||
struct bn_vlblock *vbp;
|
||||
size_t i;
|
||||
|
||||
if (!BU_LIST_IS_INITIALIZED(free_vlist_hd))
|
||||
BU_LIST_INIT(free_vlist_hd);
|
||||
|
||||
BU_ALLOC(vbp, struct bn_vlblock);
|
||||
vbp->magic = BN_VLBLOCK_MAGIC;
|
||||
vbp->free_vlist_hd = free_vlist_hd;
|
||||
vbp->max = max_ent;
|
||||
vbp->head = (struct bu_list *)bu_calloc(vbp->max,
|
||||
sizeof(struct bu_list), "head[]");
|
||||
vbp->rgb = (long *)bu_calloc(vbp->max,
|
||||
sizeof(long), "rgb[]");
|
||||
|
||||
for (i=0; i < vbp->max; i++) {
|
||||
vbp->rgb[i] = 0;
|
||||
BU_LIST_INIT(&(vbp->head[i]));
|
||||
}
|
||||
|
||||
vbp->rgb[0] = 0xFFFF00L; /* Yellow, default */
|
||||
vbp->rgb[1] = 0xFFFFFFL; /* White */
|
||||
vbp->nused = 2;
|
||||
|
||||
return vbp;
|
||||
}
|
||||
|
||||
void
|
||||
bn_vlblock_free(struct bn_vlblock *vbp)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
BN_CK_VLBLOCK(vbp);
|
||||
for (i=0; i < vbp->nused; i++) {
|
||||
/* Release any remaining vlist storage */
|
||||
if (vbp->rgb[i] == 0) continue;
|
||||
if (BU_LIST_IS_EMPTY(&(vbp->head[i]))) continue;
|
||||
BN_FREE_VLIST(vbp->free_vlist_hd, &(vbp->head[i]));
|
||||
}
|
||||
|
||||
bu_free((char *)(vbp->head), "head[]");
|
||||
bu_free((char *)(vbp->rgb), "rgb[]");
|
||||
bu_free((char *)vbp, "bn_vlblock");
|
||||
|
||||
}
|
||||
|
||||
struct bu_list *
|
||||
bn_vlblock_find(struct bn_vlblock *vbp, int r, int g, int b)
|
||||
{
|
||||
long newrgb;
|
||||
size_t n;
|
||||
size_t omax; /* old max */
|
||||
|
||||
BN_CK_VLBLOCK(vbp);
|
||||
|
||||
newrgb = ((r&0xFF)<<16)|((g&0xFF)<<8)|(b&0xFF);
|
||||
|
||||
for (n=0; n < vbp->nused; n++) {
|
||||
if (vbp->rgb[n] == newrgb)
|
||||
return &(vbp->head[n]);
|
||||
}
|
||||
if (vbp->nused < vbp->max) {
|
||||
/* Allocate empty slot */
|
||||
n = vbp->nused++;
|
||||
vbp->rgb[n] = newrgb;
|
||||
return &(vbp->head[n]);
|
||||
}
|
||||
|
||||
/************** enlarge the table ****************/
|
||||
omax = vbp->max;
|
||||
vbp->max *= 2;
|
||||
|
||||
/* Look for empty lists and mark for use below. */
|
||||
for (n=0; n < omax; n++)
|
||||
if (BU_LIST_IS_EMPTY(&vbp->head[n]))
|
||||
vbp->head[n].forw = BU_LIST_NULL;
|
||||
|
||||
vbp->head = (struct bu_list *)bu_realloc((void *)vbp->head,
|
||||
vbp->max * sizeof(struct bu_list),
|
||||
"head[]");
|
||||
vbp->rgb = (long *)bu_realloc((void *)vbp->rgb,
|
||||
vbp->max * sizeof(long),
|
||||
"rgb[]");
|
||||
|
||||
/* re-initialize pointers in lower half */
|
||||
for (n=0; n < omax; n++) {
|
||||
/*
|
||||
* Check to see if list is empty
|
||||
* (i.e. yellow and/or white are not used).
|
||||
* Note - we can't use BU_LIST_IS_EMPTY here because
|
||||
* the addresses of the list heads have possibly changed.
|
||||
*/
|
||||
if (vbp->head[n].forw == BU_LIST_NULL) {
|
||||
vbp->head[n].forw = &vbp->head[n];
|
||||
vbp->head[n].back = &vbp->head[n];
|
||||
} else {
|
||||
vbp->head[n].forw->back = &vbp->head[n];
|
||||
vbp->head[n].back->forw = &vbp->head[n];
|
||||
}
|
||||
}
|
||||
|
||||
/* initialize upper half of memory */
|
||||
for (n=omax; n < vbp->max; n++) {
|
||||
vbp->rgb[n] = 0;
|
||||
BU_LIST_INIT(&vbp->head[n]);
|
||||
}
|
||||
|
||||
/* here we go again */
|
||||
return bn_vlblock_find(vbp, r, g, b);
|
||||
}
|
||||
|
||||
void
|
||||
bn_vlist_rpp(struct bu_list *vlists, struct bu_list *hd, const point_t minn, const point_t maxx)
|
||||
{
|
||||
point_t p;
|
||||
|
||||
VSET(p, minn[X], minn[Y], minn[Z]);
|
||||
BN_ADD_VLIST(vlists, hd, p, BN_VLIST_LINE_MOVE);
|
||||
|
||||
/* first side */
|
||||
VSET(p, minn[X], maxx[Y], minn[Z]);
|
||||
BN_ADD_VLIST(vlists, hd, p, BN_VLIST_LINE_DRAW);
|
||||
VSET(p, minn[X], maxx[Y], maxx[Z]);
|
||||
BN_ADD_VLIST(vlists, hd, p, BN_VLIST_LINE_DRAW);
|
||||
VSET(p, minn[X], minn[Y], maxx[Z]);
|
||||
BN_ADD_VLIST(vlists, hd, p, BN_VLIST_LINE_DRAW);
|
||||
VSET(p, minn[X], minn[Y], minn[Z]);
|
||||
BN_ADD_VLIST(vlists, hd, p, BN_VLIST_LINE_DRAW);
|
||||
|
||||
/* across */
|
||||
VSET(p, maxx[X], minn[Y], minn[Z]);
|
||||
BN_ADD_VLIST(vlists, hd, p, BN_VLIST_LINE_DRAW);
|
||||
|
||||
/* second side */
|
||||
VSET(p, maxx[X], maxx[Y], minn[Z]);
|
||||
BN_ADD_VLIST(vlists, hd, p, BN_VLIST_LINE_DRAW);
|
||||
VSET(p, maxx[X], maxx[Y], maxx[Z]);
|
||||
BN_ADD_VLIST(vlists, hd, p, BN_VLIST_LINE_DRAW);
|
||||
VSET(p, maxx[X], minn[Y], maxx[Z]);
|
||||
BN_ADD_VLIST(vlists, hd, p, BN_VLIST_LINE_DRAW);
|
||||
VSET(p, maxx[X], minn[Y], minn[Z]);
|
||||
BN_ADD_VLIST(vlists, hd, p, BN_VLIST_LINE_DRAW);
|
||||
|
||||
/* front edge */
|
||||
VSET(p, minn[X], maxx[Y], minn[Z]);
|
||||
BN_ADD_VLIST(vlists, hd, p, BN_VLIST_LINE_MOVE);
|
||||
VSET(p, maxx[X], maxx[Y], minn[Z]);
|
||||
BN_ADD_VLIST(vlists, hd, p, BN_VLIST_LINE_DRAW);
|
||||
|
||||
/* bottom back */
|
||||
VSET(p, minn[X], minn[Y], maxx[Z]);
|
||||
BN_ADD_VLIST(vlists, hd, p, BN_VLIST_LINE_MOVE);
|
||||
VSET(p, maxx[X], minn[Y], maxx[Z]);
|
||||
BN_ADD_VLIST(vlists, hd, p, BN_VLIST_LINE_DRAW);
|
||||
|
||||
/* top back */
|
||||
VSET(p, minn[X], maxx[Y], maxx[Z]);
|
||||
BN_ADD_VLIST(vlists, hd, p, BN_VLIST_LINE_MOVE);
|
||||
VSET(p, maxx[X], maxx[Y], maxx[Z]);
|
||||
BN_ADD_VLIST(vlists, hd, p, BN_VLIST_LINE_DRAW);
|
||||
}
|
||||
|
||||
void
|
||||
bn_plot_vlblock(FILE *fp, const struct bn_vlblock *vbp)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
BN_CK_VLBLOCK(vbp);
|
||||
|
||||
for (i=0; i < vbp->nused; i++) {
|
||||
if (vbp->rgb[i] == 0) continue;
|
||||
if (BU_LIST_IS_EMPTY(&(vbp->head[i]))) continue;
|
||||
pl_color(fp,
|
||||
(vbp->rgb[i]>>16) & 0xFF,
|
||||
(vbp->rgb[i]>> 8) & 0xFF,
|
||||
(vbp->rgb[i]) & 0xFF);
|
||||
bn_vlist_to_uplot(fp, &(vbp->head[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
bn_vlist_to_uplot(FILE *fp, const struct bu_list *vhead)
|
||||
{
|
||||
register struct bn_vlist *vp;
|
||||
|
||||
for (BU_LIST_FOR(vp, bn_vlist, vhead)) {
|
||||
size_t i;
|
||||
size_t nused = vp->nused;
|
||||
register const int *cmd = vp->cmd;
|
||||
register point_t *pt = vp->pt;
|
||||
|
||||
for (i = 0; i < nused; i++, cmd++, pt++) {
|
||||
switch (*cmd) {
|
||||
case BN_VLIST_POLY_START:
|
||||
case BN_VLIST_TRI_START:
|
||||
break;
|
||||
case BN_VLIST_POLY_MOVE:
|
||||
case BN_VLIST_LINE_MOVE:
|
||||
case BN_VLIST_TRI_MOVE:
|
||||
pdv_3move(fp, *pt);
|
||||
break;
|
||||
case BN_VLIST_POLY_DRAW:
|
||||
case BN_VLIST_POLY_END:
|
||||
case BN_VLIST_LINE_DRAW:
|
||||
case BN_VLIST_TRI_DRAW:
|
||||
case BN_VLIST_TRI_END:
|
||||
pdv_3cont(fp, *pt);
|
||||
break;
|
||||
default:
|
||||
bu_log("bn_vlist_to_uplot: unknown vlist cmd x%x\n",
|
||||
*cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Local Variables:
|
||||
// tab-width: 8
|
||||
// mode: C++
|
||||
// c-basic-offset: 4
|
||||
// indent-tabs-mode: t
|
||||
// c-file-style: "stroustrup"
|
||||
// End:
|
||||
// ex: shiftwidth=4 tabstop=8
|
||||
@@ -614,7 +614,7 @@ int main( int argc, char **argv )
|
||||
}
|
||||
|
||||
/* Need to initialize this for rt_obj_plot, which may call RT_ADD_VLIST */
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree);
|
||||
BU_LIST_INIT(&rtg_vlfree);
|
||||
|
||||
add_path_to_scene(&(osg_nodes), &path, dbip);
|
||||
|
||||
|
||||
Regular → Executable
@@ -420,7 +420,7 @@ evaluate(union tree *tr, const struct bg_tess_tol *ttol, const struct bn_tol *to
|
||||
struct nmgregion *nmgr = BU_LIST_FIRST(nmgregion, &tr->tr_d.td_r->m_p->r_hd);
|
||||
/* the bot temporary format may be unnecessary if we can walk
|
||||
* the nmg shells and generate soup from them directly. */
|
||||
struct rt_bot_internal *bot = nmg_bot(BU_LIST_FIRST(shell, &nmgr->s_hd), &RTG.rtg_vlfree, tol);
|
||||
struct rt_bot_internal *bot = nmg_bot(BU_LIST_FIRST(shell, &nmgr->s_hd), &rtg_vlfree, tol);
|
||||
|
||||
/* causes a crash.
|
||||
nmg_kr(nmgr);
|
||||
|
||||
@@ -178,7 +178,7 @@ gcv_facetize(struct db_i *db, const struct db_full_path *path,
|
||||
/* Now, evaluate the boolean tree into ONE region */
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
if (nmg_boolean(facetize_tree, nmg_model, &RTG.rtg_vlfree, tol, &rt_uniresource)) {
|
||||
if (nmg_boolean(facetize_tree, nmg_model, &rtg_vlfree, tol, &rt_uniresource)) {
|
||||
BU_UNSETJUMP;
|
||||
return _gcv_facetize_cleanup(nmg_model, facetize_tree);
|
||||
}
|
||||
@@ -207,11 +207,11 @@ gcv_facetize(struct db_i *db, const struct db_full_path *path,
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
if (!result)
|
||||
result = nmg_bot(current_shell, &RTG.rtg_vlfree, tol);
|
||||
result = nmg_bot(current_shell, &rtg_vlfree, tol);
|
||||
else {
|
||||
struct rt_bot_internal *bots[2];
|
||||
bots[0] = result;
|
||||
bots[1] = nmg_bot(current_shell, &RTG.rtg_vlfree, tol);
|
||||
bots[1] = nmg_bot(current_shell, &rtg_vlfree, tol);
|
||||
result = rt_bot_merge(sizeof(bots) / sizeof(bots[0]),
|
||||
(const struct rt_bot_internal * const *)bots);
|
||||
_gcv_facetize_free_bot(bots[0]);
|
||||
|
||||
@@ -64,7 +64,7 @@ Tcl_Interp *safe_interp;
|
||||
|
||||
rewind(ifp);
|
||||
bu_vls_trunc(&line, 0);
|
||||
BU_LIST_INIT(&RTG.rtg_headwdb.l);
|
||||
BU_LIST_INIT(&rtg_headwdb.l);
|
||||
|
||||
interp = Tcl_CreateInterp();
|
||||
Go_Init(interp);
|
||||
|
||||
@@ -2433,7 +2433,7 @@ write_nmg_region(nmgregion *nmg_region, const db_full_path *path,
|
||||
for (BU_LIST_FOR(current_shell, shell, &nmg_region->s_hd)) {
|
||||
NMG_CK_SHELL(current_shell);
|
||||
|
||||
rt_bot_internal * const bot = nmg_bot(current_shell, &RTG.rtg_vlfree,
|
||||
rt_bot_internal * const bot = nmg_bot(current_shell, &rtg_vlfree,
|
||||
&data.m_tol);
|
||||
|
||||
// fill in an rt_db_internal with our new bot so we can free it
|
||||
|
||||
@@ -1276,7 +1276,7 @@ populate_triangle_indexes(struct ga_t *ga,
|
||||
if (fu != NULL) {
|
||||
|
||||
/* do simple or robust triangulation based on whether face is concave or convex */
|
||||
if (nmg_lu_is_convex(BU_LIST_FIRST(loopuse, &fu->lu_hd), &RTG.rtg_vlfree, tol)) {
|
||||
if (nmg_lu_is_convex(BU_LIST_FIRST(loopuse, &fu->lu_hd), &rtg_vlfree, tol)) {
|
||||
|
||||
/* compute number of new triangles to create */
|
||||
if (gfi->num_vertices_arr[face_idx] > 3) {
|
||||
@@ -2815,7 +2815,7 @@ output_to_nmg(struct ga_t *ga,
|
||||
if ((ga->gcv_options->verbosity_level > 1) || ga->gcv_options->debug_mode) {
|
||||
bu_log("Running nmg_model_fuse on (%ld) faces from obj file face grouping name (%s), obj file face grouping index (%zu)\n", BU_PTBL_LEN(&faces), bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index + 1);
|
||||
}
|
||||
num_entities_fused = nmg_model_fuse(m, &RTG.rtg_vlfree, tol);
|
||||
num_entities_fused = nmg_model_fuse(m, &rtg_vlfree, tol);
|
||||
if ((ga->gcv_options->verbosity_level > 1) || ga->gcv_options->debug_mode) {
|
||||
bu_log("Completed nmg_model_fuse for obj file face grouping name (%s), obj file face grouping index (%zu)\n", bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index + 1);
|
||||
bu_log("Fused (%d) entities in obj file face grouping name (%s), obj file face grouping index (%zu)\n",
|
||||
@@ -2826,7 +2826,7 @@ output_to_nmg(struct ga_t *ga,
|
||||
if ((ga->gcv_options->verbosity_level > 1) || ga->gcv_options->debug_mode) {
|
||||
bu_log("Running nmg_gluefaces on (%ld) faces from obj file face grouping name (%s), obj file face grouping index (%zu)\n", BU_PTBL_LEN(&faces), bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index + 1);
|
||||
}
|
||||
nmg_gluefaces((struct faceuse **)BU_PTBL_BASEADDR(&faces), BU_PTBL_LEN(&faces), &RTG.rtg_vlfree, tol);
|
||||
nmg_gluefaces((struct faceuse **)BU_PTBL_BASEADDR(&faces), BU_PTBL_LEN(&faces), &rtg_vlfree, tol);
|
||||
if ((ga->gcv_options->verbosity_level > 1) || ga->gcv_options->debug_mode) {
|
||||
bu_log("Completed nmg_gluefaces for obj file face grouping name (%s), obj file face grouping index (%zu)\n", bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index + 1);
|
||||
}
|
||||
@@ -2835,7 +2835,7 @@ output_to_nmg(struct ga_t *ga,
|
||||
if ((ga->gcv_options->verbosity_level > 1) || ga->gcv_options->debug_mode) {
|
||||
bu_log("Running nmg_mark_edges_real with approx (%ld) faces from obj file face grouping name (%s), obj file face grouping index (%zu)\n", BU_PTBL_LEN(&faces), bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index + 1);
|
||||
}
|
||||
(void)nmg_mark_edges_real(&s->l.magic,&RTG.rtg_vlfree);
|
||||
(void)nmg_mark_edges_real(&s->l.magic,&rtg_vlfree);
|
||||
if ((ga->gcv_options->verbosity_level > 1) || ga->gcv_options->debug_mode) {
|
||||
bu_log("Completed nmg_mark_edges_real for obj file face grouping name (%s), obj file face grouping index (%zu)\n", bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index + 1);
|
||||
}
|
||||
@@ -2878,7 +2878,7 @@ output_to_nmg(struct ga_t *ga,
|
||||
if ((ga->gcv_options->verbosity_level > 1) || ga->gcv_options->debug_mode) {
|
||||
bu_log("Running nmg_fix_normals with approx (%ld) faces from obj file face grouping name (%s), obj file face grouping index (%zu)\n", BU_PTBL_LEN(&faces), bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index + 1);
|
||||
}
|
||||
nmg_fix_normals(s, &RTG.rtg_vlfree, tol);
|
||||
nmg_fix_normals(s, &rtg_vlfree, tol);
|
||||
if ((ga->gcv_options->verbosity_level > 1) || ga->gcv_options->debug_mode) {
|
||||
bu_log("Completed nmg_fix_normals for obj file face grouping name (%s), obj file face grouping index (%zu)\n", bu_vls_addr(gfi->raw_grouping_name), gfi->grouping_index + 1);
|
||||
}
|
||||
|
||||
@@ -89,17 +89,17 @@ nmg_to_obj(struct conversion_state *pstate, struct nmgregion *r, const struct db
|
||||
NMG_CK_MODEL(m);
|
||||
|
||||
/* triangulate model */
|
||||
nmg_triangulate_model(m, &RTG.rtg_vlfree, &pstate->gcv_options->calculational_tolerance);
|
||||
nmg_triangulate_model(m, &rtg_vlfree, &pstate->gcv_options->calculational_tolerance);
|
||||
|
||||
/* list all vertices in result */
|
||||
nmg_vertex_tabulate(&verts, &r->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_vertex_tabulate(&verts, &r->l.magic, &rtg_vlfree);
|
||||
|
||||
/* Get number of vertices */
|
||||
numverts = BU_PTBL_LEN(&verts);
|
||||
|
||||
/* get list of vertexuse normals */
|
||||
if (pstate->obj_write_options->do_normals)
|
||||
nmg_vertexuse_normal_tabulate(&norms, &r->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_vertexuse_normal_tabulate(&norms, &r->l.magic, &rtg_vlfree);
|
||||
|
||||
/* BEGIN CHECK SECTION */
|
||||
/* Check vertices */
|
||||
@@ -332,8 +332,8 @@ obj_write_process_boolean(const struct conversion_state *pstate, union tree *cur
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
|
||||
(void)nmg_model_fuse(*tsp->ts_m, &RTG.rtg_vlfree, tsp->ts_tol);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &RTG.rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
(void)nmg_model_fuse(*tsp->ts_m, &rtg_vlfree, tsp->ts_tol);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
|
||||
} else {
|
||||
/* catch */
|
||||
@@ -527,7 +527,7 @@ obj_write(struct gcv_context *context, const struct gcv_opts *gcv_options, const
|
||||
tree_state.ts_m = &the_model;
|
||||
|
||||
the_model = nmg_mm();
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree); /* for vlist macros */
|
||||
BU_LIST_INIT(&rtg_vlfree); /* for vlist macros */
|
||||
|
||||
/* Write out header */
|
||||
if (NEAR_EQUAL(state.gcv_options->scale_factor, 1.0 / 25.4, RT_LEN_TOL))
|
||||
|
||||
@@ -137,7 +137,7 @@ make_model_from_face(const double points[], size_t numPoints)
|
||||
/* add geometry to face */
|
||||
fu = BU_LIST_FIRST(faceuse, &shell->fu_hd);
|
||||
attach_face_g_plane(model, fu->f_p);
|
||||
if (nmg_calc_face_plane(fu, fu->f_p->g.plane_p->N, &RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_plane(fu, fu->f_p->g.plane_p->N, &rtg_vlfree)) {
|
||||
nmg_km(model);
|
||||
model = NULL;
|
||||
} else {
|
||||
@@ -230,7 +230,7 @@ triangulateFace(
|
||||
}
|
||||
|
||||
/* triangulate face */
|
||||
if (nmg_triangulate_fu(fu, &RTG.rtg_vlfree, &tol)) {
|
||||
if (nmg_triangulate_fu(fu, &rtg_vlfree, &tol)) {
|
||||
*faces = NULL;
|
||||
*numFaces = 0;
|
||||
return;
|
||||
|
||||
@@ -200,7 +200,7 @@ nmg_to_stl(struct nmgregion *r, const struct db_full_path *pathp, int UNUSED(reg
|
||||
fprintf(pstate->fp, "solid %s\n", (region_name+1));
|
||||
|
||||
/* triangulate model */
|
||||
nmg_triangulate_model(m, &RTG.rtg_vlfree, &pstate->gcv_options->calculational_tolerance);
|
||||
nmg_triangulate_model(m, &rtg_vlfree, &pstate->gcv_options->calculational_tolerance);
|
||||
|
||||
/* Check triangles */
|
||||
for (BU_LIST_FOR (s, shell, &r->s_hd))
|
||||
@@ -407,7 +407,7 @@ stl_write(struct gcv_context *context, const struct gcv_opts *gcv_options, const
|
||||
|
||||
/* make empty NMG model */
|
||||
state.the_model = nmg_mm();
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree); /* for vlist macros */
|
||||
BU_LIST_INIT(&rtg_vlfree); /* for vlist macros */
|
||||
|
||||
/* Walk indicated tree(s). Each region will be output separately */
|
||||
(void) db_walk_tree(state.dbip, gcv_options->num_objects, (const char **)gcv_options->object_names,
|
||||
|
||||
@@ -789,14 +789,14 @@ nmg_2_vrml(const struct conversion_state *pstate, struct db_tree_state *tsp, con
|
||||
}
|
||||
|
||||
if (!is_light) {
|
||||
nmg_triangulate_model(m, &RTG.rtg_vlfree, tol2);
|
||||
nmg_triangulate_model(m, &rtg_vlfree, tol2);
|
||||
fprintf(pstate->fp_out, "\t\t\t}\n");
|
||||
fprintf(pstate->fp_out, "\t\t\tgeometry IndexedFaceSet {\n");
|
||||
fprintf(pstate->fp_out, "\t\t\t\tcoord Coordinate {\n");
|
||||
}
|
||||
|
||||
/* get list of vertices */
|
||||
nmg_vertex_tabulate(&verts, &m->magic, &RTG.rtg_vlfree);
|
||||
nmg_vertex_tabulate(&verts, &m->magic, &rtg_vlfree);
|
||||
if (!is_light) {
|
||||
fprintf(pstate->fp_out, "\t\t\t\t\tpoint [");
|
||||
} else {
|
||||
@@ -1055,7 +1055,7 @@ vrml_write_process_boolean(struct conversion_state *pstate, union tree *curtree,
|
||||
/* Begin bomb protection */
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &RTG.rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
ret_tree = nmg_booltree_evaluate(curtree, &rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
} else {
|
||||
/* catch */
|
||||
char *name = db_path_to_string(pathp);
|
||||
@@ -1255,7 +1255,7 @@ vrml_write(struct gcv_context *context, const struct gcv_opts *gcv_options, cons
|
||||
nmg_eue_dist = 2.0;
|
||||
}
|
||||
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree); /* for vlist macros */
|
||||
BU_LIST_INIT(&rtg_vlfree); /* for vlist macros */
|
||||
|
||||
fprintf(state.fp_out, "#VRML V2.0 utf8\n");
|
||||
fprintf(state.fp_out, "#Units are %s\n", vrml_write_make_units_str(gcv_options->scale_factor));
|
||||
|
||||
@@ -110,7 +110,7 @@ gcv_region_end(struct db_tree_state *tsp, const struct db_full_path *pathp, unio
|
||||
* curtree to an evaluated result and returns it if the evaluation
|
||||
* is successful.
|
||||
*/
|
||||
ret_tree = nmg_booltree_evaluate(tp, &RTG.rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
ret_tree = nmg_booltree_evaluate(tp, &rtg_vlfree, tsp->ts_tol, &rt_uniresource);
|
||||
} else {
|
||||
/* catch */
|
||||
/* Error, bail out */
|
||||
|
||||
@@ -249,7 +249,7 @@ ged_bev_core(struct ged *gedp, int argc, const char *argv[])
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
failed = nmg_boolean(tmp_tree, bev_nmg_model, &RTG.rtg_vlfree, &gedp->ged_wdbp->wdb_tol, &rt_uniresource);
|
||||
failed = nmg_boolean(tmp_tree, bev_nmg_model, &rtg_vlfree, &gedp->ged_wdbp->wdb_tol, &rt_uniresource);
|
||||
BU_UNSETJUMP;
|
||||
} else
|
||||
failed = 1;
|
||||
@@ -282,7 +282,7 @@ ged_bev_core(struct ged *gedp, int argc, const char *argv[])
|
||||
bev_nmg_model = (struct model *)NULL;
|
||||
return GED_ERROR;
|
||||
}
|
||||
nmg_triangulate_model(bev_nmg_model, &RTG.rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
nmg_triangulate_model(bev_nmg_model, &rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
BU_UNSETJUMP;
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -182,7 +182,7 @@ add_solid(const struct directory *dp,
|
||||
|
||||
if (solid_is_plate_mode_bot
|
||||
|| !eptr->l.m
|
||||
|| (bot = nmg_bot(s, &RTG.rtg_vlfree, &dgcdp->gedp->ged_wdbp->wdb_tol)) == (struct rt_bot_internal *)NULL)
|
||||
|| (bot = nmg_bot(s, &rtg_vlfree, &dgcdp->gedp->ged_wdbp->wdb_tol)) == (struct rt_bot_internal *)NULL)
|
||||
{
|
||||
eptr->l.stp->st_id = id;
|
||||
eptr->l.stp->st_meth = &OBJ[id];
|
||||
@@ -1330,7 +1330,7 @@ Eplot(union E_tree *eptr,
|
||||
}
|
||||
|
||||
if (leaf_ptr->l.m)
|
||||
nmg_edge_tabulate(&leaf_ptr->l.edge_list, &leaf_ptr->l.m->magic, &RTG.rtg_vlfree);
|
||||
nmg_edge_tabulate(&leaf_ptr->l.edge_list, &leaf_ptr->l.m->magic, &rtg_vlfree);
|
||||
else
|
||||
bu_ptbl_init(&leaf_ptr->l.edge_list, 1, "edge_list");
|
||||
}
|
||||
@@ -1775,7 +1775,7 @@ fix_halfs(struct _ged_client_data *dgcdp)
|
||||
nmg_vertex_g(v[1], max[X], max[Y], min[Z]);
|
||||
nmg_vertex_g(v[2], max[X], max[Y], max[Z]);
|
||||
nmg_vertex_g(v[3], max[X], min[Y], max[Z]);
|
||||
nmg_calc_face_g(fu, &RTG.rtg_vlfree);
|
||||
nmg_calc_face_g(fu, &rtg_vlfree);
|
||||
|
||||
vp[0] = &v[4];
|
||||
vp[1] = &v[5];
|
||||
@@ -1786,35 +1786,35 @@ fix_halfs(struct _ged_client_data *dgcdp)
|
||||
nmg_vertex_g(v[5], min[X], min[Y], max[Z]);
|
||||
nmg_vertex_g(v[6], min[X], max[Y], max[Z]);
|
||||
nmg_vertex_g(v[7], min[X], max[Y], min[Z]);
|
||||
nmg_calc_face_g(fu, &RTG.rtg_vlfree);
|
||||
nmg_calc_face_g(fu, &rtg_vlfree);
|
||||
|
||||
vp[0] = &v[0];
|
||||
vp[1] = &v[3];
|
||||
vp[2] = &v[5];
|
||||
vp[3] = &v[4];
|
||||
fu = nmg_cmface(s, vp, 4);
|
||||
nmg_calc_face_g(fu, &RTG.rtg_vlfree);
|
||||
nmg_calc_face_g(fu, &rtg_vlfree);
|
||||
|
||||
vp[0] = &v[1];
|
||||
vp[1] = &v[7];
|
||||
vp[2] = &v[6];
|
||||
vp[3] = &v[2];
|
||||
fu = nmg_cmface(s, vp, 4);
|
||||
nmg_calc_face_g(fu, &RTG.rtg_vlfree);
|
||||
nmg_calc_face_g(fu, &rtg_vlfree);
|
||||
|
||||
vp[0] = &v[3];
|
||||
vp[1] = &v[2];
|
||||
vp[2] = &v[6];
|
||||
vp[3] = &v[5];
|
||||
fu = nmg_cmface(s, vp, 4);
|
||||
nmg_calc_face_g(fu, &RTG.rtg_vlfree);
|
||||
nmg_calc_face_g(fu, &rtg_vlfree);
|
||||
|
||||
vp[0] = &v[1];
|
||||
vp[1] = &v[0];
|
||||
vp[2] = &v[4];
|
||||
vp[3] = &v[7];
|
||||
fu = nmg_cmface(s, vp, 4);
|
||||
nmg_calc_face_g(fu, &RTG.rtg_vlfree);
|
||||
nmg_calc_face_g(fu, &rtg_vlfree);
|
||||
|
||||
nmg_region_a(r, tol);
|
||||
|
||||
@@ -1872,7 +1872,7 @@ fix_halfs(struct _ged_client_data *dgcdp)
|
||||
vcut[1] = new_eu->vu_p;
|
||||
nmg_vertex_gv(vcut[1]->v_p, pt[1]);
|
||||
|
||||
new_lu = nmg_cut_loop(vcut[0], vcut[1], &RTG.rtg_vlfree);
|
||||
new_lu = nmg_cut_loop(vcut[0], vcut[1], &rtg_vlfree);
|
||||
nmg_lu_reorient(lu);
|
||||
nmg_lu_reorient(new_lu);
|
||||
|
||||
@@ -1944,13 +1944,13 @@ fix_halfs(struct _ged_client_data *dgcdp)
|
||||
}
|
||||
|
||||
nmg_rebound(tp->l.m, tol);
|
||||
nmg_model_fuse(tp->l.m, &RTG.rtg_vlfree, tol);
|
||||
nmg_close_shell(s, &RTG.rtg_vlfree, tol);
|
||||
nmg_model_fuse(tp->l.m, &rtg_vlfree, tol);
|
||||
nmg_close_shell(s, &rtg_vlfree, tol);
|
||||
nmg_rebound(tp->l.m, tol);
|
||||
|
||||
BU_ALLOC(pg, struct rt_pg_internal);
|
||||
|
||||
if (!nmg_to_poly(tp->l.m, pg, &RTG.rtg_vlfree, tol)) {
|
||||
if (!nmg_to_poly(tp->l.m, pg, &rtg_vlfree, tol)) {
|
||||
bu_free((char *)pg, "rt_pg_internal");
|
||||
bu_vls_printf(dgcdp->gedp->ged_result_str, "Prep failure for solid '%s'\n", tp->l.stp->st_dp->d_namep);
|
||||
} else {
|
||||
|
||||
@@ -68,7 +68,7 @@ show_dangling_edges(struct ged *gedp, const uint32_t *magic_p, const char *name,
|
||||
}
|
||||
|
||||
bu_ptbl_init(&faces, 64, "faces buffer");
|
||||
nmg_face_tabulate(&faces, magic_p, &RTG.rtg_vlfree);
|
||||
nmg_face_tabulate(&faces, magic_p, &rtg_vlfree);
|
||||
|
||||
cnt = 0;
|
||||
for (i = 0; i < (size_t)BU_PTBL_LEN(&faces) ; i++) {
|
||||
@@ -235,13 +235,13 @@ ged_bot_fuse_core(struct ged *gedp, int argc, const char **argv)
|
||||
|
||||
/* Step 1 -- the vertices. */
|
||||
bu_log("%s: running nmg_vertex_fuse\n", argv[0]);
|
||||
count = nmg_vertex_fuse(&m->magic, &RTG.rtg_vlfree, tol);
|
||||
count = nmg_vertex_fuse(&m->magic, &rtg_vlfree, tol);
|
||||
total += count;
|
||||
bu_log("%s: %s, %d vertex fused\n", argv[0], argv[i+1], count);
|
||||
|
||||
/* Step 1.5 -- break edges on vertices, before fusing edges */
|
||||
bu_log("%s: running nmg_break_e_on_v\n", argv[0]);
|
||||
count = nmg_break_e_on_v(&m->magic, &RTG.rtg_vlfree, tol);
|
||||
count = nmg_break_e_on_v(&m->magic, &rtg_vlfree, tol);
|
||||
total += count;
|
||||
bu_log("%s: %s, %d broke 'e' on 'v'\n", argv[0], argv[i+1], count);
|
||||
|
||||
@@ -257,19 +257,19 @@ ged_bot_fuse_core(struct ged *gedp, int argc, const char **argv)
|
||||
|
||||
for (BU_LIST_FOR(r2, nmgregion, &m->r_hd)) {
|
||||
for (BU_LIST_FOR(s, shell, &r2->s_hd))
|
||||
nmg_make_faces_within_tol(s, &RTG.rtg_vlfree, tol);
|
||||
nmg_make_faces_within_tol(s, &rtg_vlfree, tol);
|
||||
}
|
||||
}
|
||||
|
||||
/* Step 2 -- the face geometry */
|
||||
bu_log("%s: running nmg_model_face_fuse\n", argv[0]);
|
||||
count = nmg_model_face_fuse(m, &RTG.rtg_vlfree, tol);
|
||||
count = nmg_model_face_fuse(m, &rtg_vlfree, tol);
|
||||
total += count;
|
||||
bu_log("%s: %s, %d faces fused\n", argv[0], argv[i+1], count);
|
||||
|
||||
/* Step 3 -- edges */
|
||||
bu_log("%s: running nmg_edge_fuse\n", argv[0]);
|
||||
count = nmg_edge_fuse(&m->magic, &RTG.rtg_vlfree, tol);
|
||||
count = nmg_edge_fuse(&m->magic, &rtg_vlfree, tol);
|
||||
total += count;
|
||||
|
||||
bu_log("%s: %s, %d edges fused\n", argv[0], argv[i+1], count);
|
||||
@@ -280,7 +280,7 @@ ged_bot_fuse_core(struct ged *gedp, int argc, const char **argv)
|
||||
/* try */
|
||||
|
||||
/* convert the nmg model back into a bot */
|
||||
bot = nmg_bot(BU_LIST_FIRST(shell, &r->s_hd), &RTG.rtg_vlfree, tol);
|
||||
bot = nmg_bot(BU_LIST_FIRST(shell, &r->s_hd), &rtg_vlfree, tol);
|
||||
|
||||
bu_vls_sprintf(&name_prefix, "open_edges.%s", argv[i]);
|
||||
bu_log("%s: running show_dangling_edges\n", argv[0]);
|
||||
|
||||
@@ -2459,7 +2459,7 @@ _brep_cmd_face_cdt_plot(void *bs, int argc, const char **argv)
|
||||
|
||||
std::set<int>::iterator e_it;
|
||||
for (e_it = elements.begin(); e_it != elements.end(); e_it++) {
|
||||
brep_facecdt_plot(gib->vls, solid_name, ttol, tol, brep, NULL, vbp, &RTG.rtg_vlfree, *e_it, 0, -1);
|
||||
brep_facecdt_plot(gib->vls, solid_name, ttol, tol, brep, NULL, vbp, &rtg_vlfree, *e_it, 0, -1);
|
||||
}
|
||||
|
||||
struct bu_vls sname = BU_VLS_INIT_ZERO;
|
||||
@@ -2503,7 +2503,7 @@ _brep_cmd_face_cdt_2d_plot(void *bs, int argc, const char **argv)
|
||||
|
||||
std::set<int>::iterator e_it;
|
||||
for (e_it = elements.begin(); e_it != elements.end(); e_it++) {
|
||||
brep_facecdt_plot(gib->vls, solid_name, ttol, tol, brep, NULL, vbp, &RTG.rtg_vlfree, *e_it, 2, -1);
|
||||
brep_facecdt_plot(gib->vls, solid_name, ttol, tol, brep, NULL, vbp, &rtg_vlfree, *e_it, 2, -1);
|
||||
}
|
||||
|
||||
struct bu_vls sname = BU_VLS_INIT_ZERO;
|
||||
@@ -2547,7 +2547,7 @@ _brep_cmd_face_cdt_m2d_plot(void *bs, int argc, const char **argv)
|
||||
|
||||
std::set<int>::iterator e_it;
|
||||
for (e_it = elements.begin(); e_it != elements.end(); e_it++) {
|
||||
brep_facecdt_plot(gib->vls, solid_name, ttol, tol, brep, NULL, vbp, &RTG.rtg_vlfree, *e_it, 3, -1);
|
||||
brep_facecdt_plot(gib->vls, solid_name, ttol, tol, brep, NULL, vbp, &rtg_vlfree, *e_it, 3, -1);
|
||||
}
|
||||
|
||||
struct bu_vls sname = BU_VLS_INIT_ZERO;
|
||||
@@ -2591,7 +2591,7 @@ _brep_cmd_face_cdt_p2d_plot(void *bs, int argc, const char **argv)
|
||||
|
||||
std::set<int>::iterator e_it;
|
||||
for (e_it = elements.begin(); e_it != elements.end(); e_it++) {
|
||||
brep_facecdt_plot(gib->vls, solid_name, ttol, tol, brep, NULL, vbp, &RTG.rtg_vlfree, *e_it, 4, -1);
|
||||
brep_facecdt_plot(gib->vls, solid_name, ttol, tol, brep, NULL, vbp, &rtg_vlfree, *e_it, 4, -1);
|
||||
}
|
||||
|
||||
struct bu_vls sname = BU_VLS_INIT_ZERO;
|
||||
@@ -2635,7 +2635,7 @@ _brep_cmd_face_cdt_wireframe_plot(void *bs, int argc, const char **argv)
|
||||
|
||||
std::set<int>::iterator e_it;
|
||||
for (e_it = elements.begin(); e_it != elements.end(); e_it++) {
|
||||
brep_facecdt_plot(gib->vls, solid_name, ttol, tol, brep, NULL, vbp, &RTG.rtg_vlfree, *e_it, 1, -1);
|
||||
brep_facecdt_plot(gib->vls, solid_name, ttol, tol, brep, NULL, vbp, &rtg_vlfree, *e_it, 1, -1);
|
||||
}
|
||||
|
||||
struct bu_vls sname = BU_VLS_INIT_ZERO;
|
||||
@@ -2696,7 +2696,7 @@ _brep_cmd_face_cdt2_plot(void *bs, int argc, const char **argv)
|
||||
ON_Brep_CDT_Tessellate(s_cdt, 0, NULL);
|
||||
}
|
||||
|
||||
ON_Brep_CDT_VList(vbp, &RTG.rtg_vlfree, &c, 0, s_cdt);
|
||||
ON_Brep_CDT_VList(vbp, &rtg_vlfree, &c, 0, s_cdt);
|
||||
ON_Brep_CDT_Destroy(s_cdt);
|
||||
|
||||
struct bu_vls sname = BU_VLS_INIT_ZERO;
|
||||
@@ -2755,7 +2755,7 @@ _brep_cmd_face_cdt2_2d_plot(void *bs, int argc, const char **argv)
|
||||
ON_Brep_CDT_Tol_Set(s_cdt, &cdttol);
|
||||
|
||||
ON_Brep_CDT_Tessellate(s_cdt, face_cnt, faces);
|
||||
ON_Brep_CDT_VList(vbp, &RTG.rtg_vlfree, &c, 2, s_cdt);
|
||||
ON_Brep_CDT_VList(vbp, &rtg_vlfree, &c, 2, s_cdt);
|
||||
ON_Brep_CDT_Destroy(s_cdt);
|
||||
bu_free(faces, "free face array");
|
||||
|
||||
@@ -2815,7 +2815,7 @@ _brep_cmd_face_cdt2_wireframe_plot(void *bs, int argc, const char **argv)
|
||||
ON_Brep_CDT_Tol_Set(s_cdt, &cdttol);
|
||||
|
||||
ON_Brep_CDT_Tessellate(s_cdt, face_cnt, faces);
|
||||
ON_Brep_CDT_VList(vbp, &RTG.rtg_vlfree, &c, 1, s_cdt);
|
||||
ON_Brep_CDT_VList(vbp, &rtg_vlfree, &c, 1, s_cdt);
|
||||
ON_Brep_CDT_Destroy(s_cdt);
|
||||
bu_free(faces, "free face array");
|
||||
|
||||
|
||||
@@ -113,14 +113,14 @@ ged_decompose_core(struct ged *gedp, int argc, const char *argv[])
|
||||
long **trans_tbl;
|
||||
|
||||
/* duplicate shell */
|
||||
tmp_s = (struct shell *)nmg_dup_shell(s, &trans_tbl, &RTG.rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
tmp_s = (struct shell *)nmg_dup_shell(s, &trans_tbl, &rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
bu_free((char *)trans_tbl, "trans_tbl");
|
||||
|
||||
/* move duplicate to temp region */
|
||||
(void) nmg_mv_shell_to_region(tmp_s, tmp_r);
|
||||
|
||||
/* decompose this shell */
|
||||
(void) nmg_decompose_shell(tmp_s, &RTG.rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
(void) nmg_decompose_shell(tmp_s, &rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
|
||||
/* move each decomposed shell to yet another region */
|
||||
decomp_s = BU_LIST_FIRST(shell, &tmp_r->s_hd);
|
||||
@@ -139,11 +139,11 @@ ged_decompose_core(struct ged *gedp, int argc, const char *argv[])
|
||||
kill_s = BU_LIST_FIRST(shell, &decomp_r->s_hd);
|
||||
(void)nmg_ks(kill_s);
|
||||
nmg_shell_a(decomp_s, &gedp->ged_wdbp->wdb_tol);
|
||||
new_s = (struct shell *)nmg_dup_shell(decomp_s, &trans_tbl, &RTG.rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
new_s = (struct shell *)nmg_dup_shell(decomp_s, &trans_tbl, &rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
(void)nmg_mv_shell_to_region(new_s, decomp_r);
|
||||
|
||||
/* move this region to a different model */
|
||||
new_m = (struct model *)nmg_mk_model_from_region(decomp_r, 1, &RTG.rtg_vlfree);
|
||||
new_m = (struct model *)nmg_mk_model_from_region(decomp_r, 1, &rtg_vlfree);
|
||||
(void)nmg_rebound(new_m, &gedp->ged_wdbp->wdb_tol);
|
||||
|
||||
/* create name for this shell */
|
||||
|
||||
@@ -401,7 +401,7 @@ process_boolean(union tree *curtree, struct db_tree_state *tsp, const struct db_
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
|
||||
result = nmg_boolean(curtree, *tsp->ts_m, &RTG.rtg_vlfree, tsp->ts_tol, tsp->ts_resp);
|
||||
result = nmg_boolean(curtree, *tsp->ts_m, &rtg_vlfree, tsp->ts_tol, tsp->ts_resp);
|
||||
|
||||
} else {
|
||||
/* catch */
|
||||
@@ -425,7 +425,7 @@ process_triangulation(struct db_tree_state *tsp, const struct db_full_path *path
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
|
||||
nmg_triangulate_model(*tsp->ts_m, &RTG.rtg_vlfree, tsp->ts_tol);
|
||||
nmg_triangulate_model(*tsp->ts_m, &rtg_vlfree, tsp->ts_tol);
|
||||
result = 0;
|
||||
|
||||
} else {
|
||||
@@ -525,12 +525,12 @@ draw_nmg_region_end(struct db_tree_state *tsp, const struct db_full_path *pathp,
|
||||
if (dgcdp->draw_no_surfaces) {
|
||||
style |= NMG_VLIST_STYLE_NO_SURFACES;
|
||||
}
|
||||
nmg_r_to_vlist(&vhead, r, style, &RTG.rtg_vlfree);
|
||||
nmg_r_to_vlist(&vhead, r, style, &rtg_vlfree);
|
||||
|
||||
_ged_drawH_part2(0, &vhead, pathp, tsp, dgcdp);
|
||||
|
||||
if (dgcdp->draw_edge_uses) {
|
||||
nmg_vlblock_r(dgcdp->draw_edge_uses_vbp, r, 1, &RTG.rtg_vlfree);
|
||||
nmg_vlblock_r(dgcdp->draw_edge_uses_vbp, r, 1, &rtg_vlfree);
|
||||
}
|
||||
/* NMG region is no longer necessary, only vlist remains */
|
||||
db_free_tree(curtree, tsp->ts_resp);
|
||||
|
||||
@@ -570,7 +570,7 @@ _try_nmg_facetize(struct ged *gedp, int argc, const char **argv, int nmg_use_tnu
|
||||
if (facetize_tree) {
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
failed = nmg_boolean(facetize_tree, nmg_model, &RTG.rtg_vlfree, &gedp->ged_wdbp->wdb_tol, &rt_uniresource);
|
||||
failed = nmg_boolean(facetize_tree, nmg_model, &rtg_vlfree, &gedp->ged_wdbp->wdb_tol, &rt_uniresource);
|
||||
} else {
|
||||
/* catch */
|
||||
BU_UNSETJUMP;
|
||||
@@ -603,7 +603,7 @@ _try_nmg_triangulate(struct ged *gedp, struct model *nmg_model, struct _ged_face
|
||||
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
nmg_triangulate_model(nmg_model, &RTG.rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
nmg_triangulate_model(nmg_model, &rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
} else {
|
||||
/* catch */
|
||||
BU_UNSETJUMP;
|
||||
@@ -622,7 +622,7 @@ _try_nmg_to_bot(struct ged *gedp, struct model *nmg_model, struct _ged_facetize_
|
||||
_ged_facetize_log_nmg(o);
|
||||
if (!BU_SETJUMP) {
|
||||
/* try */
|
||||
bot = (struct rt_bot_internal *)nmg_mdl_to_bot(nmg_model, &RTG.rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
bot = (struct rt_bot_internal *)nmg_mdl_to_bot(nmg_model, &rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
} else {
|
||||
/* catch */
|
||||
BU_UNSETJUMP;
|
||||
|
||||
@@ -654,6 +654,55 @@ _ged_facetize_log_nmg(struct _ged_facetize_opts *o);
|
||||
void
|
||||
_ged_facetize_log_default(struct _ged_facetize_opts *o);
|
||||
|
||||
struct ged_qray_color {
|
||||
unsigned char r;
|
||||
unsigned char g;
|
||||
unsigned char b;
|
||||
};
|
||||
|
||||
struct ged_qray_fmt {
|
||||
char type;
|
||||
struct bu_vls fmt;
|
||||
};
|
||||
|
||||
/* FIXME: leftovers from dg.h */
|
||||
#define RT_VDRW_PREFIX "_VDRW"
|
||||
#define RT_VDRW_PREFIX_LEN 6
|
||||
#define RT_VDRW_MAXNAME 31
|
||||
#define RT_VDRW_DEF_COLOR 0xffff00
|
||||
|
||||
struct vd_curve {
|
||||
struct bu_list l;
|
||||
char vdc_name[RT_VDRW_MAXNAME+1]; /**< @brief name array */
|
||||
long vdc_rgb; /**< @brief color */
|
||||
struct bu_list vdc_vhd; /**< @brief head of list of vertices */
|
||||
};
|
||||
#define VD_CURVE_NULL ((struct vd_curve *)NULL)
|
||||
|
||||
|
||||
struct ged_drawable {
|
||||
struct bu_list *gd_headDisplay; /**< @brief head of display list */
|
||||
struct bu_list *gd_headVDraw; /**< @brief head of vdraw list */
|
||||
struct vd_curve *gd_currVHead; /**< @brief current vdraw head */
|
||||
|
||||
char **gd_rt_cmd; /* DEPRECATED - will be removed, do not use */
|
||||
int gd_rt_cmd_len; /* DEPRECATED - will be removed, do not use */
|
||||
|
||||
int gd_uplotOutputMode; /**< @brief output mode for unix plots */
|
||||
|
||||
/* qray state */
|
||||
struct bu_vls gd_qray_basename; /**< @brief basename of query ray vlist */
|
||||
struct bu_vls gd_qray_script; /**< @brief query ray script */
|
||||
char gd_qray_effects; /**< @brief t for text, g for graphics or b for both */
|
||||
int gd_qray_cmd_echo; /**< @brief 0 - don't echo command, 1 - echo command */
|
||||
struct ged_qray_fmt *gd_qray_fmts;
|
||||
struct ged_qray_color gd_qray_odd_color;
|
||||
struct ged_qray_color gd_qray_even_color;
|
||||
struct ged_qray_color gd_qray_void_color;
|
||||
struct ged_qray_color gd_qray_overlap_color;
|
||||
int gd_shaded_mode; /**< @brief 1 - draw bots shaded by default */
|
||||
};
|
||||
|
||||
|
||||
GED_EXPORT extern int ged_snap_lines(point_t *out_pt, struct ged *gedp, point_t *p);
|
||||
GED_EXPORT extern int ged_view_snap(struct ged *gedp, int argc, const char *argv[]);
|
||||
|
||||
+10
-2
@@ -1381,8 +1381,8 @@ _ged_rt_output_handler(void *clientData, int UNUSED(mask))
|
||||
else
|
||||
bu_log("Raytrace complete.\n");
|
||||
|
||||
if (gedp->ged_gdp->gd_rtCmdNotify != (void (*)(int))0)
|
||||
gedp->ged_gdp->gd_rtCmdNotify(aborted);
|
||||
if (gedp->ged_rtCmdNotify != (void (*)(int))0)
|
||||
gedp->ged_rtCmdNotify(aborted);
|
||||
|
||||
/* free rrtp */
|
||||
bu_ptbl_rm(&gedp->ged_subp, (long *)rrtp);
|
||||
@@ -2042,6 +2042,14 @@ _ged_scale_metaball(struct ged *gedp, struct rt_metaball_internal *mbip, const c
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
struct bu_list *
|
||||
ged_drawable_head_dl(struct ged *gedp)
|
||||
{
|
||||
if (!gedp || !gedp->ged_gdp)
|
||||
return NULL;
|
||||
return gedp->ged_gdp->gd_headDisplay;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
// TODO - need to generalize the path specifier parsing per notes in TODO. This is a first
|
||||
|
||||
+6
-6
@@ -326,14 +326,14 @@ arbin(struct ged *gedp,
|
||||
* This does all the vertices
|
||||
*/
|
||||
bu_ptbl_init(&vert_tab, 64, "vert_tab");
|
||||
nmg_vertex_tabulate(&vert_tab, &m->magic, &RTG.rtg_vlfree);
|
||||
nmg_vertex_tabulate(&vert_tab, &m->magic, &rtg_vlfree);
|
||||
for (i = 0; i < BU_PTBL_LEN(&vert_tab); i++) {
|
||||
struct vertex *v;
|
||||
|
||||
v = (struct vertex *)BU_PTBL_GET(&vert_tab, i);
|
||||
NMG_CK_VERTEX(v);
|
||||
|
||||
if (nmg_in_vert(v, 0, &RTG.rtg_vlfree, &gedp->ged_wdbp->wdb_tol)) {
|
||||
if (nmg_in_vert(v, 0, &rtg_vlfree, &gedp->ged_wdbp->wdb_tol)) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Could not find coordinates for inside arb7\n");
|
||||
nmg_km(m);
|
||||
bu_ptbl_free(&vert_tab);
|
||||
@@ -345,13 +345,13 @@ arbin(struct ged *gedp,
|
||||
/* rebound model */
|
||||
nmg_rebound(m, &gedp->ged_wdbp->wdb_tol);
|
||||
|
||||
nmg_extrude_cleanup(s, 0, &RTG.rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
nmg_extrude_cleanup(s, 0, &rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
|
||||
/* free old ip pointer */
|
||||
rt_db_free_internal(ip);
|
||||
|
||||
/* convert the NMG to a BOT */
|
||||
bot = (struct rt_bot_internal *)nmg_bot(s, &RTG.rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
bot = (struct rt_bot_internal *)nmg_bot(s, &rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
nmg_km(m);
|
||||
|
||||
/* put new solid in "ip" */
|
||||
@@ -870,9 +870,9 @@ nmgin(struct ged *gedp, struct rt_db_internal *ip, fastf_t thick)
|
||||
|
||||
next_s = BU_LIST_PNEXT(shell, &s->l);
|
||||
|
||||
nmg_shell_coplanar_face_merge(s, &gedp->ged_wdbp->wdb_tol, 1, &RTG.rtg_vlfree);
|
||||
nmg_shell_coplanar_face_merge(s, &gedp->ged_wdbp->wdb_tol, 1, &rtg_vlfree);
|
||||
if (!nmg_kill_cracks(s))
|
||||
(void)nmg_extrude_shell(s, thick, 0, 0, &RTG.rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
(void)nmg_extrude_shell(s, thick, 0, 0, &rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
|
||||
s = next_s;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ ged_nmg_cmface_core(struct ged *gedp, int argc, const char *argv[])
|
||||
if (fu->orientation != OT_SAME) {
|
||||
continue;
|
||||
}
|
||||
nmg_calc_face_g(fu, &RTG.rtg_vlfree);
|
||||
nmg_calc_face_g(fu, &rtg_vlfree);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ ged_nmg_collapse_core(struct ged *gedp, int argc, const char *argv[])
|
||||
NMG_CK_MODEL(m);
|
||||
|
||||
/* check that all faces are planar */
|
||||
nmg_face_tabulate(&faces, &m->magic, &RTG.rtg_vlfree);
|
||||
nmg_face_tabulate(&faces, &m->magic, &rtg_vlfree);
|
||||
for (BU_PTBL_FOR(fp, (struct face *), &faces)) {
|
||||
if (fp->g.magic_p != NULL && *(fp->g.magic_p) != NMG_FACE_G_PLANE_MAGIC) {
|
||||
bu_log("\tnot planar\n");
|
||||
@@ -129,9 +129,9 @@ ged_nmg_collapse_core(struct ged *gedp, int argc, const char *argv[])
|
||||
bu_ptbl_free(&faces);
|
||||
|
||||
/* triangulate model */
|
||||
nmg_triangulate_model(m, &RTG.rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
nmg_triangulate_model(m, &rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
|
||||
count = (size_t)nmg_edge_collapse(m, &gedp->ged_wdbp->wdb_tol, tol_coll, min_angle, &RTG.rtg_vlfree);
|
||||
count = (size_t)nmg_edge_collapse(m, &gedp->ged_wdbp->wdb_tol, tol_coll, min_angle, &rtg_vlfree);
|
||||
|
||||
dp = db_diradd(gedp->ged_wdbp->dbip, new_name, RT_DIR_PHONY_ADDR, 0, RT_DIR_SOLID, (void *)&intern.idb_type);
|
||||
if (dp == RT_DIR_NULL) {
|
||||
|
||||
@@ -88,7 +88,7 @@ ged_nmg_fix_normals_core(struct ged *gedp, int argc, const char *argv[])
|
||||
/* hum, here we go */
|
||||
for (BU_LIST_FOR(r, nmgregion, &m->r_hd))
|
||||
for (BU_LIST_FOR(s, shell, &r->s_hd))
|
||||
nmg_fix_normals(s, &RTG.rtg_vlfree, &tol);
|
||||
nmg_fix_normals(s, &rtg_vlfree, &tol);
|
||||
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ ged_nmg_simplify_core(struct ged *gedp, int argc, const char *argv[])
|
||||
NMG_CK_MODEL(m);
|
||||
|
||||
/* check that all faces are planar */
|
||||
nmg_face_tabulate(&faces, &m->magic, &RTG.rtg_vlfree);
|
||||
nmg_face_tabulate(&faces, &m->magic, &rtg_vlfree);
|
||||
|
||||
for (i = 0 ; i < BU_PTBL_LEN(&faces) ; i++) {
|
||||
fp = (struct face *)BU_PTBL_GET(&faces, i);
|
||||
@@ -172,8 +172,8 @@ ged_nmg_simplify_core(struct ged *gedp, int argc, const char *argv[])
|
||||
|
||||
r = BU_LIST_FIRST(nmgregion, &m->r_hd);
|
||||
s = BU_LIST_FIRST(shell, &r->s_hd);
|
||||
nmg_shell_coplanar_face_merge(s, &gedp->ged_wdbp->wdb_tol, 0, &RTG.rtg_vlfree);
|
||||
nmg_simplify_shell(s, &RTG.rtg_vlfree);
|
||||
nmg_shell_coplanar_face_merge(s, &gedp->ged_wdbp->wdb_tol, 0, &rtg_vlfree);
|
||||
nmg_simplify_shell(s, &rtg_vlfree);
|
||||
|
||||
if (nmg_to_arb(m, arb_int)) {
|
||||
success = 1;
|
||||
@@ -225,7 +225,7 @@ ged_nmg_simplify_core(struct ged *gedp, int argc, const char *argv[])
|
||||
new_intern.idb_type = ID_POLY;
|
||||
new_intern.idb_meth = &OBJ[ID_POLY];
|
||||
|
||||
if (nmg_to_poly(m, poly_int, &RTG.rtg_vlfree, &gedp->ged_wdbp->wdb_tol)) {
|
||||
if (nmg_to_poly(m, poly_int, &rtg_vlfree, &gedp->ged_wdbp->wdb_tol)) {
|
||||
success = 1;
|
||||
ret = GED_OK;
|
||||
goto out1;
|
||||
|
||||
Regular → Executable
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "vmath.h"
|
||||
#include "ged.h"
|
||||
#include "./ged_private.h"
|
||||
|
||||
#include "./qray.h"
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "vmath.h"
|
||||
#include "ged.h"
|
||||
#include "../ged_private.h"
|
||||
|
||||
#include "../qray.h"
|
||||
|
||||
|
||||
@@ -149,8 +149,8 @@ rtcheck_output_handler(void *clientData, int UNUSED(mask))
|
||||
/* Get textual output from rtcheck */
|
||||
if (bu_process_read((char *)line, &count, rrtp->p, BU_PROCESS_STDERR, RT_MAXLINE) <= 0) {
|
||||
rtcp->read_failed = 1;
|
||||
if (gedp->ged_gdp->gd_rtCmdNotify != (void (*)(int))0)
|
||||
gedp->ged_gdp->gd_rtCmdNotify(0);
|
||||
if (gedp->ged_rtCmdNotify != (void (*)(int))0)
|
||||
gedp->ged_rtCmdNotify(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,8 +25,9 @@
|
||||
|
||||
#include "common.h"
|
||||
#include <string.h>
|
||||
#include "ged.h"
|
||||
#include "bn/plot3.h"
|
||||
#include "ged.h"
|
||||
#include "../ged_private.h"
|
||||
|
||||
/*
|
||||
* Set/get the unix plot output mode
|
||||
|
||||
@@ -81,7 +81,7 @@ ged_shells_core(struct ged *gedp, int argc, const char *argv[])
|
||||
|
||||
for (BU_LIST_FOR(r, nmgregion, &m->r_hd)) {
|
||||
for (BU_LIST_FOR(s, shell, &r->s_hd)) {
|
||||
s_tmp = nmg_dup_shell(s, &trans_tbl, &RTG.rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
s_tmp = nmg_dup_shell(s, &trans_tbl, &rtg_vlfree, &gedp->ged_wdbp->wdb_tol);
|
||||
bu_free((void *)trans_tbl, "trans_tbl");
|
||||
|
||||
m_tmp = nmg_mmr();
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
#include "ged.h"
|
||||
|
||||
#include "../ged_private.h"
|
||||
|
||||
/*
|
||||
* List the objects currently prepped for drawing
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@
|
||||
|
||||
unsigned int rt_debug = 0;
|
||||
|
||||
struct rt_g RTG = RT_G_INIT_ZERO;
|
||||
struct bu_list rtg_vlfree = BU_LIST_INIT_ZERO;
|
||||
|
||||
struct resource rt_uniresource = RT_RESOURCE_INIT_ZERO;
|
||||
|
||||
|
||||
+2
-2
@@ -75,7 +75,7 @@ rt_new_rti(struct db_i *dbip)
|
||||
RT_CK_DBI(dbip);
|
||||
|
||||
/* XXX Move to rt_global_init() ? */
|
||||
if (BU_LIST_FIRST(bu_list, &RTG.rtg_vlfree) == 0) {
|
||||
if (BU_LIST_FIRST(bu_list, &rtg_vlfree) == 0) {
|
||||
char *debug_flags;
|
||||
debug_flags = getenv("LIBRT_DEBUG");
|
||||
if (debug_flags) {
|
||||
@@ -86,7 +86,7 @@ rt_new_rti(struct db_i *dbip)
|
||||
}
|
||||
}
|
||||
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree);
|
||||
BU_LIST_INIT(&rtg_vlfree);
|
||||
}
|
||||
|
||||
BU_ALLOC(rtip, struct rt_i);
|
||||
|
||||
@@ -151,7 +151,7 @@ ant_label_dimensions(struct txt_seg* tsg, hpoint_t ref_pt, fastf_t* length, fast
|
||||
VSET(bmin, INFINITY, INFINITY, INFINITY);
|
||||
VSET(bmax, -INFINITY, -INFINITY, -INFINITY);
|
||||
|
||||
bn_vlist_2string(&vhead, &RTG.rtg_vlfree, tsg->label.vls_str, ref_pt[0], ref_pt[1], 5, 0);
|
||||
bn_vlist_2string(&vhead, &rtg_vlfree, tsg->label.vls_str, ref_pt[0], ref_pt[1], 5, 0);
|
||||
bn_vlist_bbox(&vhead, &bmin, &bmax, NULL);
|
||||
|
||||
*length = bmax[0] - ref_pt[0];
|
||||
@@ -453,7 +453,7 @@ seg_to_vlist(struct bu_list *vhead, const struct bg_tess_tol *ttol, fastf_t *V,
|
||||
}
|
||||
ant_pos_adjs(tsg, annot_ip);
|
||||
V2ADD2(pt, V, annot_ip->verts[tsg->ref_pt]);
|
||||
bn_vlist_2string(vhead, &RTG.rtg_vlfree, tsg->label.vls_str, pt[0], pt[1], 5, 0);
|
||||
bn_vlist_2string(vhead, &rtg_vlfree, tsg->label.vls_str, pt[0], pt[1], 5, 0);
|
||||
break;
|
||||
case CURVE_CARC_MAGIC:
|
||||
{
|
||||
|
||||
@@ -1565,13 +1565,13 @@ rt_arb_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
}
|
||||
|
||||
/* Mark edges as real */
|
||||
(void)nmg_mark_edges_real(&s->l.magic, &RTG.rtg_vlfree);
|
||||
(void)nmg_mark_edges_real(&s->l.magic, &rtg_vlfree);
|
||||
|
||||
/* Compute "geometry" for region and shell */
|
||||
nmg_region_a(*r, tol);
|
||||
|
||||
/* Some arbs may not be within tolerance, so triangulate faces where needed */
|
||||
nmg_make_faces_within_tol(s, &RTG.rtg_vlfree, tol);
|
||||
nmg_make_faces_within_tol(s, &rtg_vlfree, tol);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1746,7 +1746,7 @@ rt_arb_tnurb(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, c
|
||||
|
||||
|
||||
/* Mark edges as real */
|
||||
(void)nmg_mark_edges_real(&s->l.magic, &RTG.rtg_vlfree);
|
||||
(void)nmg_mark_edges_real(&s->l.magic, &rtg_vlfree);
|
||||
|
||||
/* Compute "geometry" for region and shell */
|
||||
nmg_region_a(*r, tol);
|
||||
|
||||
@@ -777,9 +777,9 @@ rt_arbn_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, c
|
||||
|
||||
bu_free((char *)fu, "rt_arbn_tess: fu");
|
||||
|
||||
nmg_fix_normals(s, &RTG.rtg_vlfree, tol);
|
||||
nmg_fix_normals(s, &rtg_vlfree, tol);
|
||||
|
||||
(void)nmg_mark_edges_real(&s->l.magic, &RTG.rtg_vlfree);
|
||||
(void)nmg_mark_edges_real(&s->l.magic, &rtg_vlfree);
|
||||
|
||||
/* Compute "geometry" for region and shell */
|
||||
nmg_region_a(*r, tol);
|
||||
|
||||
@@ -554,7 +554,7 @@ rt_ars_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
ASSOC_GEOM(0, 0, 0);
|
||||
ASSOC_GEOM(1, 0, 1);
|
||||
ASSOC_GEOM(2, 1, 1);
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
bu_log("Degenerate face created, will kill it later\n");
|
||||
bu_ptbl_ins(&kill_fus, (long *)fu);
|
||||
}
|
||||
@@ -585,7 +585,7 @@ rt_ars_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
ASSOC_GEOM(0, 1, 0);
|
||||
ASSOC_GEOM(1, 0, 0);
|
||||
ASSOC_GEOM(2, 1, 1);
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
bu_log("Degenerate face created, will kill it later\n");
|
||||
bu_ptbl_ins(&kill_fus, (long *)fu);
|
||||
}
|
||||
@@ -605,16 +605,16 @@ rt_ars_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
/* ARS solids are often built with incorrect face normals. Don't
|
||||
* depend on them to be correct.
|
||||
*/
|
||||
nmg_fix_normals(s, &RTG.rtg_vlfree, tol);
|
||||
nmg_fix_normals(s, &rtg_vlfree, tol);
|
||||
|
||||
/* set edge's is_real flag */
|
||||
nmg_mark_edges_real(&s->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_mark_edges_real(&s->l.magic, &rtg_vlfree);
|
||||
|
||||
/* Compute "geometry" for region and shell */
|
||||
nmg_region_a(*r, tol);
|
||||
|
||||
nmg_shell_coplanar_face_merge(s, tol, 0, &RTG.rtg_vlfree);
|
||||
nmg_simplify_shell(s,&RTG.rtg_vlfree);
|
||||
nmg_shell_coplanar_face_merge(s, tol, 0, &rtg_vlfree);
|
||||
nmg_simplify_shell(s,&rtg_vlfree);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -688,7 +688,7 @@ rt_ars_prep(struct soltab *stp, struct rt_db_internal *ip, struct rt_i *rtip)
|
||||
}
|
||||
|
||||
s = BU_LIST_FIRST(shell, &r->s_hd);
|
||||
bot = nmg_bot(s, &RTG.rtg_vlfree, &rtip->rti_tol);
|
||||
bot = nmg_bot(s, &rtg_vlfree, &rtip->rti_tol);
|
||||
|
||||
if (!bot) {
|
||||
bu_log("Failed to convert ARS to BOT (%s)\n", stp->st_dp->d_namep);
|
||||
|
||||
@@ -1132,7 +1132,7 @@ rt_bot_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
if (!(*corners[2])->vg_p)
|
||||
nmg_vertex_gv(*(corners[2]), pt[2]);
|
||||
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree))
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree))
|
||||
nmg_kfu(fu);
|
||||
else if (bot_ip->mode == RT_BOT_SURFACE) {
|
||||
struct vertex **tmp;
|
||||
@@ -1143,18 +1143,18 @@ rt_bot_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
if ((fu=nmg_cmface(s, corners, 3)) == (struct faceuse *)NULL)
|
||||
bu_log("rt_bot_tess() nmg_cmface() failed for face #%zu\n", i);
|
||||
else
|
||||
nmg_calc_face_g(fu,&RTG.rtg_vlfree);
|
||||
nmg_calc_face_g(fu,&rtg_vlfree);
|
||||
}
|
||||
}
|
||||
|
||||
bu_free(verts, "rt_bot_tess *verts[]");
|
||||
|
||||
nmg_mark_edges_real(&s->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_mark_edges_real(&s->l.magic, &rtg_vlfree);
|
||||
|
||||
nmg_region_a(*r, tol);
|
||||
|
||||
if (bot_ip->mode == RT_BOT_SOLID && bot_ip->orientation == RT_BOT_UNORIENTED)
|
||||
nmg_fix_normals(s, &RTG.rtg_vlfree, tol);
|
||||
nmg_fix_normals(s, &rtg_vlfree, tol);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2925,7 +2925,7 @@ int rt_brep_plot_poly(struct bu_list *vhead, const struct db_full_path *pathp, s
|
||||
|
||||
ON_Brep* brep = bi->brep;
|
||||
|
||||
if (brep_facecdt_plot(NULL, solid_name, ttol, tol, brep, vhead, NULL, &RTG.rtg_vlfree, -1, 0, -1)) {
|
||||
if (brep_facecdt_plot(NULL, solid_name, ttol, tol, brep, vhead, NULL, &rtg_vlfree, -1, 0, -1)) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -769,7 +769,7 @@ rt_cline_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip,
|
||||
fu = (struct faceuse *)BU_PTBL_GET(&faces, i);
|
||||
NMG_CK_FACEUSE(fu);
|
||||
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
bu_log("rt_tess_cline: failed to calculate plane equation\n");
|
||||
nmg_pr_fu_briefly(fu, "");
|
||||
return -1;
|
||||
|
||||
@@ -3952,13 +3952,13 @@ rt_dsp_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
}
|
||||
|
||||
/* Mark edges as real */
|
||||
(void)nmg_mark_edges_real(&s->l.magic, &RTG.rtg_vlfree);
|
||||
(void)nmg_mark_edges_real(&s->l.magic, &rtg_vlfree);
|
||||
|
||||
/* Compute "geometry" for region and shell */
|
||||
nmg_region_a(*r, tol);
|
||||
|
||||
/* sanity check */
|
||||
nmg_make_faces_within_tol(s, &RTG.rtg_vlfree, tol);
|
||||
nmg_make_faces_within_tol(s, &rtg_vlfree, tol);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1740,7 +1740,7 @@ rt_ebm_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
}
|
||||
|
||||
/* all faces should merge into one */
|
||||
nmg_shell_coplanar_face_merge(s, tol, 1, &RTG.rtg_vlfree);
|
||||
nmg_shell_coplanar_face_merge(s, tol, 1, &rtg_vlfree);
|
||||
|
||||
fu = BU_LIST_FIRST(faceuse, &s->fu_hd);
|
||||
NMG_CK_FACEUSE(fu);
|
||||
@@ -1748,11 +1748,11 @@ rt_ebm_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
VSET(h, 0.0, 0.0, eip->tallness);
|
||||
MAT4X3VEC(height, eip->mat, h);
|
||||
|
||||
nmg_extrude_face(fu, height, &RTG.rtg_vlfree,tol);
|
||||
nmg_extrude_face(fu, height, &rtg_vlfree,tol);
|
||||
|
||||
nmg_region_a(*r, tol);
|
||||
|
||||
(void)nmg_mark_edges_real(&s->l.magic, &RTG.rtg_vlfree);
|
||||
(void)nmg_mark_edges_real(&s->l.magic, &rtg_vlfree);
|
||||
|
||||
bu_free((char *)vertp, "rt_ebm_tess: vertp");
|
||||
bu_free((char *)loop_verts, "rt_ebm_tess: loop_verts");
|
||||
|
||||
@@ -1560,13 +1560,13 @@ rt_ehy_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
}
|
||||
|
||||
/* Glue the edges of different outward pointing face uses together */
|
||||
nmg_gluefaces(outfaceuses, face, &RTG.rtg_vlfree, tol);
|
||||
nmg_gluefaces(outfaceuses, face, &rtg_vlfree, tol);
|
||||
|
||||
/* Compute "geometry" for region and shell */
|
||||
nmg_region_a(*r, tol);
|
||||
|
||||
/* XXX just for testing, to make up for loads of triangles ... */
|
||||
nmg_shell_coplanar_face_merge(s, tol, 1, &RTG.rtg_vlfree);
|
||||
nmg_shell_coplanar_face_merge(s, tol, 1, &rtg_vlfree);
|
||||
|
||||
/* free mem */
|
||||
bu_free((char *)outfaceuses, "faceuse []");
|
||||
@@ -1578,7 +1578,7 @@ rt_ehy_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
bu_free((char *)vells, "vertex [][]");
|
||||
|
||||
/* Assign vertexuse normals */
|
||||
nmg_vertex_tabulate(&vert_tab, &s->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_vertex_tabulate(&vert_tab, &s->l.magic, &rtg_vlfree);
|
||||
for (i = 0; i < BU_PTBL_LEN(&vert_tab); i++) {
|
||||
point_t pt_prime, tmp_pt;
|
||||
vect_t norm, rev_norm, tmp_vect;
|
||||
|
||||
@@ -1421,7 +1421,7 @@ rt_epa_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
}
|
||||
|
||||
/* Mark the edges of this face as real, this is the only real edge */
|
||||
(void)nmg_mark_edges_real(&outfaceuses[0]->l.magic, &RTG.rtg_vlfree);
|
||||
(void)nmg_mark_edges_real(&outfaceuses[0]->l.magic, &rtg_vlfree);
|
||||
|
||||
/* connect ellipses with triangles */
|
||||
for (i = nell-2; i >= 0; i--) {
|
||||
@@ -1575,13 +1575,13 @@ rt_epa_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
}
|
||||
|
||||
/* Glue the edges of different outward pointing face uses together */
|
||||
nmg_gluefaces(outfaceuses, face, &RTG.rtg_vlfree, tol);
|
||||
nmg_gluefaces(outfaceuses, face, &rtg_vlfree, tol);
|
||||
|
||||
/* Compute "geometry" for region and shell */
|
||||
nmg_region_a(*r, tol);
|
||||
|
||||
/* XXX just for testing, to make up for loads of triangles ... */
|
||||
nmg_shell_coplanar_face_merge(s, tol, 1, &RTG.rtg_vlfree);
|
||||
nmg_shell_coplanar_face_merge(s, tol, 1, &rtg_vlfree);
|
||||
|
||||
/* free mem */
|
||||
bu_free((char *)outfaceuses, "faceuse []");
|
||||
|
||||
@@ -2199,8 +2199,8 @@ rt_extrude_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip
|
||||
}
|
||||
|
||||
BU_LIST_INIT(&vhead);
|
||||
if (!BU_LIST_IS_INITIALIZED(&RTG.rtg_vlfree)) {
|
||||
BU_LIST_INIT(&RTG.rtg_vlfree);
|
||||
if (!BU_LIST_IS_INITIALIZED(&rtg_vlfree)) {
|
||||
BU_LIST_INIT(&rtg_vlfree);
|
||||
}
|
||||
for (i = 0; outer_loop && i<(size_t)BU_PTBL_LEN(outer_loop); i++) {
|
||||
void *seg;
|
||||
@@ -2238,11 +2238,11 @@ rt_extrude_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip
|
||||
}
|
||||
}
|
||||
}
|
||||
BN_FREE_VLIST(&RTG.rtg_vlfree, &vhead);
|
||||
BN_FREE_VLIST(&rtg_vlfree, &vhead);
|
||||
|
||||
/* make sure face normal is in correct direction */
|
||||
bu_free((char *)verts, "verts");
|
||||
if (nmg_calc_face_plane(fu, pl, &RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_plane(fu, pl, &rtg_vlfree)) {
|
||||
bu_log("Failed to calculate face plane for extrusion\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -2330,7 +2330,7 @@ rt_extrude_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip
|
||||
}
|
||||
|
||||
/* extrude this face */
|
||||
if (nmg_extrude_face(fu, extrude_ip->h, &RTG.rtg_vlfree, tol)) {
|
||||
if (nmg_extrude_face(fu, extrude_ip->h, &rtg_vlfree, tol)) {
|
||||
bu_log("Failed to extrude face sketch\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1088,13 +1088,13 @@ rt_hyp_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
}
|
||||
|
||||
/* Glue the edges of different outward pointing face uses together */
|
||||
nmg_gluefaces(outfaceuses, face, &RTG.rtg_vlfree, tol);
|
||||
nmg_gluefaces(outfaceuses, face, &rtg_vlfree, tol);
|
||||
|
||||
/* Compute "geometry" for region and shell */
|
||||
nmg_region_a(*r, tol);
|
||||
|
||||
/* XXX just for testing, to make up for loads of triangles ... */
|
||||
nmg_shell_coplanar_face_merge(s, tol, 1, &RTG.rtg_vlfree);
|
||||
nmg_shell_coplanar_face_merge(s, tol, 1, &rtg_vlfree);
|
||||
|
||||
/* free mem */
|
||||
if (outfaceuses)
|
||||
@@ -1111,7 +1111,7 @@ rt_hyp_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
bu_free((char *)vells, "vertex [][]");
|
||||
|
||||
/* Assign vertexuse normals */
|
||||
nmg_vertex_tabulate(&vert_tab, &s->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_vertex_tabulate(&vert_tab, &s->l.magic, &rtg_vlfree);
|
||||
for (i = 0; i < BU_PTBL_LEN(&vert_tab); i++) {
|
||||
point_t pt_prime, tmp_pt;
|
||||
vect_t norm, rev_norm, tmp_vect;
|
||||
|
||||
@@ -162,10 +162,10 @@ rt_metaball_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *i
|
||||
}
|
||||
}
|
||||
|
||||
nmg_mark_edges_real(&s->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_mark_edges_real(&s->l.magic, &rtg_vlfree);
|
||||
nmg_region_a(*r, tol);
|
||||
|
||||
nmg_model_fuse(m, &RTG.rtg_vlfree, tol);
|
||||
nmg_model_fuse(m, &rtg_vlfree, tol);
|
||||
|
||||
rt_get_timer(×, NULL);
|
||||
bu_log("metaball tessellate (%d triangles): %s\n", numtri, bu_vls_addr(×));
|
||||
|
||||
@@ -1386,10 +1386,10 @@ rt_nmg_shot(struct soltab *stp, struct xray *rp, struct application *ap, struct
|
||||
rd.magic = NMG_RAY_DATA_MAGIC;
|
||||
|
||||
/* intersect the ray with the geometry (sets surfno) */
|
||||
nmg_isect_ray_model((struct nmg_ray_data *)&rd,&RTG.rtg_vlfree);
|
||||
nmg_isect_ray_model((struct nmg_ray_data *)&rd,&rtg_vlfree);
|
||||
|
||||
/* build the sebgent lists */
|
||||
status = nmg_ray_segs(&rd,&RTG.rtg_vlfree);
|
||||
status = nmg_ray_segs(&rd,&rtg_vlfree);
|
||||
|
||||
/* free the hitmiss table */
|
||||
bu_free((char *)rd.hitmiss, "free nmg geom hit list");
|
||||
@@ -1473,7 +1473,7 @@ rt_nmg_plot(struct bu_list *vhead, struct rt_db_internal *ip, const struct bg_te
|
||||
m = (struct model *)ip->idb_ptr;
|
||||
NMG_CK_MODEL(m);
|
||||
|
||||
nmg_m_to_vlist(vhead, m, 0, &RTG.rtg_vlfree);
|
||||
nmg_m_to_vlist(vhead, m, 0, &rtg_vlfree);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -3959,7 +3959,7 @@ rt_nmg_get(struct bu_vls *logstr, const struct rt_db_internal *intern, const cha
|
||||
if (attr == (char *)NULL) {
|
||||
bu_vls_strcpy(logstr, "nmg");
|
||||
bu_ptbl_init(&verts, 256, "nmg verts");
|
||||
nmg_vertex_tabulate(&verts, &m->magic, &RTG.rtg_vlfree);
|
||||
nmg_vertex_tabulate(&verts, &m->magic, &rtg_vlfree);
|
||||
|
||||
/* first list all the vertices */
|
||||
bu_vls_strcat(logstr, " V {");
|
||||
@@ -4025,7 +4025,7 @@ rt_nmg_get(struct bu_vls *logstr, const struct rt_db_internal *intern, const cha
|
||||
/* list of vertices */
|
||||
|
||||
bu_ptbl_init(&verts, 256, "nmg verts");
|
||||
nmg_vertex_tabulate(&verts, &m->magic, &RTG.rtg_vlfree);
|
||||
nmg_vertex_tabulate(&verts, &m->magic, &rtg_vlfree);
|
||||
for (i=0; i<BU_PTBL_LEN(&verts); i++) {
|
||||
v = (struct vertex *) BU_PTBL_GET(&verts, i);
|
||||
NMG_CK_VERTEX(v);
|
||||
@@ -4181,7 +4181,7 @@ rt_nmg_adjust(struct bu_vls *logstr, struct rt_db_internal *intern, int argc, co
|
||||
for (BU_LIST_FOR (fu, faceuse, &s->fu_hd)) {
|
||||
if (fu->orientation != OT_SAME)
|
||||
continue;
|
||||
nmg_calc_face_g(fu,&RTG.rtg_vlfree);
|
||||
nmg_calc_face_g(fu,&rtg_vlfree);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4241,7 +4241,7 @@ rt_nmg_faces_area(struct poly_face* faces, struct shell* s)
|
||||
size_t *npts;
|
||||
point_t **tmp_pts;
|
||||
plane_t *eqs;
|
||||
nmg_face_tabulate(&nmg_faces, &s->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_face_tabulate(&nmg_faces, &s->l.magic, &rtg_vlfree);
|
||||
num_faces = BU_PTBL_LEN(&nmg_faces);
|
||||
tmp_pts = (point_t **)bu_calloc(num_faces, sizeof(point_t *), "rt_nmg_faces_area: tmp_pts");
|
||||
npts = (size_t *)bu_calloc(num_faces, sizeof(size_t), "rt_nmg_faces_area: npts");
|
||||
@@ -4284,7 +4284,7 @@ rt_nmg_surf_area(fastf_t *area, const struct rt_db_internal *ip)
|
||||
struct poly_face *faces;
|
||||
|
||||
/*get faces of this shell*/
|
||||
nmg_face_tabulate(&nmg_faces, &s->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_face_tabulate(&nmg_faces, &s->l.magic, &rtg_vlfree);
|
||||
num_faces = BU_PTBL_LEN(&nmg_faces);
|
||||
faces = (struct poly_face *)bu_calloc(num_faces, sizeof(struct poly_face), "rt_nmg_surf_area: faces");
|
||||
|
||||
@@ -4325,7 +4325,7 @@ rt_nmg_centroid(point_t *cent, const struct rt_db_internal *ip)
|
||||
s = BU_LIST_FIRST(shell, &r->s_hd);
|
||||
|
||||
/*get faces*/
|
||||
nmg_face_tabulate(&nmg_faces, &s->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_face_tabulate(&nmg_faces, &s->l.magic, &rtg_vlfree);
|
||||
num_faces = BU_PTBL_LEN(&nmg_faces);
|
||||
faces = (struct poly_face *)bu_calloc(num_faces, sizeof(struct poly_face), "rt_nmg_centroid: faces");
|
||||
|
||||
@@ -4385,7 +4385,7 @@ rt_nmg_volume(fastf_t *volume, const struct rt_db_internal *ip)
|
||||
struct poly_face *faces;
|
||||
|
||||
/*get faces of this shell*/
|
||||
nmg_face_tabulate(&nmg_faces, &s->l.magic, &RTG.rtg_vlfree);
|
||||
nmg_face_tabulate(&nmg_faces, &s->l.magic, &rtg_vlfree);
|
||||
num_faces = BU_PTBL_LEN(&nmg_faces);
|
||||
faces = (struct poly_face *)bu_calloc(num_faces, sizeof(struct poly_face), "rt_nmg_volume: faces");
|
||||
|
||||
@@ -5213,7 +5213,7 @@ nmg_to_arb(const struct model *m, struct rt_arb_internal *arb_int)
|
||||
if (BU_LIST_NEXT_NOT_HEAD(&s->l, &r->s_hd))
|
||||
return 0;
|
||||
|
||||
switch (Shell_is_arb(s, &tab, &RTG.rtg_vlfree)) {
|
||||
switch (Shell_is_arb(s, &tab, &rtg_vlfree)) {
|
||||
case 0:
|
||||
ret_val = 0;
|
||||
break;
|
||||
|
||||
@@ -89,7 +89,7 @@ rt_nmg_mirror(struct rt_db_internal *ip, register const plane_t plane)
|
||||
mirmat[3 + Z*4] += mirror_pt[Z] * mirror_dir[Z];
|
||||
|
||||
/* move every vertex */
|
||||
nmg_vertex_tabulate(&table, &nmg->magic, &RTG.rtg_vlfree);
|
||||
nmg_vertex_tabulate(&table, &nmg->magic, &rtg_vlfree);
|
||||
for (i=0; i<BU_PTBL_LEN(&table); i++) {
|
||||
point_t pt;
|
||||
|
||||
@@ -102,7 +102,7 @@ rt_nmg_mirror(struct rt_db_internal *ip, register const plane_t plane)
|
||||
|
||||
bu_ptbl_reset(&table);
|
||||
|
||||
nmg_face_tabulate(&table, &nmg->magic, &RTG.rtg_vlfree);
|
||||
nmg_face_tabulate(&table, &nmg->magic, &rtg_vlfree);
|
||||
for (i=0; i<BU_PTBL_LEN(&table); i++) {
|
||||
struct face *f;
|
||||
|
||||
@@ -143,7 +143,7 @@ rt_nmg_mirror(struct rt_db_internal *ip, register const plane_t plane)
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
bu_log("ERROR: Unable to calculate NMG faces for mirroring\n");
|
||||
bu_ptbl_free(&table);
|
||||
return 3;
|
||||
|
||||
@@ -434,7 +434,7 @@ nmg_mc_realize_cube(struct shell *s, int pv, point_t *edges, const struct bn_tol
|
||||
nmg_vertex_gv(vertl[0], edges[vi[0]]);
|
||||
nmg_vertex_gv(vertl[1], edges[vi[1]]);
|
||||
nmg_vertex_gv(vertl[2], edges[vi[2]]);
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
/* this flips out and spins. */
|
||||
bu_log("Face calc failed\n");
|
||||
nmg_kfu(fu);
|
||||
|
||||
@@ -2491,7 +2491,7 @@ tesselate_pipe_start(
|
||||
nmg_vertex_gv(vu->v_p, pipe_pnt->pp_coord);
|
||||
}
|
||||
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
bu_bomb("tesselate_pipe_start: nmg_calc_face_g failed\n");
|
||||
}
|
||||
|
||||
@@ -2587,7 +2587,7 @@ tesselate_pipe_linear(
|
||||
|
||||
if (fu_prev) {
|
||||
nmg_vertex_gv(new_outer_loop[i], pt);
|
||||
if (nmg_calc_face_g(fu_prev,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu_prev,&rtg_vlfree)) {
|
||||
bu_log("tesselate_pipe_linear: nmg_calc_face_g failed\n");
|
||||
nmg_kfu(fu_prev);
|
||||
} else {
|
||||
@@ -2645,7 +2645,7 @@ tesselate_pipe_linear(
|
||||
nmg_vertex_gv(new_outer_loop[i], pt);
|
||||
}
|
||||
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
bu_log("tesselate_pipe_linear: nmg_calc_face_g failed\n");
|
||||
nmg_kfu(fu);
|
||||
} else {
|
||||
@@ -2698,7 +2698,7 @@ tesselate_pipe_linear(
|
||||
continue;
|
||||
}
|
||||
if (i == arc_segs - 1) {
|
||||
if (nmg_calc_face_g(fu_prev,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu_prev,&rtg_vlfree)) {
|
||||
bu_log("tesselate_pipe_linear: nmg_calc_face_g failed\n");
|
||||
nmg_kfu(fu_prev);
|
||||
}
|
||||
@@ -2737,7 +2737,7 @@ tesselate_pipe_linear(
|
||||
VUNITIZE(norms[j]);
|
||||
}
|
||||
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
bu_log("tesselate_pipe_linear: nmg_calc_face_g failed\n");
|
||||
nmg_kfu(fu);
|
||||
} else {
|
||||
@@ -2825,7 +2825,7 @@ tesselate_pipe_linear(
|
||||
if (!new_outer_loop[j]->vg_p) {
|
||||
nmg_vertex_gv(new_outer_loop[j], pt_next);
|
||||
}
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
bu_log("tesselate_pipe_linear: nmg_calc_face_g failed\n");
|
||||
nmg_kfu(fu);
|
||||
} else {
|
||||
@@ -2899,7 +2899,7 @@ tesselate_pipe_linear(
|
||||
|
||||
if (fu_prev) {
|
||||
nmg_vertex_gv(new_inner_loop[i], pt);
|
||||
if (nmg_calc_face_g(fu_prev,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu_prev,&rtg_vlfree)) {
|
||||
bu_log("tesselate_pipe_linear: nmg_calc_face_g failed\n");
|
||||
nmg_kfu(fu_prev);
|
||||
} else {
|
||||
@@ -2957,7 +2957,7 @@ tesselate_pipe_linear(
|
||||
nmg_vertex_gv(new_inner_loop[i], pt);
|
||||
}
|
||||
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
bu_log("tesselate_pipe_linear: nmg_calc_face_g failed\n");
|
||||
nmg_kfu(fu);
|
||||
} else {
|
||||
@@ -3015,7 +3015,7 @@ tesselate_pipe_linear(
|
||||
continue;
|
||||
}
|
||||
if (i == arc_segs - 1) {
|
||||
if (nmg_calc_face_g(fu_prev,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu_prev,&rtg_vlfree)) {
|
||||
bu_log("tesselate_pipe_linear: nmg_calc_face_g failed\n");
|
||||
nmg_kfu(fu_prev);
|
||||
}
|
||||
@@ -3057,7 +3057,7 @@ tesselate_pipe_linear(
|
||||
VREVERSE(norms[j], norms[j]);
|
||||
}
|
||||
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
bu_log("tesselate_pipe_linear: nmg_calc_face_g failed\n");
|
||||
nmg_kfu(fu);
|
||||
} else {
|
||||
@@ -3145,7 +3145,7 @@ tesselate_pipe_linear(
|
||||
if (!new_inner_loop[j]->vg_p) {
|
||||
nmg_vertex_gv(new_inner_loop[j], pt_next);
|
||||
}
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
bu_log("tesselate_pipe_linear: nmg_calc_face_g failed\n");
|
||||
nmg_kfu(fu);
|
||||
} else {
|
||||
@@ -3338,7 +3338,7 @@ tesselate_pipe_bend(
|
||||
if (!new_outer_loop[i]->vg_p) {
|
||||
nmg_vertex_gv(new_outer_loop[i], pt);
|
||||
}
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
bu_log("tesselate_pipe_bend: nmg_calc_face_g failed\n");
|
||||
nmg_kfu(fu);
|
||||
} else {
|
||||
@@ -3407,7 +3407,7 @@ tesselate_pipe_bend(
|
||||
if (!(*verts[2])->vg_p) {
|
||||
nmg_vertex_gv(*verts[2], pt);
|
||||
}
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
bu_log("tesselate_pipe_bend: nmg_calc_face_g failed\n");
|
||||
nmg_kfu(fu);
|
||||
} else {
|
||||
@@ -3517,7 +3517,7 @@ tesselate_pipe_bend(
|
||||
if (!new_inner_loop[i]->vg_p) {
|
||||
nmg_vertex_gv(new_inner_loop[i], pt);
|
||||
}
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
bu_log("tesselate_pipe_bend: nmg_calc_face_g failed\n");
|
||||
nmg_kfu(fu);
|
||||
} else {
|
||||
@@ -3577,7 +3577,7 @@ tesselate_pipe_bend(
|
||||
if (!(*verts[2])->vg_p) {
|
||||
nmg_vertex_gv(*verts[2], pt);
|
||||
}
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
bu_log("tesselate_pipe_bend: nmg_calc_face_g failed\n");
|
||||
nmg_kfu(fu);
|
||||
} else {
|
||||
@@ -3659,7 +3659,7 @@ tesselate_pipe_end(
|
||||
return;
|
||||
}
|
||||
fu = fu->fumate_p;
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
bu_log("tesselate_pipe_end: nmg_calc_face_g failed\n");
|
||||
nmg_kfu(fu);
|
||||
return;
|
||||
@@ -3896,7 +3896,7 @@ rt_pipe_tess(
|
||||
bu_free((char *)inner_loop, "rt_pipe_tess: inner_loop");
|
||||
|
||||
nmg_rebound(m, tol);
|
||||
nmg_edge_fuse(&s->l.magic, &RTG.rtg_vlfree, tol);
|
||||
nmg_edge_fuse(&s->l.magic, &rtg_vlfree, tol);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -612,7 +612,7 @@ rt_pg_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, con
|
||||
}
|
||||
|
||||
/* Associate face geometry */
|
||||
if (nmg_calc_face_g(fu,&RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu,&rtg_vlfree)) {
|
||||
nmg_pr_fu_briefly(fu, "");
|
||||
bu_free((char *)verts, "pg_tess verts[]");
|
||||
bu_free((char *)vertp, "pg_tess vertp[]");
|
||||
@@ -626,7 +626,7 @@ rt_pg_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, con
|
||||
/* Polysolids are often built with incorrect face normals.
|
||||
* Don't depend on them here.
|
||||
*/
|
||||
nmg_fix_normals(s, &RTG.rtg_vlfree, tol);
|
||||
nmg_fix_normals(s, &rtg_vlfree, tol);
|
||||
bu_free((char *)verts, "pg_tess verts[]");
|
||||
bu_free((char *)vertp, "pg_tess vertp[]");
|
||||
|
||||
|
||||
@@ -1343,7 +1343,7 @@ rt_rhc_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
/* Front face topology. Verts are considered to go CCW */
|
||||
outfaceuses[0] = nmg_cface(s, vfront, n);
|
||||
|
||||
(void)nmg_mark_edges_real(&outfaceuses[0]->l.magic, &RTG.rtg_vlfree);
|
||||
(void)nmg_mark_edges_real(&outfaceuses[0]->l.magic, &rtg_vlfree);
|
||||
|
||||
/* Back face topology. Verts must go in opposite dir (CW) */
|
||||
outfaceuses[1] = nmg_cface(s, vtemp, n);
|
||||
@@ -1352,7 +1352,7 @@ rt_rhc_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
vback[i] = vtemp[n - 1 - i];
|
||||
}
|
||||
|
||||
(void)nmg_mark_edges_real(&outfaceuses[1]->l.magic, &RTG.rtg_vlfree);
|
||||
(void)nmg_mark_edges_real(&outfaceuses[1]->l.magic, &rtg_vlfree);
|
||||
|
||||
/* Duplicate [0] as [n] to handle loop end condition, below */
|
||||
vfront[n] = vfront[0];
|
||||
@@ -1370,7 +1370,7 @@ rt_rhc_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
outfaceuses[2 + i] = nmg_cface(s, vertlist, 4);
|
||||
}
|
||||
|
||||
(void)nmg_mark_edges_real(&outfaceuses[n + 1]->l.magic,&RTG.rtg_vlfree);
|
||||
(void)nmg_mark_edges_real(&outfaceuses[n + 1]->l.magic,&rtg_vlfree);
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
NMG_CK_VERTEX(vfront[i]);
|
||||
@@ -1446,7 +1446,7 @@ rt_rhc_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
}
|
||||
|
||||
/* Glue the edges of different outward pointing face uses together */
|
||||
nmg_gluefaces(outfaceuses, n + 2, &RTG.rtg_vlfree, tol);
|
||||
nmg_gluefaces(outfaceuses, n + 2, &rtg_vlfree, tol);
|
||||
|
||||
/* Compute "geometry" for region and shell */
|
||||
nmg_region_a(*r, tol);
|
||||
|
||||
@@ -1214,12 +1214,12 @@ rt_rpc_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
/* Front face topology. Verts are considered to go CCW */
|
||||
outfaceuses[0] = nmg_cface(s, vfront, n);
|
||||
|
||||
(void)nmg_mark_edges_real(&outfaceuses[0]->l.magic,&RTG.rtg_vlfree);
|
||||
(void)nmg_mark_edges_real(&outfaceuses[0]->l.magic,&rtg_vlfree);
|
||||
|
||||
/* Back face topology. Verts must go in opposite dir (CW) */
|
||||
outfaceuses[1] = nmg_cface(s, vtemp, n);
|
||||
|
||||
(void)nmg_mark_edges_real(&outfaceuses[1]->l.magic,&RTG.rtg_vlfree);
|
||||
(void)nmg_mark_edges_real(&outfaceuses[1]->l.magic,&rtg_vlfree);
|
||||
|
||||
for (i=0; i<n; i++) vback[i] = vtemp[n-1-i];
|
||||
|
||||
@@ -1239,7 +1239,7 @@ rt_rpc_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
outfaceuses[2+i] = nmg_cface(s, vertlist, 4);
|
||||
}
|
||||
|
||||
(void)nmg_mark_edges_real(&outfaceuses[n+1]->l.magic,&RTG.rtg_vlfree);
|
||||
(void)nmg_mark_edges_real(&outfaceuses[n+1]->l.magic,&rtg_vlfree);
|
||||
|
||||
for (i=0; i<n; i++) {
|
||||
NMG_CK_VERTEX(vfront[i]);
|
||||
@@ -1313,7 +1313,7 @@ rt_rpc_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
}
|
||||
|
||||
/* Glue the edges of different outward pointing face uses together */
|
||||
nmg_gluefaces(outfaceuses, n+2, &RTG.rtg_vlfree, tol);
|
||||
nmg_gluefaces(outfaceuses, n+2, &rtg_vlfree, tol);
|
||||
|
||||
/* Compute "geometry" for region and shell */
|
||||
nmg_region_a(*r, tol);
|
||||
|
||||
@@ -2741,7 +2741,7 @@ rt_tgc_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
fu = (struct faceuse *)BU_PTBL_GET(&faces, i);
|
||||
NMG_CK_FACEUSE(fu);
|
||||
|
||||
if (nmg_calc_face_g(fu, &RTG.rtg_vlfree)) {
|
||||
if (nmg_calc_face_g(fu, &rtg_vlfree)) {
|
||||
bu_log("rt_tess_tgc: failed to calculate plane equation\n");
|
||||
nmg_pr_fu_briefly(fu, "");
|
||||
return -1;
|
||||
@@ -2858,7 +2858,7 @@ rt_tgc_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, co
|
||||
nmg_region_a(*r, tol);
|
||||
|
||||
/* glue faces together */
|
||||
nmg_gluefaces((struct faceuse **)BU_PTBL_BASEADDR(&faces), BU_PTBL_LEN(&faces), &RTG.rtg_vlfree, tol);
|
||||
nmg_gluefaces((struct faceuse **)BU_PTBL_BASEADDR(&faces), BU_PTBL_LEN(&faces), &rtg_vlfree, tol);
|
||||
bu_ptbl_free(&faces);
|
||||
|
||||
return 0;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user