Blender V2.61 - r43446
Defines | Functions

BLI_math_base.h File Reference

#include <math.h>
#include "BLI_math_inline.h"
#include "intern/math_base_inline.c"

Go to the source code of this file.

Defines

#define M_PI   3.14159265358979323846
#define M_PI_2   1.57079632679489661923
#define M_SQRT2   1.41421356237309504880
#define M_SQRT1_2   0.70710678118654752440
#define M_1_PI   0.318309886183790671538
#define M_E   2.7182818284590452354
#define M_LOG2E   1.4426950408889634074
#define M_LOG10E   0.43429448190325182765
#define M_LN2   0.69314718055994530942
#define M_LN10   2.30258509299404568402
#define MAXFLOAT   ((float)3.40282347e+38)
#define sqrtf(a)   ((float)sqrt(a))
#define powf(a, b)   ((float)pow(a, b))
#define cosf(a)   ((float)cos(a))
#define sinf(a)   ((float)sin(a))
#define acosf(a)   ((float)acos(a))
#define asinf(a)   ((float)asin(a))
#define atan2f(a, b)   ((float)atan2(a, b))
#define tanf(a)   ((float)tan(a))
#define atanf(a)   ((float)atan(a))
#define floorf(a)   ((float)floor(a))
#define ceilf(a)   ((float)ceil(a))
#define fabsf(a)   ((float)fabs(a))
#define logf(a)   ((float)log(a))
#define expf(a)   ((float)exp(a))
#define fmodf(a, b)   ((float)fmod(a, b))
#define hypotf(a, b)   ((float)hypot(a, b))
#define SWAP(type, a, b)   { type sw_ap; sw_ap=(a); (a)=(b); (b)=sw_ap; }
#define CLAMP(a, b, c)   if((a)<(b)) (a)=(b); else if((a)>(c)) (a)=(c)

Functions

MINLINE float sqrt3f (float f)
MINLINE double sqrt3d (double d)
MINLINE float saacosf (float f)
MINLINE float saasinf (float f)
MINLINE float sasqrtf (float f)
MINLINE float saacos (float fac)
MINLINE float saasin (float fac)
MINLINE float sasqrt (float fac)
MINLINE float interpf (float a, float b, float t)
MINLINE float minf (float a, float b)
MINLINE float maxf (float a, float b)
MINLINE float signf (float f)
MINLINE float power_of_2 (float f)
MINLINE int is_power_of_2_i (int n)
MINLINE int power_of_2_max_i (int n)
MINLINE int power_of_2_min_i (int n)
MINLINE float shell_angle_to_dist (float angle)
double double_round (double x, int ndigits)

Detailed Description

Definition in file BLI_math_base.h.


Define Documentation

#define acosf (   a)    ((float)acos(a))
#define asinf (   a)    ((float)asin(a))

Definition at line 96 of file BLI_math_base.h.

Referenced by btAsin(), flyApply_ndof(), saasinf(), and safe_asinf().

#define atan2f (   a,
 
)    ((float)atan2(a, b))
#define atanf (   a)    ((float)atan(a))
#define ceilf (   a)    ((float)ceil(a))
#define CLAMP (   a,
  b,
 
)    if((a)<(b)) (a)=(b); else if((a)>(c)) (a)=(c)

Definition at line 142 of file BLI_math_base.h.

#define cosf (   a)    ((float)cos(a))

Definition at line 87 of file BLI_math_base.h.

Referenced by add_render_lamp(), autosmooth(), bsdf_microfacet_beckmann_sample(), bsdf_microfacet_ggx_sample(), bsdf_westin_backscatter_sample(), btCos(), C_Matrix_Rotation(), calculate_stabdata(), camera_params_from_object(), ComputeAttenuatedSunlight(), SubdAccBuilder::computeBoundaryTangentStencils(), SubdAccBuilder::computeEdgeStencil(), SubdAccBuilder::computeInteriorStencil(), concentric_sample_disk(), dblur(), do_chroma_key(), draw_forcefield(), draw_rotation_guide(), draw_spot_cone(), drawArc(), drawHelpline(), drawlamp(), drawspeaker(), feline_eval(), glutil_draw_filled_arc(), glutil_draw_lined_arc(), gpu_lamp_from_blender(), load_tex(), make_prim(), makebevelcurve(), p_chart_lscm_solve(), p_chart_stretch_minimize(), PerezFunction(), polar_to_x(), psys_get_birth_coordinates(), QMC_sampleDisc(), QMC_sampleHemi(), QMC_samplePhong(), radangle2imp(), RandomSpherical(), regular_polygon_sample(), render_new_particle_system(), GenericEmissiveClosure::sample(), WestinBackscatterClosure::sample(), MicrofacetBeckmannClosure< Refractive >::sample(), MicrofacetGGXClosure< Refractive >::sample(), sample_uniform_hemisphere(), sample_uniform_sphere(), KX_ObstacleSimulationTOI_rays::sampleRVO(), set_phong_threshold(), shadeHaloFloat(), shell_angle_to_dist(), single_axis_angle_to_mat3(), sky_angle_between(), sky_perez_function(), spherical_to_direction(), split_sharp_edges(), spotvolume(), svm_magic(), svm_math(), tex_strength(), to_unit_disk(), transform_rotate(), ui_draw_but_HSVCIRCLE(), ui_ndofedit_but_HSVCIRCLE(), and vec_to_quat().

#define expf (   a)    ((float)exp(a))
#define fabsf (   a)    ((float)fabs(a))

Definition at line 114 of file BLI_math_base.h.

Referenced by adaptive_sample_contrast_val(), alter_co(), applyModifier(), area_poly_v3(), area_tri_v2(), average_fac(), axis_dominant_v3(), axisProjection(), b_bone_spline_setup(), bake_set_vlr_dxyco(), barycentric_weights(), BKE_nlastrip_within_bounds(), blender_camera_focal_distance(), BLI_bvhtree_ray_cast(), BLI_gNoise(), BLI_gTurbulence(), BLI_jitterate1(), BLI_jitterate2(), BLI_turbulence1(), BME_bevel_project_vec(), bsdf_ashikhmin_velvet_eval_reflect(), bsdf_ashikhmin_velvet_sample(), bsdf_microfacet_beckmann_eval_transmit(), bsdf_microfacet_beckmann_sample(), bsdf_microfacet_ggx_eval_transmit(), bsdf_microfacet_ggx_sample(), btFabs(), bvh_inverse_direction(), check_zone(), clipMirrorModifier(), cmp_uv(), compare_v3v3(), compare_v4v4(), compatible_bump_compute(), compatible_bump_uv_derivs(), compute_reduced_albedo(), correct_bezpart(), costAngle(), createSlideVerts(), cuboid_do(), defocus_blur(), differential_dudv(), dist_Chebychev(), dist_Manhattan(), dist_Minkovsky(), dist_MinkovskyH(), dist_to_line_v2(), DM_calc_auto_bump_scale(), do_chroma_key(), do_color_key(), do_displace(), do_mapuv(), do_material_tex(), do_versions(), draw_bb_quadric(), draw_ptcache_edit(), draw_rotation_guide(), draw_uvs_stretch(), draw_view_axis(), drawlamp(), edgetag_cut_cost(), EM_make_uv_vert_map(), emissive_eval(), emissive_pdf(), enforce_locks(), envcube_isect(), esubdivideflag(), GenericEmissiveClosure::eval(), AshikhminVelvetClosure::eval_reflect(), MicrofacetBeckmannClosure< Refractive >::eval_transmit(), MicrofacetGGXClosure< Refractive >::eval_transmit(), extrudeflag_edge(), extrudeflag_vert(), fabs(), ff_visible_quad(), filter_table(), find_nearest_uv_vert(), find_vertex_tangent(), flatten_surface_closure_tree(), flatten_volume_closure_tree(), flyApply(), flyApply_ndof(), fresnel_dielectric_cos(), get_graph_keyframe_extents(), gp_draw_stroke_3d(), gp_draw_stroke_buffer(), graphkeys_euler_filter_exec(), handleNumInput(), handleRadialSymmetry(), init_meta(), InitTriInfo(), invert_m4_m4(), StencilMask::is_normalized(), is_orthogonal_m3(), is_orthogonal_m4(), isect_sweeping_sphere_tri_v3(), line_clip_rect2f(), line_isect_x(), line_isect_y(), make_bloomtab(), make_uv_vert_map(), mat3_to_compatible_eulO(), mbvh_inverse_direction(), measure_facepair(), mg_RidgedMultiFractal(), mixImages(), moveCloserToDistanceFromPlane(), my_get_local_bounds(), nearest_point_in_tri_surface(), nlastrip_get_frame_actionclip(), nlastrip_get_influence(), noise_basis_hard(), noise_musgrave_ridged_multi_fractal(), noise_turbulence(), noise_wave(), nonzerof(), NotZero(), nr_distance_to_edge(), ntap_bump_compute(), object_camera_dof_distance(), object_get_dimensions(), occ_visible_quad(), p_edge_implicit_seam(), paint_calc_object_space_radius(), param_average(), precalc_wipe_zone(), premul_compbuf(), project_brush_radius(), project_bucket_clip_face(), project_from_view(), project_renderdata(), psys_get_birth_coordinates(), psys_get_texture(), qbvh_inverse_direction(), quat_to_axis_angle(), quat_to_mat3(), quat_to_mat4(), ramp_blend(), rasterize_half(), ray_offset(), renderflare(), SubsurfaceClosure::root_find_Rd(), MicrofacetBeckmannClosure< Refractive >::sample(), MicrofacetGGXClosure< Refractive >::sample(), AshikhminVelvetClosure::sample(), KX_ObstacleSimulationTOI_rays::sampleRVO(), scatter_tree_new(), sculpt_clip(), select_linked_flat_faces(), select_sharp_edges_exec(), set_axis(), shadeHaloFloat(), shell_angle_to_dist(), similar_edge_select__internal(), similar_face_select__internal(), simpleDeform_bend(), smooth_vertex(), splineik_evaluate_bone(), spothalo(), stabilization_auto_scale_factor(), sticky_select(), sum_branch_radiance(), sum_leaf_radiance(), sum_or_add_vertex_tangent(), svd_m4(), svm_checker(), svm_node_closure_set_mix_weight(), svm_node_layer_weight(), svm_node_set_bump(), svm_voronoi(), tex_tri(), texture_rgb_blend(), texture_value_blend(), track_mouse_area(), transform_uniform_scale(), triangle_light_pdf(), turb(), ui_do_but_CURVE(), ui_numedit_but_NUM(), UI_view2d_listview_view_to_cell(), view_zoomdrag_modal(), voronoi_distance(), voronoiTex(), vTurb(), waveModifier_do(), and where_is_object_parslow().

#define floorf (   a)    ((float)floor(a))
#define fmodf (   a,
 
)    ((float)fmod(a, b))
#define hypotf (   a,
 
)    ((float)hypot(a, b))

Definition at line 126 of file BLI_math_base.h.

Referenced by svd_m4(), and svm_node_tex_environment().

#define logf (   a)    ((float)log(a))
#define M_1_PI   0.318309886183790671538
#define M_E   2.7182818284590452354

Definition at line 60 of file BLI_math_base.h.

#define M_LN10   2.30258509299404568402

Definition at line 72 of file BLI_math_base.h.

Referenced by soft_range_round_down(), and soft_range_round_up().

#define M_LN2   0.69314718055994530942
#define M_LOG10E   0.43429448190325182765

Definition at line 66 of file BLI_math_base.h.

#define M_LOG2E   1.4426950408889634074

Definition at line 63 of file BLI_math_base.h.

Referenced by imagewraposa_aniso().

#define M_PI   3.14159265358979323846

Definition at line 45 of file BLI_math_base.h.

#define M_PI_2   1.57079632679489661923
#define M_SQRT1_2   0.70710678118654752440

Definition at line 54 of file BLI_math_base.h.

Referenced by calctrackballvec().

#define M_SQRT2   1.41421356237309504880
#define MAXFLOAT   ((float)3.40282347e+38)
#define powf (   a,
 
)    ((float)pow(a, b))
#define sinf (   a)    ((float)sin(a))
#define sqrtf (   a)    ((float)sqrt(a))

Definition at line 81 of file BLI_math_base.h.

Referenced by FLUID_3D::addSmokeTestCase(), FLUID_3D::addVorticity(), alter_co(), area_lamp_vectors(), area_sample(), AtmospherePixleShader(), barycentric_transform(), BKE_screen_view3d_zoom_from_fac(), BLI_initjit(), bsdf_microfacet_beckmann_eval_reflect(), bsdf_microfacet_beckmann_eval_transmit(), bsdf_microfacet_beckmann_sample(), bsdf_microfacet_ggx_eval_reflect(), bsdf_microfacet_ggx_eval_transmit(), bsdf_microfacet_ggx_sample(), bsdf_oren_nayar_get_intensity(), bsdf_ward_eval_reflect(), bsdf_ward_sample(), bsdf_westin_backscatter_sample(), btSqrt(), calc_overlap(), calc_vp_strength_dl(), calculate_speedvector(), cloth_collision_response_static(), SubdAccBuilder::computeBoundaryTangentStencils(), SubdAccBuilder::computeEdgeStencil(), curvemapping_changed(), dblur(), dist_Minkovsky4(), dist_MinkovskyH(), dist_Real(), dist_to_line_segment_v2(), DM_calc_auto_bump_scale(), do_material_tex(), do_projectpaint_thread(), do_sky_tex(), drawHelpline(), drawlamp(), dynamicPaint_paintMesh(), dynamicPaint_paintParticles(), dynamicPaint_paintSinglePoint(), WardClosure::eval_reflect(), MicrofacetBeckmannClosure< Refractive >::eval_reflect(), MicrofacetGGXClosure< Refractive >::eval_reflect(), MicrofacetBeckmannClosure< Refractive >::eval_transmit(), MicrofacetGGXClosure< Refractive >::eval_transmit(), ewa_eval(), face_duplilist(), face_to_crn_interp(), ff_normalize(), fglow(), find_first_points(), find_nearest_track(), fresnel_dielectric(), fresnel_dielectric_cos(), get_vert2geom_distance(), imagewraposa_aniso(), imp2radangle(), init_mv_jit(), lamp_get_visibility(), len(), len_v2(), len_v2v2(), len_v3(), Length(), lensDistort(), load_fluidsimspeedvectors(), load_tex(), makeBokeh(), mat3_to_quat(), normalize_v2_v2(), normalize_v3_v3(), normalizef(), ntap_bump_compute(), occ_lookup(), OSLRenderServices::pointcloud(), precalc_wipe_zone(), psys_render_projected_area(), refraction(), regular_polygon_sample(), renderflare(), SubsurfaceClosure::root_find_Rd(), rule_avoid_collision(), samevolume_evaluate(), GenericEmissiveClosure::sample(), WestinBackscatterClosure::sample(), WardClosure::sample(), MicrofacetBeckmannClosure< Refractive >::sample(), MicrofacetGGXClosure< Refractive >::sample(), sample_cos_hemisphere(), sample_uniform_hemisphere(), sample_uniform_sphere(), sasqrtf(), QuadDice::scale_factor(), scatter_settings_new(), SubsurfaceClosure::setup(), shadeHaloFloat(), smoothMask(), speedvector_project(), sph_density_accum_cb(), spotvolume(), WTURBULENCE::stepTurbulenceFull(), svd_m4(), svm_gradient(), sweepCircleCircle(), sweepCircleSegment(), tex_strength(), triangle_sample_MT(), ui_numedit_but_NORMAL(), ui_textedit_set_cursor_pos(), vectorscope_draw_target(), vnormal(), voronoi_distance(), WardIso_Spec(), waveModifier_do(), and wood_int().

#define SWAP (   type,
  a,
 
)    { type sw_ap; sw_ap=(a); (a)=(b); (b)=sw_ap; }

Definition at line 138 of file BLI_math_base.h.

Referenced by adduplicateflagNurb(), applyModifier(), area_copy_data(), armature_click_extrude_exec(), armature_extrude_exec(), bake_rasterize(), BKE_nlastrips_has_space(), BKE_nlatrack_has_space(), BKE_tracking_clamp_track(), buf_rectfill_area(), buildRawVertIndicesData(), bvh_partition(), createRepresentation(), curvemapping_do_ibuf(), deleteflagNurb(), do_2d_mapping(), do_grab_brush(), do_strand_fillac(), doMirrorOnAxis(), drawviewborder_triangle(), dvert_mirror_op(), edge_rotate(), filldisplist(), flipface(), getLowestRoot(), imagewraposa(), imagewraposa_aniso(), imapaint_canvas_set(), IMB_flipx(), interp_weights_face_v3(), invert_m4_m4(), isect_seg_seg_v2_point(), isect_sweeping_sphere_tri_v3(), make_edges_mdata(), makeBevelList(), mesh_get_x_mirror_faces(), mouse_on_side(), multiple_scattering_diffusion(), node_composit_exec_bilateralblur(), node_update_basis(), ob_parcurve(), occ_build_split(), old_mdisps_convert(), partition_indices(), rasterize_half(), RE_SwapResult(), RE_zbuf_accumulate_vecblur(), rotate_direction_nurb(), seq_swap(), sequencer_change_effect_input_exec(), setup_app_data(), shadeSkyView(), sort_time_beztmaps(), sort_time_fcurve(), swap_v2_v2(), swap_v3_v3(), swap_v4_v4(), switchdirection_knots(), switchdirectionNurb(), test_index_face(), texture_value_blend(), to_edgesort(), ui_but_update_from_old_block(), ui_but_update_linklines(), ui_textedit_move(), uiBlockFlipOrder(), uiWidgetScrollDraw(), undo_copy_tile(), viewdolly_apply(), viewzoom_apply(), widget_numbut(), widget_numslider(), widget_state(), widget_state_numslider(), widget_textbut(), zbuffer_transp_shade(), zbufshade_tile(), and zbufshadeDA_tile().

#define tanf (   a)    ((float)tan(a))

Function Documentation

double double_round ( double  x,
int  ndigits 
)

Definition at line 65 of file math_base.c.

References fabs(), pow(), and round().

Referenced by Color_ToTupleExt(), Euler_ToTupleExt(), Quaternion_to_tuple_ext(), and Vector_to_tuple_ext().

MINLINE float interpf ( float  a,
float  b,
float  t 
)
MINLINE int is_power_of_2_i ( int  n)
MINLINE float maxf ( float  a,
float  b 
)
MINLINE float minf ( float  a,
float  b 
)
MINLINE float power_of_2 ( float  f)
MINLINE int power_of_2_max_i ( int  n)
MINLINE int power_of_2_min_i ( int  n)

Definition at line 134 of file math_base_inline.c.

References is_power_of_2_i().

Referenced by BL_Texture::GetPow2(), smaller_pow2_limit(), and split_width().

MINLINE float saacos ( float  fac)
MINLINE float saacosf ( float  f)

Definition at line 78 of file math_base_inline.c.

References acosf, and M_PI.

Referenced by ff_quad_form_factor(), and occ_quad_form_factor().

MINLINE float saasin ( float  fac)

Definition at line 65 of file math_base_inline.c.

References KDL::asin(), and M_PI.

Referenced by angle_normalized_v2v2(), and angle_normalized_v3v3().

MINLINE float saasinf ( float  f)

Definition at line 85 of file math_base_inline.c.

References asinf, and M_PI.

MINLINE float sasqrt ( float  fac)
MINLINE float sasqrtf ( float  f)

Definition at line 92 of file math_base_inline.c.

References sqrtf.

MINLINE float shell_angle_to_dist ( float  angle)

Definition at line 107 of file math_base_inline.c.

References cosf, fabsf, and SMALL_NUMBER.

Referenced by applyModifier(), EM_solidify(), and uv_image_outset().

MINLINE float signf ( float  f)

Definition at line 153 of file math_base_inline.c.

Referenced by do_displace(), nonzerof(), and svm_node_set_bump().

MINLINE double sqrt3d ( double  d)

Definition at line 51 of file math_base_inline.c.

References KDL::exp(), and log().

Referenced by findzero().

MINLINE float sqrt3f ( float  f)

Definition at line 44 of file math_base_inline.c.

References KDL::exp(), and log().

Referenced by ui_numedit_but_HSVCIRCLE().