BRL-CAD
analyze.c File Reference
#include "common.h"
#include <math.h>
#include <string.h>
#include <assert.h>
#include "vmath.h"
#include "bn.h"
#include "rt/arb_edit.h"
#include "raytrace.h"
#include "rtgeom.h"
#include "./ged_private.h"
Include dependency graph for analyze.c:

Go to the source code of this file.

Data Structures

struct  poly_face
 
struct  row_field
 
struct  table_row
 
struct  table
 

Macros

#define GALLONS_TO_MM3   3785411.784
 
#define POLY_FACE_INIT_ZERO   { { 0, 0, 0, 0, 0 }, 0, NULL, HINIT_ZERO, 0.0 }
 
#define ADD_PT(face, pt)   do { VMOVE((face).pts[(face).npts], (pt)); (face).npts++; } while (0)
 
#define FBUFSIZ   100
 
#define NFIELDS   9
 
#define NOT_A_PLANE   -1
 
#define ARS_PT(ii, jj)   (&arip->curves[i+(ii)][(j+(jj))*ELEMENTS_PER_VECT])
 
#define PROLATE   1
 
#define OBLATE   2
 

Typedefs

typedef struct row_field field_t
 
typedef struct table_row row_t
 
typedef struct table table_t
 

Functions

void get_dashes (field_t *f, const int ndashes)
 
void print_volume_table (struct ged *gedp, const fastf_t tot_vol, const fastf_t tot_area, const fastf_t tot_gallons)
 
void print_edges_table (struct ged *gedp, table_t *table)
 
void print_faces_table (struct ged *gedp, table_t *table)
 
HIDDEN void analyze_general (struct ged *gedp, const struct rt_db_internal *ip)
 
HIDDEN void findang (fastf_t *angles, fastf_t *unitv)
 
HIDDEN void analyze_poly_face (struct ged *gedp, struct poly_face *face, row_t *row)
 
HIDDEN void analyze_edge (struct ged *gedp, const int edge, const struct rt_arb_internal *arb, const int type, row_t *row)
 
HIDDEN void analyze_arb8 (struct ged *gedp, const struct rt_db_internal *ip)
 
HIDDEN void analyze_arbn (struct ged *gedp, const struct rt_db_internal *ip)
 
HIDDEN void analyze_ars (struct ged *gedp, const struct rt_db_internal *ip)
 
HIDDEN void analyze_superell (struct ged *gedp, const struct rt_db_internal *ip)
 
HIDDEN void analyze_sketch (struct ged *gedp, const struct rt_db_internal *ip)
 
HIDDEN void analyze_do (struct ged *gedp, const struct rt_db_internal *ip)
 
int ged_analyze (struct ged *gedp, int argc, const char *argv[])
 

Detailed Description

The analyze command.

Definition in file analyze.c.

Macro Definition Documentation

#define GALLONS_TO_MM3   3785411.784

TODO: primitives that still need implementing ehy metaball nmg rhc

Definition at line 51 of file analyze.c.

Referenced by analyze_arb8(), analyze_arbn(), analyze_ars(), analyze_general(), and analyze_superell().

#define POLY_FACE_INIT_ZERO   { { 0, 0, 0, 0, 0 }, 0, NULL, HINIT_ZERO, 0.0 }

Definition at line 85 of file analyze.c.

Referenced by analyze_arb8(), and analyze_ars().

#define ADD_PT (   face,
  pt 
)    do { VMOVE((face).pts[(face).npts], (pt)); (face).npts++; } while (0)

Definition at line 87 of file analyze.c.

Referenced by analyze_arb8(), and analyze_ars().

#define FBUFSIZ   100

Definition at line 91 of file analyze.c.

Referenced by get_dashes(), print_edges_table(), and print_volume_table().

#define NFIELDS   9

Definition at line 92 of file analyze.c.

#define NOT_A_PLANE   -1

Definition at line 93 of file analyze.c.

Referenced by analyze_arb8(), and print_faces_table().

#define ARS_PT (   ii,
  jj 
)    (&arip->curves[i+(ii)][(j+(jj))*ELEMENTS_PER_VECT])

Definition at line 967 of file analyze.c.

Referenced by analyze_ars().

#define PROLATE   1

Definition at line 1062 of file analyze.c.

Referenced by analyze_superell().

#define OBLATE   2

Definition at line 1063 of file analyze.c.

Referenced by analyze_superell().

Typedef Documentation

typedef struct row_field field_t
typedef struct table_row row_t
typedef struct table table_t

Function Documentation

void get_dashes ( field_t f,
const int  ndashes 
)
void print_volume_table ( struct ged gedp,
const fastf_t  tot_vol,
const fastf_t  tot_area,
const fastf_t  tot_gallons 
)

Definition at line 123 of file analyze.c.

References bu_calloc(), bu_free(), bu_vls_printf(), row_field::buf, FBUFSIZ, table_row::fields, ged::ged_result_str, get_dashes(), row_field::nchars, table::nrows, and table::rows.

Referenced by analyze_arb8(), analyze_arbn(), analyze_ars(), analyze_general(), and analyze_superell().

Here is the call graph for this function:

void print_edges_table ( struct ged gedp,
table_t table 
)

Definition at line 213 of file analyze.c.

References bu_vls_printf(), row_field::buf, FBUFSIZ, table_row::fields, ged::ged_result_str, get_dashes(), row_field::nchars, table::nrows, and table::rows.

Referenced by analyze_arb8().

Here is the call graph for this function:

void print_faces_table ( struct ged gedp,
table_t table 
)

Definition at line 413 of file analyze.c.

References bu_vls_printf(), row_field::buf, table_row::fields, ged::ged_result_str, get_dashes(), row_field::nchars, table_row::nfields, NOT_A_PLANE, table::nrows, and table::rows.

Referenced by analyze_arb8(), analyze_arbn(), and analyze_ars().

Here is the call graph for this function:

HIDDEN void analyze_general ( struct ged gedp,
const struct rt_db_internal ip 
)

general analyze function for primitives that can be analyzed using volume and surface area functions from the rt_functab. Currently used for:

  • ell
  • tor
  • tgc
  • rpc
  • eto
  • epa
  • part

Definition at line 625 of file analyze.c.

References bu_vls_printf(), db_i::dbi_base2local, rt_wdb::dbip, rt_functab::ft_centroid, rt_functab::ft_surf_area, rt_functab::ft_volume, GALLONS_TO_MM3, ged::ged_result_str, ged::ged_wdbp, rt_db_internal::idb_minor_type, OBJ, print_volume_table(), X, Y, and Z.

Referenced by analyze_do().

Here is the call graph for this function:

HIDDEN void findang ( fastf_t angles,
fastf_t unitv 
)

finds direction cosines and rotation, fallback angles of a unit vector angles = pointer to 5 fastf_t's to store angles unitv = pointer to the unit vector (previously computed)

Definition at line 666 of file analyze.c.

References X, Y, and Z.

Referenced by analyze_poly_face().

HIDDEN void analyze_poly_face ( struct ged gedp,
struct poly_face face,
row_t row 
)

general analyze function for polygonal faces. Currently used for:

  • arb8
  • arbn
  • ars

returns:

  • area in face->area
  • print_faces_table() information in row
  • sorts vertices in face->pts into ccw order

Definition at line 724 of file analyze.c.

References poly_face::area, bn_polygon_area(), bn_polygon_sort_ccw(), row_field::buf, db_i::dbi_base2local, rt_wdb::dbip, table_row::fields, findang(), ged::ged_wdbp, poly_face::label, row_field::nchars, table_row::nfields, poly_face::npts, poly_face::plane_eqn, poly_face::pts, X, Y, and Z.

Referenced by analyze_arb8(), analyze_arbn(), and analyze_ars().

Here is the call graph for this function:

HIDDEN void analyze_edge ( struct ged gedp,
const int  edge,
const struct rt_arb_internal *  arb,
const int  type,
row_t row 
)
HIDDEN void analyze_arbn ( struct ged gedp,
const struct rt_db_internal ip 
)
HIDDEN void analyze_ars ( struct ged gedp,
const struct rt_db_internal ip 
)
HIDDEN void analyze_superell ( struct ged gedp,
const struct rt_db_internal ip 
)

Definition at line 1066 of file analyze.c.

References bu_vls_printf(), db_i::dbi_base2local, rt_wdb::dbip, GALLONS_TO_MM3, ged::ged_result_str, ged::ged_wdbp, rt_db_internal::idb_ptr, M_PI, OBLATE, print_volume_table(), and PROLATE.

Referenced by analyze_do().

Here is the call graph for this function:

HIDDEN void analyze_sketch ( struct ged gedp,
const struct rt_db_internal ip 
)

Definition at line 1159 of file analyze.c.

References bu_vls_printf(), db_i::dbi_base2local, db_i::dbi_local2base, rt_wdb::dbip, rt_functab::ft_centroid, rt_functab::ft_surf_area, ged::ged_result_str, ged::ged_wdbp, ID_SKETCH, OBJ, X, Y, and Z.

Referenced by analyze_do().

Here is the call graph for this function:

HIDDEN void analyze_do ( struct ged gedp,
const struct rt_db_internal ip 
)

Analyze command - prints loads of info about a solid Format: analyze [name] if 'name' is missing use solid being edited

Definition at line 1193 of file analyze.c.

References analyze_arb8(), analyze_arbn(), analyze_ars(), analyze_general(), analyze_sketch(), analyze_superell(), bu_vls_printf(), rt_functab::ft_name, ged::ged_result_str, ID_ARB8, ID_ARBN, ID_ARS, ID_BOT, ID_ELL, ID_EPA, ID_ETO, ID_EXTRUDE, ID_HYP, ID_PARTICLE, ID_PIPE, ID_RPC, ID_SKETCH, ID_SUPERELL, ID_TGC, ID_TOR, ID_VOL, and OBJ.

Referenced by ged_analyze().

Here is the call graph for this function:

int ged_analyze ( struct ged gedp,
int  argc,
const char *  argv[] 
)

Returns lots of information about the specified object(s)

Definition at line 1276 of file analyze.c.

References _ged_do_list(), analyze_do(), bn_mat_identity, bu_vls_printf(), bu_vls_trunc(), db_lookup(), rt_wdb::dbip, GED_CHECK_ARGC_GT_0, GED_CHECK_DATABASE_OPEN, GED_DB_GET_INTERNAL, GED_ERROR, GED_HELP, GED_OK, ged::ged_result_str, ged::ged_wdbp, LOOKUP_NOISY, rt_db_free_internal(), RT_DIR_NULL, rt_uniresource, and usage().

Here is the call graph for this function: