BRL-CAD
color.c File Reference
#include "common.h"
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
#include <stdarg.h>
#include "bio.h"
#include "bu/color.h"
#include "bu/log.h"
#include "bu/malloc.h"
Include dependency graph for color.c:

Go to the source code of this file.

Macros

#define ACHROMATIC   -1.0
 
#define HUE   0
 
#define SAT   1
 
#define VAL   2
 
#define RED   0
 
#define GRN   1
 
#define BLU   2
 
#define VSET(a, b, c, d)   { (a)[X] = (b); (a)[Y] = (c); (a)[Z] = (d); }
 
#define VSETALL(a, s)   { (a)[X] = (a)[Y] = (a)[Z] = (s); }
 
#define NEAR_ZERO(val, epsilon)   (((val) > -epsilon) && ((val) < epsilon))
 
#define V3ARGS(a)   (a)[X], (a)[Y], (a)[Z]
 

Enumerations

enum  axis { X = 0, Y = 1, Z = 2 }
 

Functions

void bu_rgb_to_hsv (unsigned char *rgb, fastf_t *hsv)
 
int bu_hsv_to_rgb (fastf_t *hsv, unsigned char *rgb)
 
int bu_str_to_rgb (char *str, unsigned char *rgb)
 
int bu_color_to_rgb_floats (struct bu_color *cp, fastf_t *rgb)
 
int bu_color_from_rgb_floats (struct bu_color *cp, fastf_t *rgb)
 

Macro Definition Documentation

#define ACHROMATIC   -1.0

Definition at line 36 of file color.c.

Referenced by bu_hsv_to_rgb(), and bu_rgb_to_hsv().

#define HUE   0

Definition at line 38 of file color.c.

Referenced by bu_hsv_to_rgb(), and bu_rgb_to_hsv().

#define SAT   1

Definition at line 39 of file color.c.

Referenced by bu_hsv_to_rgb(), and bu_rgb_to_hsv().

#define VAL   2

Definition at line 40 of file color.c.

Referenced by bu_hsv_to_rgb(), and bu_rgb_to_hsv().

#define RED   0
#define GRN   1
#define BLU   2
#define VSET (   a,
  b,
  c,
 
)    { (a)[X] = (b); (a)[Y] = (c); (a)[Z] = (d); }

Definition at line 53 of file color.c.

Referenced by _ged_do_rot(), _ged_rt_set_eye_model(), _ged_select_botpts(), Add_vert(), Add_vert_and_norm(), anim_dir2mat(), anim_dirn2mat(), anim_steer_mat(), avpp_val_compare(), bmp_render(), bn_aet_vec(), bn_eigen2x2(), bn_isect_2planes(), bn_isect_planes(), bn_mat_fromto(), bn_mat_lookat(), bn_vec_ae(), bn_vec_aed(), bn_vlist_2string(), bn_vlist_3string(), bn_vlist_rpp(), bn_wrt_point_direc(), boundingBox(), boundingRectangle(), brep_plot_file(), brick_render(), bu_hsv_to_rgb(), bu_str_to_rgb(), bwtxt_render(), cap_ground(), cap_squared(), cap_squared_ground(), chull3d_data_init(), ckr_render(), combmem_set(), combmem_set_arb_rot(), combmem_set_rot(), combmem_set_sca(), combmem_set_tra(), compute_normal_at_gridpoint(), coplanar_2d_coord_sys(), coplanar_2d_to_3d(), db_parse_1anim(), dl_png(), dl_select(), dl_select_partial(), dm_draw_axes(), dm_draw_data_axes(), dm_draw_grid(), do_grid(), dsp_layers(), dsp_pos(), ell_angle(), find_metaballpt_nearest_pt(), find_pipept_nearest_pt(), FindLoops(), fire_row(), ged_3ptarb(), ged_arb(), ged_bb(), ged_cm_end(), ged_export_polygon(), ged_eye(), ged_human(), ged_lookat(), ged_make(), ged_mirror(), ged_nirt(), ged_preview(), ged_rfarb(), ged_savekey(), ged_snap_to_grid(), ged_solids_on_ray(), ged_sphgroup(), ged_view_init(), ged_view_update(), ged_viewdir(), getLocation(), grass_render(), helical_coil_plain(), isect_ray_cell_top(), isect_ray_dsp_bb(), light_maker(), light_setup(), main(), make_coil(), make_ellipse(), make_ellipse4(), make_nmg_vertex_g(), makeArmy(), makeBody(), makeCalf(), makeElbow(), makeFoot(), makeHand(), makeHead(), makeLowerArm(), makeLowerTorso(), makeNeck(), makeShoulderJoint(), makeThigh(), makeUpperArm(), makeUpperTorso(), mbound_render(), mk_rpp(), mk_sph(), nmg_brep_face(), nmg_edge_g(), nmg_fcut_face_2d(), nmg_get_edge_lines(), nmg_isect2d_prep(), nmg_isect_2faceuse(), nmg_pr_fu_around_eu(), nmg_s_to_vlist(), nmg_snurb_is_planar(), permute_cell(), PL_FORTRAN(), plot_face(), plotleafuv(), plotsurface(), plotsurfaceknots(), plotsurfaceleafs(), plotUVDomain2d(), pnt2d_array_get_dimension(), points_render(), prj_render(), qray_data_to_vlist(), rbound_render(), rr_render(), rt_advance_to_next_cell(), rt_arb_mirror(), rt_arbn_mirror(), rt_arc2d_to_cnurb(), rt_ars_mirror(), rt_bot_adaptive_plot(), rt_bot_adjust(), rt_bot_mirror(), rt_brep_shot(), rt_cell_n_on_ray(), rt_comb_mirror(), rt_dsp_brep(), rt_dsp_mirror(), rt_dsp_norm(), rt_dsp_plot(), rt_dsp_tess(), rt_dsp_uv(), rt_ebm_bbox(), rt_ebm_centroid(), rt_ebm_mirror(), rt_ebm_plate(), rt_ebm_prep(), rt_ebm_shot(), rt_ebm_surf_area(), rt_ebm_tess(), rt_ehy_brep(), rt_ehy_norm(), rt_ehy_plot(), rt_ehy_tess(), rt_ell_bbox(), rt_ell_brep(), rt_ell_mirror(), rt_ell_prep(), rt_ell_tess(), rt_epa_mirror(), rt_epa_norm(), rt_epa_plot(), rt_epa_tess(), rt_eto_bbox(), rt_eto_brep(), rt_eto_curve(), rt_eto_mirror(), rt_eto_norm(), rt_eto_uv(), rt_extrude_bbox(), rt_extrude_prep(), rt_extrude_shot(), rt_grip_mirror(), rt_half_mirror(), rt_hf_import4(), rt_hrt_centroid(), rt_hrt_norm(), rt_hrt_plot(), rt_hrt_prep(), rt_hyp_brep(), rt_hyp_mirror(), rt_hyp_norm(), rt_hyp_tess(), rt_joint_mirror(), rt_metaball_bbox(), rt_metaball_plot_sph(), rt_mk_hyperbola(), rt_mk_parabola(), rt_nmg_mc_pew(), rt_nmg_mirror(), rt_nurb_mirror(), rt_nurb_shot(), rt_part_brep(), rt_part_plot(), rt_part_tess(), rt_particle_mirror(), rt_pipe_mirror(), rt_pipe_norm(), rt_pipe_prep(), rt_pnts_plot(), rt_poly_mirror(), rt_process_uplot_value(), rt_rec_bbox(), rt_rec_prep(), rt_revolve_brep(), rt_revolve_norm(), rt_revolve_shot(), rt_rhc_mirror(), rt_rhc_norm(), rt_rhc_plot(), rt_rhc_prep(), rt_rhc_tess(), rt_rpc_mirror(), rt_rpc_norm(), rt_rpc_plot(), rt_rpc_prep(), rt_rpc_tess(), rt_shootray(), rt_shootray_bundle(), rt_superell_bbox(), rt_superell_mirror(), rt_superell_prep(), rt_tgc_mirror(), rt_tgc_prep(), rt_tgc_tnurb(), rt_tor_bbox(), rt_tor_mirror(), rt_tor_norm(), rt_tor_uv(), rt_vol_bbox(), rt_vol_mirror(), rt_vol_plot(), rt_vol_prep(), rt_vol_surf_area(), rt_vol_tess(), rt_vol_volume(), setStance(), shade_inputs(), spm_render(), test_compose(), test_face_splits(), tmist_render(), to_axes(), to_data_arrows(), to_data_axes(), to_data_labels(), to_data_lines(), to_data_polygons(), to_faceplate(), to_mouse_append_pt_common(), to_mouse_brep_selection_append(), to_mouse_find_arb_edge(), to_mouse_find_bot_edge(), to_mouse_find_botpt(), to_mouse_find_metaballpt(), to_mouse_find_pipept(), to_mouse_joint_select(), to_mouse_move_arb_edge(), to_mouse_move_arb_face(), to_mouse_move_botpt(), to_mouse_move_botpts(), to_mouse_move_pt_common(), to_mouse_orotate(), to_mouse_otranslate(), to_mouse_poly_circ(), to_mouse_poly_cont(), to_mouse_poly_ell(), to_mouse_poly_rect(), to_mouse_protate(), to_mouse_ptranslate(), to_mouse_rotate_arb_face(), to_poly_circ_mode(), to_poly_cont_build(), to_poly_ell_mode(), to_poly_rect_mode(), to_screen2model(), to_screen2view(), toyota_setup(), tp_2symbol(), tp_3axis(), tp_3marker(), tp_3symbol(), tstm_render(), tthrm_render(), txt_render(), vo_eye_cmd(), vo_lookat_cmd(), vo_open_cmd(), vo_rot(), vo_update(), vo_viewDir_cmd(), and voxelize().

#define VSETALL (   a,
  s 
)    { (a)[X] = (a)[Y] = (a)[Z] = (s); }

Definition at line 54 of file color.c.

Referenced by _ged_get_obj_bounds2(), _ged_get_solid_keypoint(), _rt_gettree_leaf(), adc_grid_to_adc_view(), adc_reset(), adc_view_to_adc_grid(), append_solid_to_display_list(), arb_permute(), background_light(), bbd_render(), bn_cmd_noise_slice(), bn_isect_2planes(), bn_math_cmd(), bn_vec_ortho(), bn_vec_perp(), brdf_render(), bu_hsv_to_rgb(), bwtxt_render(), combmem_set_sca(), coplanar_2d_coord_sys(), cut_unimonotone(), dl_bounding_sph(), dm_draw_axes(), dmo_open_tcl(), dsp_print_v4(), dsp_print_v5(), fire_row(), fire_setup(), fix_halfs(), ged_arot_args(), ged_autoview(), ged_bb(), ged_get_autoview(), ged_get_obj_bounds(), ged_grid2model_lu(), ged_grid2view_lu(), ged_model2grid_lu(), ged_sphgroup(), ged_view2grid_lu(), ged_view_init(), get_pole_dist_to_face(), grass_render(), isect_ray_dsp_bb(), isect_ray_snurb_face(), light_hit(), light_miss(), light_setup(), nmg_2_vrml(), nmg_assess_eu(), nmg_cnurb_to_vlist(), nmg_fcut_face_2d(), nmg_find_eu_leftvec(), nmg_get_interior_pt(), nmg_isect_2faceuse(), nmg_isect_pt_facet(), nmg_loop_g(), nmg_loop_plane_area2(), nmg_lu_to_vlist(), nmg_region_a(), nmg_s_to_vlist(), nmg_shell_a(), nmg_snurb_calc_lu_uv_orient(), nmg_to_tgc(), nmg_triangulate_rm_holes(), osl_refraction_hit(), osl_render(), phong_render(), pipe_elements_calculate(), plotsurfaceleafs(), plottrimleafs(), rr_hit(), rr_render(), rt_arb_bbox(), rt_arb_mk_planes(), rt_arbn_bbox(), rt_arbn_norm(), rt_arbn_plot(), rt_ars_adjust(), rt_ars_bbox(), rt_ars_import4(), rt_bot_adjust(), rt_bot_bbox(), rt_bot_centroid(), rt_bot_smooth(), rt_bot_sort_faces(), rt_bot_vertex_fuse(), rt_bound_internal(), rt_bound_tree(), rt_brep_prep(), rt_clean(), rt_cline_bbox(), rt_dsp_bbox(), rt_dsp_brep(), rt_dsp_plot(), rt_ebm_bbox(), rt_ebm_dda(), rt_ebm_norm(), rt_ebm_prep(), rt_ehy_bbox(), rt_epa_bbox(), rt_extrude_bbox(), rt_extrude_prep(), rt_grp_prep(), rt_hf_import4(), rt_hf_shot(), rt_hlf_norm(), rt_hlf_prep(), rt_hyp_bbox(), rt_hyp_plot(), rt_joint_prep(), rt_linear_pipe_prep(), rt_metaball_bbox(), rt_metaball_get_bounding_sphere(), rt_metaball_norm_internal(), rt_new_rti(), rt_nmg_mc_crosspew(), rt_nmg_mc_pew(), rt_nurb_bbox(), rt_nurb_c_bound(), rt_nurb_s_bound(), rt_part_import4(), rt_part_import5(), rt_pg_bbox(), rt_pipe_adjust(), rt_pipe_centroid(), rt_pnts_bbox(), rt_prep_parallel(), rt_process_uplot_value(), rt_reprep(), rt_rhc_bbox(), rt_rpc_bbox(), rt_split_mostly_empty_cells(), rt_tgc_bbox(), rt_tgc_tess(), rt_traverse_tree(), rt_vol_bbox(), rt_vol_import4(), rt_vol_import5(), rt_vol_norm(), rt_vol_prep(), rt_vol_shot(), rtrans_render(), scloud_render(), seg_to_vlist(), star_render(), summary_reports(), tesselate_pipe_bend(), toon_render(), tthrm_setup(), vo_arot_cmd(), vo_open_cmd(), wood_setup(), wraypaint(), XGLUE(), and xxx_render().

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

Definition at line 55 of file color.c.

Referenced by _ged_rt_set_eye_model(), add_seg(), bend_pipe_shot(), bn_3pts_collinear(), bn_aet_vec(), bn_coplanar(), bn_eigen2x2(), bn_isect_line2_line2(), bn_isect_line3_line3(), bn_isect_line_lseg(), bn_isect_lseg2_lseg2(), bn_isect_lseg3_lseg3(), bn_mat_angles(), bn_mat_ck(), bn_mat_is_equal(), bn_poly_quadratic_roots(), bn_poly_quartic_roots(), bn_vec_ortho(), bu_hsv_to_rgb(), bu_rgb_to_hsv(), classify_seg(), combmem_disassemble_rmat(), compute_intervals_isectline(), cone_csg(), control_polygon_flat_enough(), cylinder_csg(), cylindrical_loop_planar_vertices(), db_dirbuild(), DegreeReduction(), Eplot(), FindLoops(), fire_render(), gcv_compute_intervals_isectline(), ged_concat(), ged_find_polygon_area(), ged_ps(), ged_qvrot(), ged_solids_on_ray(), ged_view_update(), NurbsTools::getClosestPoint(), getHorizontalTangent(), getVerticalTangent(), guess_class_from_hitlist_max(), guess_class_from_hitlist_min(), interpolateLocalCubicCurve(), main(), mike_persp_mat(), mk_hyp(), nmg_ck_fu_verts(), nmg_ck_lu_orientation(), nmg_ck_v_in_2fus(), nmg_ck_v_in_fus(), nmg_classify_pt_loop_new(), nmg_extrude_face(), nmg_extrude_shell(), nmg_find_eu_leftvec(), nmg_get_max_edge_inters(), nmg_isect_2faceuse(), nmg_isect_line2_face2pNEW(), nmg_isect_potcut_fu(), nmg_isect_pt_facet(), nmg_loop_g(), nmg_loop_is_ccw(), nmg_mc_evaluate(), nmg_shell_coplanar_face_merge(), nmg_to_tgc(), nmg_two_face_fuse(), nmg_wedge_class(), brep_hit::operator==(), pipe_elements_calculate(), pnt2d_array_get_dimension(), pnt_compare_2d(), poly2tri_CDT(), refit_edge(), rr_hit(), rr_refract(), rr_render(), rt_arb_add_pt(), rt_boolfinal(), rt_boolweave(), rt_bound_internal(), rt_brep_shot(), rt_cell_n_on_ray(), rt_cline_shot(), rt_dsp_shot(), rt_ehy_brep(), rt_ehy_export4(), rt_ehy_export5(), rt_ehy_shot(), rt_ell_prep(), rt_ell_tess(), rt_ell_tnurb(), rt_epa_export4(), rt_epa_export5(), rt_epa_shot(), rt_eto_brep(), rt_eto_shot(), rt_eto_tess(), rt_extrude_bbox(), rt_extrude_prep(), rt_extrude_shot(), rt_gen_elliptical_grid(), rt_grp_import4(), rt_grp_import5(), rt_hlf_import4(), rt_hlf_import5(), rt_hlf_shot(), rt_hlf_xform(), rt_hrt_prep(), rt_hrt_shot(), rt_hrt_vshot(), rt_hyp_shot(), rt_hyp_tess(), rt_joint_import5(), rt_line_on_plane(), rt_mk_hyperbola(), rt_mk_parabola(), rt_nmg_mc_pew(), rt_nurb_c_check(), rt_nurb_s_check(), rt_nurb_uv_dist(), rt_pg_shot(), rt_pipe_brep(), rt_rec_prep(), rt_rec_shot(), rt_revolve_shot(), rt_rhc_shot(), rt_rpc_export4(), rt_rpc_export5(), rt_rpc_shot(), rt_shootray(), rt_shootray_bundle(), rt_sph_prep(), rt_superell_prep(), rt_superell_shot(), rt_tgc_prep(), rt_tgc_shot(), rt_tgc_vshot(), rt_tor_curve(), rt_tor_prep(), rt_tor_shot(), rt_tor_vshot(), subbrep_is_cone(), subbrep_is_cylinder(), surface_GetClosestPoint3dFirstOrder(), surface_GetClosestPoint3dFirstOrderSubdivision(), utah_newton_solver(), vo_update(), and XGLUE().

#define V3ARGS (   a)    (a)[X], (a)[Y], (a)[Z]

Definition at line 56 of file color.c.

Referenced by add_seg(), air_render(), bbd_render(), bn_dist_line3_line3(), bn_dist_pt2_lseg2(), bn_dist_pt3_line3(), bn_dist_pt3_lseg3(), bn_hlf_class(), bn_isect_line3_line3(), bn_isect_lseg3_lseg3(), bn_mat_fromto(), bn_mat_lookat(), bn_vec_ortho(), BoT2Vector3d(), bot2vrml(), bu_hsv_to_rgb(), check_hitstate(), classify_seg(), compose(), cut_unimonotone(), db5_sync_attr_to_comb(), db_parse_1anim(), dl_print_schain(), dsp_pos(), exposed_air(), fbm_render(), fire_render(), fractal_render(), gauss_render(), ged_adc(), ged_get_autoview(), ged_get_comb(), ged_gqa(), ged_make(), ged_mater(), ged_rtwizard(), ged_ypr(), go_draw_faceplate(), grass_render(), hit(), isect_ray_cell_top(), isect_ray_dsp_bb(), isect_ray_planar_face(), isect_ray_snurb_face(), isect_ray_triangle(), light_gen_sample_pts(), light_hit(), light_init(), light_maker(), light_miss(), list_report(), main(), make_near_list(), nmg_2_vrml(), nmg_assess_eu(), nmg_break_long_edges(), nmg_bsegs(), nmg_calc_new_v(), nmg_ck_eg_verts(), nmg_ck_v_in_2fus(), nmg_ck_v_in_fus(), nmg_ck_vert_on_fus(), nmg_class_lu_fu(), nmg_class_pt_euvu(), nmg_class_pt_fu_except(), nmg_class_pt_lu_except(), nmg_class_pt_s(), nmg_class_ray_vs_shell(), nmg_classify_pt_loop(), nmg_classify_pt_loop_new(), nmg_close_shell(), nmg_cnurb_lseg_coincident(), nmg_complex_vertex_solve(), nmg_dist_to_cross(), nmg_do_radial_join(), nmg_dump_model(), nmg_edge_collapse(), nmg_eval_linear_trim_to_tol(), nmg_extrude_shell(), nmg_face_rs_init(), nmg_fcut_face(), nmg_find_eu_leftvec(), nmg_find_first_last_use_of_v_in_fu(), nmg_find_path(), nmg_find_top_face_in_dir(), nmg_fix_crossed_loops(), nmg_fix_decomposed_shell_normals(), nmg_flatten_face(), nmg_follow_free_edges_to_vertex(), nmg_fu_planeeqn(), nmg_get_edge_lines(), nmg_in_vert(), nmg_is_crack_outie(), nmg_isect_eu_eu(), nmg_isect_eu_fu(), nmg_isect_line2_face2pNEW(), nmg_je(), nmg_make_connect_faces(), nmg_make_dualvu(), nmg_make_faces_at_vert(), nmg_mc_realize_cube(), nmg_mesh_two_faces(), nmg_mk_model_from_region(), nmg_move_edge_thru_pt(), nmg_open_shells_connect(), nmg_pr_eg(), nmg_pr_eu_endpoints(), nmg_pr_inter(), nmg_pr_ptbl_vert_list(), nmg_pr_vg(), nmg_pr_vu(), nmg_pr_vu_briefly(), nmg_pr_vua(), nmg_purge_unwanted_intersection_points(), nmg_radial_build_list(), nmg_radial_join_eu(), nmg_radial_join_eu_NEW(), nmg_remove_short_eus_inter(), nmg_simple_vertex_solve(), nmg_simplify_inter(), nmg_triangulate_fu(), nmg_triangulate_rm_holes(), nmg_vertex_gv(), nmg_vertexuse_a_cnurb(), nmg_vertexuse_nv(), nmg_veu(), nmg_vface(), nmg_vu_angle_measure(), overlap(), pdv_3(), pdv_3line(), pdv_3space(), pick_edges(), pick_eu(), plane_worker(), plot_dsp_bb(), pr_shadework(), print_thrm_seg(), prj_render(), project_point(), project_pt(), ray_hit_vertex(), recurse_dsp_bb(), rr_render(), rt_advance_to_next_cell(), rt_arb_shot(), rt_ars_get(), rt_ars_tess(), rt_bot_get(), rt_bot_tess(), rt_cell_n_on_ray(), rt_ck_vlist(), rt_cline_get(), rt_cline_norm(), rt_comb_export5(), rt_comb_get(), rt_dsp_norm(), rt_dsp_prep(), rt_dsp_shot(), rt_extrude_get(), rt_extrude_shot(), rt_gen_conic(), rt_metaball_adjust(), rt_metaball_describe(), rt_metaball_get(), rt_metaball_print(), rt_metaballpt_print(), rt_nmg_get(), rt_nmg_mc_crosspew(), rt_nurb_intersect(), rt_nurb_project_srf(), rt_pg_shot(), rt_pipe_ck(), rt_pipe_get(), rt_pipe_shot(), rt_pipept_print(), rt_shootray(), rt_shootray_bundle(), rt_sketch_get(), rt_tcl_pr_cutter(), rt_tgc_shot(), rt_vls_pipept(), shade_inputs(), shoot_and_plot(), show_seg(), summary_reports(), tcl_render(), tesselate_pipe_bend(), tesselate_pipe_linear(), test_compose(), tie_push(), to_axes(), to_data_arrows(), to_data_axes(), to_data_labels(), to_data_lines(), to_data_pick(), to_data_polygons(), to_faceplate(), to_mouse_poly_circ(), to_mouse_poly_cont(), to_mouse_poly_ell(), to_mouse_poly_rect(), to_mouse_protate(), to_mouse_ptranslate(), to_poly_circ_mode(), to_poly_cont_build(), to_poly_ell_mode(), to_poly_rect_mode(), to_screen2model(), to_screen2view(), tthrm_render(), tthrm_setup(), unresolved(), validate_tbl2d(), wood_setup_2(), and XGLUE().

Enumeration Type Documentation

enum axis
Enumerator

Definition at line 48 of file color.c.