BRL-CAD
units.c File Reference
#include "common.h"
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <float.h>
#include "bu/log.h"
#include "bu/malloc.h"
#include "bu/str.h"
#include "bu/units.h"
#include "bu/vls.h"
Include dependency graph for units.c:

Go to the source code of this file.

Data Structures

struct  cvt_tab
 
struct  conv_table
 

Macros

#define NEAR_ZERO(val, epsilon)   (((val) > -epsilon) && ((val) < epsilon))
 
#define ZERO(val)   NEAR_ZERO((val), SMALL_FASTF)
 
#define BU_UNITS_TABLE_SIZE   (sizeof(bu_units_length_tab) / sizeof(struct cvt_tab) - 1)
 

Functions

double bu_units_conversion (const char *str)
 
const char * bu_units_string (register const double mm)
 
struct bu_vlsbu_units_strings_vls ()
 
const char * bu_nearest_units_string (register const double mm)
 
double bu_mm_value (const char *s)
 
void bu_mm_cvt (const struct bu_structparse *sdp, const char *name, void *base, const char *value, void *data)
 

Detailed Description

Module of libbu to handle units conversion between strings and mm.

Definition in file units.c.

Macro Definition Documentation

#define NEAR_ZERO (   val,
  epsilon 
)    (((val) > -epsilon) && ((val) < epsilon))

Definition at line 37 of file units.c.

#define ZERO (   val)    NEAR_ZERO((val), SMALL_FASTF)

Definition at line 38 of file units.c.

Referenced by _ged_print_matrix(), _ged_scale_tgc(), _ged_vls_print_matrix(), add_seg(), anim_mat2quat(), anim_mat2ypr(), anim_mat2zyx(), arb_edit(), bn_cx_div(), bn_cx_sqrt(), bn_distsq_line3_line3(), bn_distsq_line3_pt3(), bn_distsq_pt3_lseg3_v2(), bn_does_ray_isect_tri(), bn_htov_move(), bn_isect_2planes(), bn_isect_line3_line3(), bn_isect_planes(), bn_mat_angles(), bn_mat_angles_rad(), bn_mat_arb_rot(), bn_mat_inverse(), bn_mat_is_non_unif(), bn_mat_scale_about_pt(), bn_mkpoint_3planes(), bn_noise_fbm(), bn_noise_turb(), bn_poly_cubic_roots(), bn_poly_quartic_roots(), bn_table_merge2(), bn_vec_ortho(), bn_vec_perp(), brdf_render(), bu_nearest_units_string(), bu_units_string(), bu_units_strings_vls(), chull3d_build_convex_hull(), chull3d_get_normal_sede(), chull3d_out_of_flat(), chull3d_sees(), combmem_assemble_mat(), compute_x_intercept(), data2uchar(), db_parse_1anim(), discont_radius_shot(), dl_png(), dm_draw_adc(), dm_draw_grid(), dm_draw_rect(), dmo_drawSList(), emist_render(), ged_3ptarb(), ged_calc_adc_a1(), ged_calc_adc_a2(), ged_coil(), ged_gqa(), ged_rfarb(), ged_size(), ged_snap_to_grid(), ged_solids_on_ray(), ged_tire(), go_draw_dlist(), guess_class_from_hitlist_max(), guess_class_from_hitlist_min(), icv_rgb2gray(), inverse_dir(), isect_ray_triangle(), nmg_2_vrml(), nmg_break_crossed_loops(), nmg_calc_face_plane(), nmg_check_radial_angles(), nmg_ck_fg(), nmg_class_ray_vs_shell(), nmg_dist_to_cross(), nmg_do_radial_flips(), nmg_fix_overlapping_loops(), nmg_insure_radial_list_is_increasing(), nmg_intersect_loops_self(), nmg_isect_edge2p_edge2p(), nmg_isect_eu_eu(), nmg_isect_line2_edge2p(), nmg_isect_pt_facet(), nmg_loop_plane_area2(), nmg_radial_build_list(), nmg_shell_is_void(), nmg_snurb_is_planar(), nmg_uv_in_lu(), nmg_vfg(), nmg_vu_angle_measure(), nurb_c_to_bezier(), nurb_crv_is_bezier(), options_prep(), persp_hook(), pipe_end_shot(), pipe_start_shot(), points_render(), promote_ints(), ptbl_vsort(), rr_render(), rt_arb_add_pt(), rt_arb_edit(), rt_arbn_prep(), rt_boolfinal(), rt_bot_face_fuse(), rt_bot_vertex_fuse(), rt_brep_plot(), rt_cnurb_par_edge(), rt_comb_import4(), rt_dsp_norm(), rt_dsp_plot(), rt_dsp_uv(), rt_ebm_dda(), rt_ehy_shot(), rt_ehy_uv(), rt_epa_shot(), rt_epa_uv(), rt_extrude_shot(), rt_fdiff(), rt_hf_plot(), rt_hyp_import5(), rt_hyp_tess(), rt_join_cnurbs(), rt_metaball_get_bounding_sphere(), rt_nmg_export4_fastf(), rt_nmg_shot(), rt_nurb_basis_eval(), rt_nurb_c_bound(), rt_nurb_c_split(), rt_nurb_calc_oslo(), rt_nurb_eval_crv(), rt_nurb_knot_index(), rt_nurb_kvcheck(), rt_nurb_kvnorm(), rt_nurb_mesh_diff(), rt_nurb_s_bound(), rt_nurb_s_norm(), rt_nurb_s_split(), rt_nurb_shot(), rt_part_shot(), rt_poly_deflate(), rt_poly_findroot(), rt_poly_roots(), rt_rec_shot(), rt_rec_vshot(), rt_reldiff(), rt_revolve_bbox(), rt_revolve_plot(), rt_revolve_prep(), rt_revolve_shot(), rt_revolve_uv(), rt_rhc_shot(), rt_seg_planeclip(), rt_tgc_prep(), rt_tgc_shot(), rt_tgc_tess(), rt_tgc_vshot(), rt_vol_shot(), rt_vshootray(), shoot_and_plot(), summary_reports(), tie_work(), tp_3axis(), tp_3vector(), triangle_intersection(), tthrm_setup(), and vo_units_cmd().

#define BU_UNITS_TABLE_SIZE   (sizeof(bu_units_length_tab) / sizeof(struct cvt_tab) - 1)

Definition at line 127 of file units.c.

Function Documentation

const char* bu_units_string ( register const double  mm)

Definition at line 256 of file units.c.

References cvt_tab::name, UNLIKELY, cvt_tab::val, and ZERO.

Referenced by ged_units().

const char* bu_nearest_units_string ( register const double  mm)

Definition at line 315 of file units.c.

References cvt_tab::name, UNLIKELY, cvt_tab::val, and ZERO.