BRL-CAD
make_pnts.c File Reference
#include "common.h"
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "bu/sort.h"
#include "bu/units.h"
#include "rtgeom.h"
#include "wdb.h"
#include "./ged_private.h"
Include dependency graph for make_pnts.c:

Go to the source code of this file.

Macros

#define INSERT_COORDINATE_INTO_STRUCTURE(_structure_type, _control_variable, _variable_to_insert)
 
#define INSERT_COLOR_INTO_STRUCTURE(_structure_type, _control_variable, _variable_to_insert)
 
#define INSERT_SCALE_INTO_STRUCTURE(_structure_type, _control_variable, _variable_to_insert)
 
#define INSERT_NORMAL_INTO_STRUCTURE(_structure_type, _control_variable, _variable_to_insert)
 

Functions

int compare_char (const char *a, const char *b, void *arg)
 
int str2type (const char *format_string, rt_pnt_type *pnt_type, struct bu_vls *ged_result_str)
 
int str2mm (const char *units_string, double *conv_factor, struct bu_vls *ged_result_str)
 
void report_import_error_location (unsigned long int num_doubles_read, unsigned int num_doubles_per_point, unsigned long int start_offset_of_current_double, char field, struct bu_vls *ged_result_str)
 
int ged_make_pnts (struct ged *gedp, int argc, const char *argv[])
 

Detailed Description

The "make_pnts" command makes a point-cloud from a points data file.

Definition in file make_pnts.c.

Macro Definition Documentation

#define INSERT_COORDINATE_INTO_STRUCTURE (   _structure_type,
  _control_variable,
  _variable_to_insert 
)
Value:
switch (_control_variable) { \
case 'x': \
((struct _structure_type *)point)->v[X] = _variable_to_insert; \
break; \
case 'y': \
((struct _structure_type *)point)->v[Y] = _variable_to_insert; \
break; \
case 'z': \
((struct _structure_type *)point)->v[Z] = _variable_to_insert; \
break; \
}
Definition: color.c:49
Coord * point
Definition: chull3d.cpp:52
Definition: color.c:51
Definition: color.c:50

Definition at line 39 of file make_pnts.c.

Referenced by ged_make_pnts().

#define INSERT_COLOR_INTO_STRUCTURE (   _structure_type,
  _control_variable,
  _variable_to_insert 
)
Value:
switch (_control_variable) { \
case 'r': \
((struct _structure_type *)point)->c.buc_magic = BU_COLOR_MAGIC; \
((struct _structure_type *)point)->c.buc_rgb[0] = _variable_to_insert; \
break; \
case 'g': \
((struct _structure_type *)point)->c.buc_rgb[1] = _variable_to_insert; \
break; \
case 'b': \
((struct _structure_type *)point)->c.buc_rgb[2] = _variable_to_insert; \
break; \
}
#define BU_COLOR_MAGIC
Definition: magic.h:48
Coord * point
Definition: chull3d.cpp:52

Definition at line 52 of file make_pnts.c.

Referenced by ged_make_pnts().

#define INSERT_SCALE_INTO_STRUCTURE (   _structure_type,
  _control_variable,
  _variable_to_insert 
)
Value:
switch (_control_variable) { \
case 's': \
((struct _structure_type *)point)->s = _variable_to_insert; \
break; \
}
Coord * point
Definition: chull3d.cpp:52

Definition at line 66 of file make_pnts.c.

Referenced by ged_make_pnts().

#define INSERT_NORMAL_INTO_STRUCTURE (   _structure_type,
  _control_variable,
  _variable_to_insert 
)
Value:
switch (_control_variable) { \
case 'i': \
((struct _structure_type *)point)->n[X] = _variable_to_insert; \
break; \
case 'j': \
((struct _structure_type *)point)->n[Y] = _variable_to_insert; \
break; \
case 'k': \
((struct _structure_type *)point)->n[Z] = _variable_to_insert; \
break; \
}
Definition: color.c:49
Coord * point
Definition: chull3d.cpp:52
Definition: color.c:51
Definition: color.c:50

Definition at line 73 of file make_pnts.c.

Referenced by ged_make_pnts().

Function Documentation

int compare_char ( const char *  a,
const char *  b,
void *  arg 
)

Definition at line 99 of file make_pnts.c.

Referenced by str2type().

int str2type ( const char *  format_string,
rt_pnt_type *  pnt_type,
struct bu_vls ged_result_str 
)

Definition at line 112 of file make_pnts.c.

References bu_sort(), BU_STR_EQUAL, bu_vls_addr(), bu_vls_free(), BU_VLS_INIT_ZERO, bu_vls_printf(), bu_vls_putc(), bu_vls_trimspace(), compare_char(), GED_ERROR, and GED_OK.

Referenced by ged_make_pnts().

Here is the call graph for this function:

int str2mm ( const char *  units_string,
double *  conv_factor,
struct bu_vls ged_result_str 
)

Definition at line 175 of file make_pnts.c.

References bu_mm_value(), bu_vls_addr(), bu_vls_free(), BU_VLS_INIT_ZERO, bu_vls_printf(), bu_vls_strcat(), bu_vls_trimspace(), GED_ERROR, and GED_OK.

Referenced by ged_make_pnts().

Here is the call graph for this function:

void report_import_error_location ( unsigned long int  num_doubles_read,
unsigned int  num_doubles_per_point,
unsigned long int  start_offset_of_current_double,
char  field,
struct bu_vls ged_result_str 
)

Definition at line 208 of file make_pnts.c.

References bu_vls_printf().

Referenced by ged_make_pnts().

Here is the call graph for this function:

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

Creates a point-cloud (pnts) given the following: 1) object name 2) path and filename to point data file 3) point data file format (xyzrgbsijk?) 4) point data file units or conversion factor to mm 5) default diameter of each point

Definition at line 234 of file make_pnts.c.

References BU_ALLOC, BU_ASSERT_PTR, BU_LIST_INIT, BU_LIST_PUSH, bu_vls_addr(), bu_vls_free(), BU_VLS_INIT_ZERO, bu_vls_printf(), bu_vls_strcat(), bu_vls_strlen(), bu_vls_trimspace(), bu_vls_trunc(), GED_CHECK_ARGC_GT_0, GED_CHECK_DATABASE_OPEN, GED_CHECK_EXISTS, GED_CHECK_READ_ONLY, GED_DB_DIRADD, GED_DB_PUT_INTERNAL, GED_ERROR, GED_MORE, GED_OK, ged::ged_result_str, ID_PNTS, idb_type, INSERT_COLOR_INTO_STRUCTURE, INSERT_COORDINATE_INTO_STRUCTURE, INSERT_NORMAL_INTO_STRUCTURE, INSERT_SCALE_INTO_STRUCTURE, LOOKUP_QUIET, OBJ, report_import_error_location(), rt_db_free_internal(), RT_DB_INTERNAL_INIT, RT_DIR_PHONY_ADDR, RT_DIR_SOLID, RT_PNTS_INTERNAL_MAGIC, rt_uniresource, str2mm(), str2type(), strchr(), and usage().

Here is the call graph for this function: