Blender V4.3
BLI_math_base.h File Reference
#include "BLI_assert.h"
#include "BLI_math_inline.h"
#include "BLI_sys_types.h"
#include <math.h>
#include "intern/math_base_inline.c"

Go to the source code of this file.

Macros

#define M_PI   3.14159265358979323846 /* pi */
 
#define M_PI_2   1.57079632679489661923 /* pi/2 */
 
#define M_PI_4   0.78539816339744830962 /* pi/4 */
 
#define M_SQRT2   1.41421356237309504880 /* sqrt(2) */
 
#define M_SQRT1_2   0.70710678118654752440 /* 1/sqrt(2) */
 
#define M_SQRT3   1.73205080756887729352 /* sqrt(3) */
 
#define M_SQRT1_3   0.57735026918962576450 /* 1/sqrt(3) */
 
#define M_1_PI   0.318309886183790671538 /* 1/pi */
 
#define M_E   2.7182818284590452354 /* e */
 
#define M_LOG2E   1.4426950408889634074 /* log_2 e */
 
#define M_LOG10E   0.43429448190325182765 /* log_10 e */
 
#define M_LN2   0.69314718055994530942 /* log_e 2 */
 
#define M_LN10   2.30258509299404568402 /* log_e 10 */
 
#define NAN_FLT   (*((float *)(&NAN_INT)))
 
#define BLI_ASSERT_UNIT_EPSILON   0.0002f
 
#define BLI_ASSERT_UNIT_EPSILON_DB   0.0002
 
#define BLI_ASSERT_UNIT_V3(v)
 
#define BLI_ASSERT_UNIT_V3_DB(v)
 
#define BLI_ASSERT_UNIT_V2(v)
 
#define BLI_ASSERT_UNIT_QUAT(q)
 
#define BLI_ASSERT_ZERO_M3(m)
 
#define BLI_ASSERT_ZERO_M4(m)
 
#define BLI_ASSERT_UNIT_M3(m)
 

Functions

MINLINE float pow2f (float x)
 
MINLINE float pow3f (float x)
 
MINLINE float pow4f (float x)
 
MINLINE float pow7f (float x)
 
MINLINE float sqrt3f (float f)
 
MINLINE double sqrt3d (double d)
 
MINLINE float sqrtf_signed (float f)
 
MINLINE float interpf (float target, float origin, float t)
 
MINLINE double interpd (double target, double origin, double t)
 
MINLINE float ratiof (float min, float max, float pos)
 
MINLINE double ratiod (double min, double max, double pos)
 
MINLINE float scalenorm (float a, float b, float x)
 
MINLINE double scalenormd (double a, double b, double x)
 
MINLINE int square_s (short a)
 
MINLINE int square_uchar (unsigned char a)
 
MINLINE int cube_s (short a)
 
MINLINE int cube_uchar (unsigned char a)
 
MINLINE int square_i (int a)
 
MINLINE unsigned int square_uint (unsigned int a)
 
MINLINE float square_f (float a)
 
MINLINE double square_d (double a)
 
MINLINE int cube_i (int a)
 
MINLINE unsigned int cube_uint (unsigned int a)
 
MINLINE float cube_f (float a)
 
MINLINE double cube_d (double a)
 
MINLINE float min_ff (float a, float b)
 
MINLINE float max_ff (float a, float b)
 
MINLINE float min_fff (float a, float b, float c)
 
MINLINE float max_fff (float a, float b, float c)
 
MINLINE float min_ffff (float a, float b, float c, float d)
 
MINLINE float max_ffff (float a, float b, float c, float d)
 
MINLINE double min_dd (double a, double b)
 
MINLINE double max_dd (double a, double b)
 
MINLINE double min_ddd (double a, double b, double c)
 
MINLINE double max_ddd (double a, double b, double c)
 
MINLINE int min_ii (int a, int b)
 
MINLINE int max_ii (int a, int b)
 
MINLINE int min_iii (int a, int b, int c)
 
MINLINE int max_iii (int a, int b, int c)
 
MINLINE int min_iiii (int a, int b, int c, int d)
 
MINLINE int max_iiii (int a, int b, int c, int d)
 
MINLINE uint min_uu (uint a, uint b)
 
MINLINE uint max_uu (uint a, uint b)
 
MINLINE size_t min_zz (size_t a, size_t b)
 
MINLINE size_t max_zz (size_t a, size_t b)
 
MINLINE char min_cc (char a, char b)
 
MINLINE char max_cc (char a, char b)
 
MINLINE int clamp_i (int value, int min, int max)
 
MINLINE float clamp_f (float value, float min, float max)
 
MINLINE size_t clamp_z (size_t value, size_t min, size_t max)
 
MINLINE int compare_ff (float a, float b, float max_diff)
 
MINLINE uint ulp_diff_ff (float a, float b)
 
MINLINE int compare_ff_relative (float a, float b, float max_diff, int max_ulps)
 
MINLINE bool compare_threshold_relative (float value1, float value2, float thresh)
 
MINLINE float signf (float f)
 
MINLINE int signum_i_ex (float a, float eps)
 
MINLINE int signum_i (float a)
 
MINLINE float power_of_2 (float f)
 
MINLINE int integer_digits_f (float f)
 
MINLINE int integer_digits_d (double d)
 
MINLINE int integer_digits_i (int i)
 
MINLINE int is_power_of_2_i (int n)
 
MINLINE unsigned int log2_floor_u (unsigned int x)
 
MINLINE unsigned int log2_ceil_u (unsigned int x)
 
MINLINE int power_of_2_max_i (int n)
 
MINLINE int power_of_2_min_i (int n)
 
MINLINE unsigned int power_of_2_max_u (unsigned int x)
 
MINLINE unsigned int power_of_2_min_u (unsigned int x)
 
MINLINE int divide_round_i (int a, int b)
 
MINLINE uint divide_ceil_u (uint a, uint b)
 
MINLINE uint64_t divide_ceil_ul (uint64_t a, uint64_t b)
 
MINLINE uint ceil_to_multiple_u (uint a, uint b)
 
MINLINE uint64_t ceil_to_multiple_ul (uint64_t a, uint64_t b)
 
MINLINE int mod_i (int i, int n)
 
MINLINE float floored_fmod (float f, float n)
 
MINLINE float round_to_even (float f)
 
MINLINE signed char round_fl_to_char (float a)
 
MINLINE unsigned char round_fl_to_uchar (float a)
 
MINLINE short round_fl_to_short (float a)
 
MINLINE unsigned short round_fl_to_ushort (float a)
 
MINLINE int round_fl_to_int (float a)
 
MINLINE unsigned int round_fl_to_uint (float a)
 
MINLINE signed char round_db_to_char (double a)
 
MINLINE unsigned char round_db_to_uchar (double a)
 
MINLINE short round_db_to_short (double a)
 
MINLINE unsigned short round_db_to_ushort (double a)
 
MINLINE int round_db_to_int (double a)
 
MINLINE unsigned int round_db_to_uint (double a)
 
MINLINE signed char round_fl_to_char_clamp (float a)
 
MINLINE unsigned char round_fl_to_uchar_clamp (float a)
 
MINLINE short round_fl_to_short_clamp (float a)
 
MINLINE unsigned short round_fl_to_ushort_clamp (float a)
 
MINLINE int round_fl_to_int_clamp (float a)
 
MINLINE unsigned int round_fl_to_uint_clamp (float a)
 
MINLINE signed char round_db_to_char_clamp (double a)
 
MINLINE unsigned char round_db_to_uchar_clamp (double a)
 
MINLINE short round_db_to_short_clamp (double a)
 
MINLINE unsigned short round_db_to_ushort_clamp (double a)
 
MINLINE int round_db_to_int_clamp (double a)
 
MINLINE unsigned int round_db_to_uint_clamp (double a)
 
int pow_i (int base, int exp)
 
double double_round (double x, int ndigits)
 
float floor_power_of_10 (float f)
 
float ceil_power_of_10 (float f)
 

Variables

static const int NAN_INT = 0x7FC00000
 

Detailed Description

Abbreviations

  • fl = float.
  • db = double.
  • v2 = vec2 = vector 2.
  • v3 = vec3 = vector 3.
  • v4 = vec4 = vector 4.
  • vn = vec4q = vector N dimensions, *passed as an arg, after the vector*.. -qt=quat= quaternion. -dq=dquat= dual quaternion. -m2=mat2= matrix 2x2. -m3=mat3= matrix 3x3. -m4=mat4= matrix 4x4. -eul=eulerrotation. -eulO=eulerwith order. -plane=plane 4, (vec3, distance). -plane3=plane 3, (same as aplane` with a zero 4th component).

Function Type Abbreviations

For non float versions of functions (which typically operate on floats), use single suffix abbreviations.

  • _d = double
  • _i = int
  • _u = unsigned int
  • _char = char
  • _uchar = unsigned char

Variable Names

  • f = single value
  • a, b, c = vectors
  • r = result vector
  • A, B, C = matrices
  • R = result matrix

Definition in file BLI_math_base.h.

Macro Definition Documentation

◆ BLI_ASSERT_UNIT_EPSILON

#define BLI_ASSERT_UNIT_EPSILON   0.0002f
Note
0.0001 is too small because normals may be converted from short's: see #34322.

Definition at line 381 of file BLI_math_base.h.

Referenced by axis_dominant_v3_to_m3(), axis_dominant_v3_to_m3_negate(), and quat_split_swing_and_twist().

◆ BLI_ASSERT_UNIT_EPSILON_DB

#define BLI_ASSERT_UNIT_EPSILON_DB   0.0002

Definition at line 382 of file BLI_math_base.h.

◆ BLI_ASSERT_UNIT_M3

#define BLI_ASSERT_UNIT_M3 ( m)
Value:
{ \
BLI_ASSERT_UNIT_V3((m)[0]); \
BLI_ASSERT_UNIT_V3((m)[1]); \
BLI_ASSERT_UNIT_V3((m)[2]); \
} \
(void)0

Definition at line 431 of file BLI_math_base.h.

Referenced by BKE_object_mat3_to_rot(), BKE_pchan_mat3_to_rot(), ED_armature_ebone_from_mat4(), mat3_normalized_to_eul2(), mat3_normalized_to_eulo2(), mat3_normalized_to_quat_fast(), and rotation_between_vecs_to_mat3().

◆ BLI_ASSERT_UNIT_QUAT

#define BLI_ASSERT_UNIT_QUAT ( q)
Value:
{ \
const float _test_unit = dot_qtqt(q, q); \
BLI_assert(!(fabsf(_test_unit - 1.0f) >= BLI_ASSERT_UNIT_EPSILON * 10) || \
!(fabsf(_test_unit) >= BLI_ASSERT_UNIT_EPSILON * 10)); \
} \
(void)0
#define BLI_ASSERT_UNIT_EPSILON
float dot_qtqt(const float a[4], const float b[4])
#define fabsf(x)

Definition at line 412 of file BLI_math_base.h.

Referenced by angle_normalized_qt(), angle_normalized_qtqt(), angle_signed_normalized_qt(), interp_qt_qtqt(), invert_qt_normalized(), pow_qt_fl_normalized(), quat_normalized_to_expmap(), quat_to_compatible_quat(), and WM_xr_session_state_nav_rotation_set().

◆ BLI_ASSERT_UNIT_V2

#define BLI_ASSERT_UNIT_V2 ( v)
Value:
{ \
const float _test_unit = len_squared_v2(v); \
BLI_assert(!(fabsf(_test_unit - 1.0f) >= BLI_ASSERT_UNIT_EPSILON) || \
!(fabsf(_test_unit) >= BLI_ASSERT_UNIT_EPSILON)); \
} \
(void)0
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
ATTR_WARN_UNUSED_RESULT const BMVert * v

Definition at line 404 of file BLI_math_base.h.

Referenced by angle_normalized_v2v2(), interp_v2_v2v2_slerp(), project_plane_normalized_v2_v2v2(), project_v2_v2v2_normalized(), setCustomPointsFromDirection(), shell_v2v2_mid_normalized_to_dist(), shell_v2v2_normalized_to_dist(), snap_v2_angle(), and test_edges_isect_2d_ray().

◆ BLI_ASSERT_UNIT_V3

#define BLI_ASSERT_UNIT_V3 ( v)

◆ BLI_ASSERT_UNIT_V3_DB

#define BLI_ASSERT_UNIT_V3_DB ( v)
Value:
{ \
const double _test_unit = len_squared_v3_db(v); \
BLI_assert(!(fabs(_test_unit - 1.0) >= BLI_ASSERT_UNIT_EPSILON_DB) || \
!(fabs(_test_unit) >= BLI_ASSERT_UNIT_EPSILON_DB)); \
} \
(void)0
#define BLI_ASSERT_UNIT_EPSILON_DB
MINLINE double len_squared_v3_db(const double v[3]) ATTR_WARN_UNUSED_RESULT
ccl_device_inline float2 fabs(const float2 a)

Definition at line 396 of file BLI_math_base.h.

Referenced by reflect_v3_v3v3_db().

◆ BLI_ASSERT_ZERO_M3

#define BLI_ASSERT_ZERO_M3 ( m)
Value:
{ \
BLI_assert(dot_vn_vn((const float *)m, (const float *)m, 9) != 0.0); \
} \
(void)0
double dot_vn_vn(const float *array_src_a, const float *array_src_b, int size) ATTR_WARN_UNUSED_RESULT

Definition at line 420 of file BLI_math_base.h.

◆ BLI_ASSERT_ZERO_M4

#define BLI_ASSERT_ZERO_M4 ( m)
Value:
{ \
BLI_assert(dot_vn_vn((const float *)m, (const float *)m, 16) != 0.0); \
} \
(void)0

Definition at line 426 of file BLI_math_base.h.

Referenced by ED_view3d_check_mats_rv3d().

◆ M_1_PI

◆ M_E

#define M_E   2.7182818284590452354 /* e */

Definition at line 82 of file BLI_math_base.h.

◆ M_LN10

#define M_LN10   2.30258509299404568402 /* log_e 10 */

Definition at line 94 of file BLI_math_base.h.

Referenced by soft_range_round_down(), and soft_range_round_up().

◆ M_LN2

#define M_LN2   0.69314718055994530942 /* log_e 2 */

Definition at line 91 of file BLI_math_base.h.

Referenced by blend_read_mdisps(), bm_corners_to_loops_ex(), and power_of_2().

◆ M_LOG10E

#define M_LOG10E   0.43429448190325182765 /* log_10 e */

Definition at line 88 of file BLI_math_base.h.

◆ M_LOG2E

#define M_LOG2E   1.4426950408889634074 /* log_2 e */

Definition at line 85 of file BLI_math_base.h.

Referenced by imagewraposa_aniso().

◆ M_PI

#define M_PI   3.14159265358979323846 /* pi */

Definition at line 58 of file BLI_math_base.h.

Referenced by blender::nodes::node_fn_align_euler_to_vector_cc::align_rotations_fixed_pivot(), blender::nodes::node_fn_align_rotation_to_vector_cc::align_rotations_fixed_pivot(), angle_normalized_v2v2(), angle_normalized_v3v3(), angle_poly_v3(), angle_quad_v3(), angle_signed_on_axis_normalized_v3v3_v3(), angle_signed_on_axis_v3v3_v3(), angle_tri_v3(), blender::geometry::angle_wrap(), angle_wrap_rad(), applyRotationValue(), axisProjection(), batch_sphere_wire(), BKE_kelvinlet_init_params(), BKE_mask_spline_project_co(), BKE_maskrasterize_handle_init(), BKE_pose_channel_ensure(), blend(), BLI_dial_angle(), BLI_easing_elastic_ease_in(), BLI_easing_elastic_ease_in_out(), BLI_easing_elastic_ease_out(), BLI_easing_sine_ease_in_out(), BLI_ewa_imp2radangle(), BLI_uvproject_from_camera(), blo_do_versions_250(), blo_do_versions_270(), BM_edges_sharp_from_angle_set(), bm_mesh_calc_uvs_sphere_face(), BM_mesh_wireframe(), BM_vert_calc_edge_angle_ex(), bmo_create_uvsphere_exec(), button2d_geom_draw_backdrop(), blender::ed::sculpt_paint::auto_mask::calc_brush_normal_factor(), calc_radial_symmetry_feather(), blender::ed::sculpt_paint::auto_mask::calc_view_normal_factor(), blender::geometry::calculate_angles(), blender::nodes::node_geo_mesh_primitive_ico_sphere_cc::calculate_bounds_ico_sphere(), blender::geometry::calculate_bounds_radial_primitive(), blender::geometry::calculate_bounds_uv_sphere(), blender::geometry::calculate_cone_uvs(), blender::geometry::calculate_cone_verts(), blender::bke::curves::poly::calculate_normals_minimum(), blender::geometry::calculate_sphere_vertex_data(), blender::nodes::node_shader_tex_gradient_cc::GradientFunction::call(), blender::nodes::node_shader_tex_wave_cc::WaveFunction::call(), check_zone(), circle_dashed_verts(), blender::eevee::circle_to_polygon_angle(), blender::eevee::circle_to_polygon_radius(), circle_verts(), clamp_angle(), compatible_eul(), blender::realtime_compositor::compute_exterior_angle(), compute_seam_normal(), blender::nodes::node_composite_glare_cc::GlareOperation::compute_streak_direction(), computeBindWeights(), Freestyle::GaussianFilter::computeMask(), blender::io::usd::USDMaterialReader::convert_usd_transform_2d(), blender::bke::mesh::corner_fan_space_define(), blender::bke::mesh::corner_space_custom_data_to_normal(), blender::bke::mesh::corner_space_custom_normal_to_data(), blender::nodes::node_geo_curve_primitive_arc_cc::create_arc_curve_from_points(), blender::nodes::node_geo_curve_primitive_arc_cc::create_arc_curve_from_radius(), blender::nodes::node_geo_mesh_primitive_circle_cc::create_circle_mesh(), blender::nodes::node_geo_curve_primitive_circle_cc::create_point_circle_curve(), blender::nodes::node_geo_curve_primitive_circle_cc::create_radius_circle_curve(), blender::nodes::node_geo_curve_primitive_spiral_cc::create_spiral_curve(), blender::nodes::node_geo_curve_primitive_star_cc::create_star_curve(), blender::io::usd::create_transform2d_shader(), blender::ed::sculpt_paint::cursor_draw_point_with_symmetry(), curve_bevel_make_full_circle(), curve_draw_exec(), blender::ed::curves::curve_draw_exec_precalc(), curve_draw_exec_precalc(), CURVE_OT_draw(), blender::ed::curves::curves_draw_exec(), blender::ed::curves::CURVES_OT_draw(), damptrack_do_transform(), blender::draw::DebugDraw::DebugDraw(), dial_3d_draw_util(), dial_geom_draw(), dial_ghostarc_draw(), dial_ghostarc_draw_incremental_angle(), dial_ghostarc_get_angles(), direction_to_equirect(), do_kink(), do_kink_spiral(), do_kink_spiral_deform(), blender::ed::sculpt_paint::do_radial_symmetry(), do_twist(), do_version_constraints_radians_degrees_250(), blender::io::usd::USDLightWriter::do_write(), doEdgeSplit(), blender::eevee::Sampling::dof_disk_sample_get(), blender::io::usd::dome_light_to_world_material(), draw_circle_in_quad(), DRW_cache_bone_dof_lines_get(), DRW_cache_bone_envelope_outline_get(), DRW_cache_bone_envelope_solid_get(), DRW_cache_bone_point_get(), DRW_cache_bone_point_wire_outline_get(), DRW_cache_bone_stick_get(), DRW_cache_circle_get(), DRW_cache_cursor_get(), DRW_cache_empty_capsule_cap_get(), DRW_cache_empty_cone_get(), DRW_cache_empty_cylinder_get(), DRW_cache_field_cone_limit_get(), DRW_cache_field_tube_limit_get(), DRW_cache_field_vortex_get(), DRW_cache_light_icon_sun_rays_get(), DRW_cache_light_spot_lines_get(), DRW_cache_light_spot_volume_get(), DRW_cache_particles_get_prim(), DRW_cache_speaker_get(), DRW_cache_sphere_get(), dvar_eval_rotDiff(), ED_anim_calculate_butterworth_coefficients(), ED_view3d_smooth_view_ex(), edbm_beautify_fill_exec(), edbm_fill_grid_vert_tag_angle(), edbm_spin_exec(), edge_face_angle(), edge_wind_vertex(), blender::bke::mesh::edges_sharp_from_angle_set(), blender::draw::edituv_get_edituv_stretch_angle(), blender::io::usd::ensure_root_prim(), euler_filter_single_channel(), blender::geometry::extend_curves_curved(), fcm_fn_generator_evaluate(), blender::workbench::filter_blackman_harris(), filter_gauss(), libmv::Gaussian(), libmv::Gaussian2D(), libmv::GaussianInversePositive(), blender::ed::greasepencil::generate_arc_from_point_to_point(), blender::ed::sculpt_paint::boundary::get_mesh_strength(), blender::RandomNumberGenerator::get_unit_float2(), blender::RandomNumberGenerator::get_unit_float3(), blender::nodes::node_geo_input_mesh_edge_angle_cc::SignedAngleFieldInput::get_varray_for_context(), blender::ed::space_node::viewer_linking::get_viewer_node_position_candidates(), Freestyle::AppView::GetFovyDegrees(), GHOST_Wintab::getInput(), GIZMO_GT_dial_3d(), gizmo_mesh_spin_init_draw_prepare(), gizmo_mesh_spin_init_setup(), gizmo_mesh_spin_redo_setup(), glow_blur_bitmap(), gpu_batch_sphere(), GPU_matrix_perspective_set(), slim::grad(), Freestyle::gts_vertex_gaussian_curvature(), icu_to_fcurves(), imm_draw_circle(), imm_draw_circle_3D(), imm_draw_circle_partial_3d(), imm_draw_cylinder_fill_3d(), imm_draw_cylinder_fill_normal_3d(), imm_draw_cylinder_wire_3d(), blender::io::hydra::LightData::init(), insert_seam_vert_array(), Freestyle::LanczosWindowed(), large_rotation_limit(), blender::eevee::light_local_tilemap_count(), light_power_get(), lineart_create_render_buffer_v3(), lineart_geometry_object_load(), blender::workbench::SceneResources::load_jitter_tx(), make_unit_square_map(), map_to_sphere(), map_to_tube(), blender::bke::mesh_sharp_edges_set_from_angle(), mesh_uv_reset_array(), mix_normals(), MOD_lineart_chain_split_angle(), MOD_solidify_extrude_modifyMesh(), MOD_solidify_nonmanifold_modifyMesh(), modify_mesh(), modify_mesh(), nearly_parallel(), blender::nodes::node_geo_curve_primitive_arc_cc::node_declare(), blender::nodes::node_shader_bsdf_hair_principled_cc::node_declare(), blender::nodes::node_shader_tex_sky_cc::node_shader_gpu_tex_sky(), blender::ed::space_node::node_update_hidden(), normalEditModifier_do(), libmv::NRealisticCamerasFull(), libmv::NRealisticCamerasSparse(), object_preview_camera_create(), offset_meet(), offset_meet_edge(), op_degrees(), op_radians(), blender::bke::pbvh::uv_islands::UVBorder::outside_angle(), blender::geometry::p_abf_adjust_alpha(), blender::geometry::p_abf_compute_gradient(), blender::geometry::p_chart_abf_solve(), blender::geometry::p_chart_correct_degenerate_triangle_point(), blender::geometry::p_chart_correct_degenerate_triangles2(), blender::geometry::p_chart_minimum_area_angle(), blender::geometry::p_chart_stretch_minimize(), blender::geometry::p_edge_boundary_angle(), blender::ed::sculpt_paint::paint_brush_update(), paint_calculate_rake_rotation(), blender::ed::sculpt_paint::paint_stroke_curve_end(), blender::ed::sculpt_paint::paint_stroke_line_constrain(), point_between_edges(), precalc_wipe_zone(), blender::ed::curves::primitive_random_sphere(), psys_get_birth_coords(), psys_get_dupli_path_transform(), quad_calc_error(), radial_control_modal(), RE_filter_value(), blender::io::usd::USDLightReader::read_object_data(), blender::eevee::regular_polygon_side_length(), RNA_api_mesh(), rna_def_bone_curved_common(), rna_def_brush(), rna_def_brush_texture_slot(), RNA_def_camera(), rna_def_camera_dof_settings_data(), rna_def_constraint_kinematic(), rna_def_constraint_rotation_limit(), rna_def_curve_paint_settings(), rna_def_edit_bone(), rna_def_gpencil_guides(), rna_def_modifier_grease_pencil_simplify(), rna_def_modifier_screw(), rna_def_pose_channel(), rna_def_rigidbody_constraint(), rna_def_sculpt(), rna_def_space_view3d_shading(), rna_def_text(), Freestyle::NodeTransform::Rotate(), rotate(), rotation_between_vecs_to_quat(), RotationBetween(), sabin_gamma(), safe_acos(), blender::eevee::Sampling::sample_ball(), blender::eevee::Sampling::sample_disk(), blender::eevee::Sampling::sample_hemisphere(), blender::eevee::Sampling::sample_sphere(), blender::ed::sculpt_paint::DensityAddOperationExecutor::sample_spherical_with_symmetry(), blender::eevee::Sampling::sample_spiral(), blender::bke::mesh_surface_sample::sample_surface_points_projected(), blender::bke::mesh_surface_sample::sample_surface_points_spherical(), select_similar_direction(), set_boid_values(), blender::io::usd::USDTransformWriter::set_xform_ops(), Freestyle::FEdgeXDetector::setCreaseAngle(), IK_QElbowSegment::SetLimit(), IK_QRevoluteSegment::SetLimit(), IK_QSphericalSegment::SetLimit(), IK_QSwingSegment::SetLimit(), blender::draw::overlay::ShapeCache::ShapeCache(), similar_edge_select_exec(), similar_face_select_exec(), similar_vert_select_exec(), sin_cos_from_fraction(), sinc(), blender::nodes::node_shader_tex_sky_cc::sky_precompute_old(), libmv::SolveCubicPolynomial(), sphclassical_density_accum_cb(), sphclassical_force_cb(), sphere_wire_vbo(), blender::draw::statvis_calc_overhang(), blender::draw::statvis_calc_sharp(), Freestyle::SteerableViewMap::SteerableViewMap(), stencil_control_calculate(), stitch_calculate_island_snapping(), HdCyclesLight::Sync(), blender::math::tests::TEST(), blender::math::tests::TEST(), blender::math::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), TEST(), TEST(), test_sin_cos_from_fraction_accuracy(), tex_saw(), tex_tri(), TRANSFORM_OT_bend(), TRANSFORM_OT_rotate(), TRANSFORM_OT_rotate_normal(), TRANSFORM_OT_tilt(), tri_corner_test(), ui_draw_but_HSVCIRCLE(), ui_draw_pie_center(), ui_hsvcircle_pos_from_vals(), ui_hsvcircle_vals_from_pos(), ui_numedit_but_UNITVEC(), blender::compositor::KuwaharaAnisotropicOperation::update_memory_buffer_partial(), updateDuplicateKinematicConstraintSettings(), uv_image_outset(), uv_map_rotation_matrix_ex(), vectorscope_draw_target(), vfont_to_curve(), view_axis_exec(), vieworbit_exec(), viewrotate_apply(), vpaint_do_radial_symmetry(), WM_event_drag_direction(), wn_corner_angle(), wn_face_with_angle(), blender::io::usd::world_material_to_dome_light(), wpaint_do_radial_symmetry(), and wrap_rad_angle().

◆ M_PI_2

#define M_PI_2   1.57079632679489661923 /* pi/2 */

Definition at line 61 of file BLI_math_base.h.

Referenced by blender::geometry::angle_wrap(), axis_angle_to_gimbal_axis(), axisProjection(), Bend(), bevel_quarter_fill(), BKE_mask_spline_project_co(), BLI_dial_angle(), BLI_easing_sine_ease_in(), BLI_easing_sine_ease_out(), blo_do_versions_290(), bm_edge_is_delimit(), bmo_dissolve_limit_exec(), calc_bevel_sin_cos(), calc_solidify_normals(), blender::nodes::node_shader_tex_wave_cc::WaveFunction::call(), compatible_eul(), blender::realtime_compositor::compute_rotation(), computeAngularWeight(), computeBindWeights(), blender::io::usd::convert_to_z_up(), blender::nodes::node_geo_mesh_primitive_cube_cc::create_cube_mesh(), curve_nurb_select_similar_type(), curveprofile_build_supports(), damptrack_do_transform(), def_sh_tex_sky(), blender::deform_drawing(), dial_ghostarc_get_angles(), do_kink_spiral_deform(), do_vert_pair(), blender::io::alembic::ABCTransformWriter::do_write(), ED_armature_ebone_roll_to_vector(), fcm_fn_generator_evaluate(), find_even_superellipse_chords(), GHOST_Wintab::getInput(), gpencil_light_pool_populate(), imm_draw_circle_partial(), imm_draw_disk_partial(), imm_draw_disk_partial_3d(), blender::io::obj::OBJImportTest::import_and_check(), blender::io::stl::stl_importer_test::import_and_check(), init_data(), make_bevel_list_2D(), mball_select_similar_type(), blender::nodes::node_shader_bsdf_hair_cc::node_declare(), blender::nodes::node_shader_bsdf_hair_principled_cc::node_declare(), blender::nodes::node_shader_tex_sky_cc::node_shader_gpu_tex_sky(), blender::ed::sculpt_paint::greasepencil::RandomizeOperation::on_stroke_extended(), orthogonalize_stable(), OVERLAY_edit_metaball_cache_populate(), blender::geometry::p_chart_minimum_area_angle(), project_state_init(), quad_calc_error(), blender::io::alembic::AbcObjectReader::read_matrix(), rna_def_brush(), rna_def_camera_stereo_data(), rna_def_gpencil_options(), blender::ed::object::rotation_from_quat(), SCULPT_tilt_apply_to_normal(), blender::io::alembic::AbcObjectReader::setupObjectTransform(), Freestyle::WOEdge::setVecAndAngle(), blender::draw::overlay::ShapeCache::ShapeCache(), splineik_evaluate_bone(), stitch_calculate_island_snapping(), stretchto_evaluate(), surface_determineForceTargetPoints(), blender::eevee::Camera::sync(), blender::bke::tests::TEST(), blender::math::tests::TEST(), blender::math::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), tri_corner_test(), ui_draw_pie_center(), UI_fontstyle_draw_rotated(), ui_hsvcircle_pos_from_vals(), UI_panel_category_draw_all(), UnitConverter::UnitConverter(), update_wave_node_directions_and_offset(), uv_image_outset(), vectorscope_draw_target(), view3d_orbit_apply_dyn_ofs_ortho_correction(), blender::ed::sculpt_paint::vwpaint::view_angle_limits_init(), view_axis_exec(), view_roll_angle(), blender::ed::object::volume_import_exec(), VoronoiVertexWeight::VoronoiVertexWeight(), wm_xr_session_base_pose_calc(), and blender::write_weights_for_drawing().

◆ M_PI_4

◆ M_SQRT1_2

◆ M_SQRT1_3

#define M_SQRT1_3   0.57735026918962576450 /* 1/sqrt(3) */

◆ M_SQRT2

◆ M_SQRT3

#define M_SQRT3   1.73205080756887729352 /* sqrt(3) */

◆ NAN_FLT

Function Documentation

◆ ceil_power_of_10()

float ceil_power_of_10 ( float f)

Ceiling to the nearest power of 10, e.g.:

  • 15.0 -> 100.0
  • 0.015 -> 0.1
  • 1.0 -> 1.0
Parameters
fValue to ceiling, must be over 0.0.
Note
If we wanted to support signed values we could if this becomes necessary.

Definition at line 74 of file math_base.c.

References BLI_assert, floorf, and powf.

Referenced by blender::tests::TEST(), and v3d_cursor_plane_draw().

◆ ceil_to_multiple_u()

◆ ceil_to_multiple_ul()

◆ clamp_f()

MINLINE float clamp_f ( float value,
float min,
float max )

Definition at line 544 of file math_base_inline.c.

References max, and min.

Referenced by blender::apply_color_factor(), apply_sculpt_data_constraints(), BKE_curvemapping_integrate_clamped(), BKE_curveprofile_update(), BKE_where_on_path(), BM_mesh_intersect(), bpy_bm_utils_edge_split(), bpy_bm_utils_vert_collapse_faces(), bpy_bmdeformvert_ass_subscript(), bpy_bmvert_copy_from_vert_interp(), blender::nodes::node_shader_tex_brick_cc::BrickFunction::brick(), butterworth_calculate_blend_value(), blender::eevee::calc_level_of_detail(), blender::nodes::node_shader_mix_rgb_cc::MixRGBFunction::call(), blender::eevee::Sampling::cdf_invert(), blender::ed::sculpt_paint::expand::colors_update_task(), blender::nodes::node_composite_lensdist_cc::LensDistortionOperation::compute_chromatic_distortion(), blender::compositor::TimeNode::convert_to_operations(), blender::bke::pbvh::pixels::Rows::determine_mix_factor(), do_clump_level(), blender::bke::pbvh::pixels::do_encode_pixels(), do_rough_curve(), draw_main_line(), draw_seq_waveform_overlay(), drw_shgroup_bone_envelope(), blender::ed::sculpt_paint::dyntopo::dyntopo_detail_size_sample_from_surface(), blender::ed::sculpt_paint::dyntopo::dyntopo_detail_size_update_from_mouse_delta(), ED_slider_factor_set(), blender::nodes::node_composite_time_curves_cc::TimeCurveOperation::execute(), blender::workbench::filter_blackman_harris(), float_to_half_safe(), blender::nodes::node_composite_lensdist_cc::LensDistortionOperation::get_dispersion(), blender::nodes::node_composite_lensdist_cc::LensDistortionOperation::get_distortion(), get_seq_strip_thumbnails(), gizmo_spot_blend_prop_matrix_set(), gpencil_layer_final_tint_and_alpha_get(), GPENCIL_render_init(), grease_pencil_layer_final_tint_and_alpha_get(), IMB_gpu_clamp_half_float(), blender::eevee::Film::init(), blender::workbench::ShadowPass::init(), blender::ed::seq::init_wave_table(), blender::workbench::SceneResources::load_jitter_tx(), loopcut_modal(), MOD_solidify_extrude_modifyMesh(), MOD_solidify_nonmanifold_modifyMesh(), blender::geometry::p_abf_adjust_alpha(), blender::ed::sculpt_paint::paint_cursor_draw_main_inactive_cursor(), blender::ed::sculpt_paint::paint_draw_3D_view_inactive_brush_cursor(), radial_control_modal(), blender::ed::seq::rgb_to_uv_normalized(), rotlimit_evaluate(), scrollbar_keep_scrolling(), scrollbar_set_thumbpos(), scrollbar_start_scrolling(), SEQ_give_frame_index(), blender::nodes::node_shader_clamp_cc::sh_node_clamp_build_multi_function(), shader_node_disconnect_inactive_mix_branch(), blender::ed::object::shape_key_clear_exec(), slider_update_factor(), smootherstep(), blender::eevee::DepthOfField::sync(), blender::workbench::AntiAliasingPass::sync(), ui_colorpicker_wheel_cb(), ui_do_but_COLOR(), ui_do_but_HSVCIRCLE(), ui_hsvcircle_pos_from_vals(), UI_view2d_dot_grid_draw(), blender::ed::sculpt_paint::expand::update_mask_bmesh(), blender::ed::sculpt_paint::expand::update_mask_grids(), blender::geometry::uv_parametrizer_average(), vfont_to_curve(), view_zoom_to_window_xy_camera(), view_zoomdrag_invoke(), view_zoomdrag_modal(), blender::ed::object::voxel_size_edit_draw(), and blender::ed::object::voxel_size_edit_modal().

◆ clamp_i()

◆ clamp_z()

MINLINE size_t clamp_z ( size_t value,
size_t min,
size_t max )

Definition at line 555 of file math_base_inline.c.

References max_zz(), min, and min_zz().

◆ compare_ff()

◆ compare_ff_relative()

MINLINE int compare_ff_relative ( float a,
float b,
float max_diff,
int max_ulps )

Almost-equal for IEEE floats, using their integer representation (mixing ULP and absolute difference methods).

Parameters
max_diffis the maximum absolute difference (allows to take care of the near-zero area, where relative difference methods cannot really work).
max_ulpsis the 'maximum number of floats + 1' allowed between a and b to consider them equal.
See also
https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/

Definition at line 598 of file math_base_inline.c.

References b, BLI_assert, fabsf, and ulp_diff_ff().

Referenced by blender::ed::object::apply_objects_internal(), BKE_bezier_array_merge(), compare_v2_classify(), compare_v2v2_relative(), compare_v3v3_relative(), compare_v4v4_relative(), fcurve_is_changed(), blender::geometry::is_larger(), mesh_calc_eigen_matrix(), blender::animrig::new_key_needed(), blender::tests::TEST(), blender::tests::TEST(), and vfont_to_curve().

◆ compare_threshold_relative()

MINLINE bool compare_threshold_relative ( float value1,
float value2,
float thresh )

Definition at line 609 of file math_base_inline.c.

References fabsf.

Referenced by blender::bke::compare_meshes::values_different().

◆ cube_d()

MINLINE double cube_d ( double a)

Definition at line 397 of file math_base_inline.c.

◆ cube_f()

MINLINE float cube_f ( float a)

Definition at line 392 of file math_base_inline.c.

Referenced by ui_numedit_begin(), ui_numedit_but_SLI(), and widget_numslider().

◆ cube_i()

MINLINE int cube_i ( int a)

Definition at line 377 of file math_base_inline.c.

Referenced by BKE_lightprobe_grid_cache_frame_sample_count().

◆ cube_s()

MINLINE int cube_s ( short a)

Definition at line 372 of file math_base_inline.c.

◆ cube_uchar()

MINLINE int cube_uchar ( unsigned char a)

Definition at line 387 of file math_base_inline.c.

◆ cube_uint()

MINLINE unsigned int cube_uint ( unsigned int a)

Definition at line 382 of file math_base_inline.c.

◆ divide_ceil_u()

◆ divide_ceil_ul()

MINLINE uint64_t divide_ceil_ul ( uint64_t a,
uint64_t b )

Definition at line 293 of file math_base_inline.c.

References b.

Referenced by ceil_to_multiple_ul(), and blender::eevee::ShadowModule::init().

◆ divide_round_i()

MINLINE int divide_round_i ( int a,
int b )

Integer division that rounds 0.5 up, particularly useful for color blending with integers, to avoid gradual darkening when rounding down.

Definition at line 272 of file math_base_inline.c.

References b.

Referenced by blend_color_add_alpha_byte(), blend_color_add_byte(), blend_color_darken_byte(), blend_color_erase_alpha_byte(), blend_color_interpolate_byte(), blend_color_lighten_byte(), blend_color_mix_byte(), blend_color_mul_byte(), blend_color_sub_byte(), blender::color::ByteTraits::divide_round(), and IMB_rectblend().

◆ double_round()

double double_round ( double x,
int ndigits )
Parameters
ndigitsmust be between 0 and 21.

Definition at line 28 of file math_base.c.

References fabs(), pow(), x, y, and z().

Referenced by bc_sanitize_v3(), bc_sanitize_v3(), Color_to_tuple_ex(), Euler_to_tuple_ex(), Quaternion_to_tuple_ext(), BCMatrix::sanitize(), BCMatrix::sanitize(), and Vector_to_tuple_ex().

◆ floor_power_of_10()

float floor_power_of_10 ( float f)

Floor to the nearest power of 10, e.g.:

  • 15.0 -> 10.0
  • 0.015 -> 0.01
  • 1.0 -> 1.0
Parameters
fValue to floor, must be over 0.0.
Note
If we wanted to support signed values we could if this becomes necessary.

Definition at line 65 of file math_base.c.

References BLI_assert, ceilf, and powf.

Referenced by blender::tests::TEST().

◆ floored_fmod()

MINLINE float floored_fmod ( float f,
float n )

Floored modulo that is useful for wrapping numbers over n, including when f is negative.

This is the same as Python % or GLSL mod(): floored_fmod(-0.2, 1.0) = 0.8.

Returns
a float in the interval [0, n), same sign as n.

Definition at line 313 of file math_base_inline.c.

References floorf.

Referenced by blender::math::bilinear_fl_impl(), blender::math::interpolate_bilinear_wrap_byte(), blender::math::interpolate_nearest_wrap_byte(), blender::math::interpolate_nearest_wrap_fl(), blender::tests::TEST(), time_offset_fcurve_segment(), and blender::compositor::MemoryBuffer::wrap_pixel().

◆ integer_digits_d()

MINLINE int integer_digits_d ( double d)

Returns number of (base ten) significant digits of integer part of given double (negative in case of decimal-only floats, 0.01 returns -1 e.g.).

Definition at line 670 of file math_base_inline.c.

References fabs(), floor(), and int.

Referenced by unit_as_string(), and unit_as_string_split_pair().

◆ integer_digits_f()

MINLINE int integer_digits_f ( float f)

Returns number of (base ten) significant digits of integer part of given float (negative in case of decimal-only floats, 0.01 returns -1 e.g.).

Definition at line 665 of file math_base_inline.c.

References fabs(), floor(), and int.

Referenced by ui_but_string_get_ex().

◆ integer_digits_i()

◆ interpd()

◆ interpf()

MINLINE float interpf ( float target,
float origin,
float t )

Definition at line 82 of file math_base_inline.c.

Referenced by applyCurveShrinkFatten(), applyGPOpacity(), applyGPShrinkFatten(), applyMaskShrinkFatten(), BKE_curveprofile_evaluate_length_portion(), BKE_gpencil_stroke_close(), BKE_pchan_bbone_spline_compute(), blend_to_default_fcurve(), blend_to_neighbor_fcurve_segment(), bm_decim_edge_collapse(), breakdown_fcurve_segment(), butterworth_calculate_blend_value(), butterworth_smooth_fcurve_segment(), computeBindWeights(), create_samples_even_spacing(), data_transfer_interp_float_do(), blender::ed::greasepencil::dist_to_interpolated(), draw_start_vertex_circle(), ElementResize(), evaluate_time_fmodifiers(), evaluate_value_fmodifiers(), fcurve_eval_samples(), find_bbone_segment_index_curved(), gpencil_editcurve_subdivide_curve_segment(), imm_draw_circle_partial(), imm_draw_circle_partial_3d(), imm_draw_disk_partial(), imm_draw_disk_partial_3d(), blender::ed::seq::init_wave_table(), insert_bezt_to_nurb(), insert_bp_to_nurb(), interp_slerp_co_no_v3(), lineart_chain_create_crossing_point(), lineart_shadow_edge_cut(), MOD_lineart_chain_feature_lines(), blender::ed::sculpt_paint::paint_smooth_stroke(), pose_slide_apply_val(), scale_average_fcurve_segment(), scale_from_fcurve_segment_neighbor(), smooth_fcurve_segment(), splineik_evaluate_bone(), stretchto_evaluate(), blender::ed::curves::stroke_elem_interp(), stroke_elem_interp(), subdivide_base(), subdividenurb(), uiAlignPanelStep(), update_timestep(), view3d_smoothview_apply_with_interp(), and weight_set_exec().

◆ is_power_of_2_i()

◆ log2_ceil_u()

MINLINE unsigned int log2_ceil_u ( unsigned int x)

◆ log2_floor_u()

MINLINE unsigned int log2_floor_u ( unsigned int x)

Definition at line 169 of file math_base_inline.c.

References log2_floor_u().

Referenced by log2_ceil_u(), log2_floor_u(), and blender::tests::TEST().

◆ max_cc()

MINLINE char max_cc ( char a,
char b )

Definition at line 534 of file math_base_inline.c.

References b.

◆ max_dd()

MINLINE double max_dd ( double a,
double b )

Definition at line 444 of file math_base_inline.c.

References b.

Referenced by max_ddd(), and blender::geometry::p_triangle_angles().

◆ max_ddd()

MINLINE double max_ddd ( double a,
double b,
double c )

Definition at line 480 of file math_base_inline.c.

References b, and max_dd().

Referenced by blender::geometry::p_chart_lscm_solve().

◆ max_ff()

MINLINE float max_ff ( float a,
float b )

Definition at line 408 of file math_base_inline.c.

References b.

Referenced by alpha_circle_mask(), alpha_clip_aniso(), annotation_draw_stroke_2d(), annotation_draw_stroke_3d(), annotation_draw_stroke_buffer(), apply_heights_callback(), bake_ibuf_normalize_displacement(), barycentric_weights_v2_clamped(), blender::eevee::LightModule::begin_sync(), bezier_clamp(), bezier_handle_calc_smooth_fcurve(), BKE_bmbvh_overlap(), BKE_curvemapping_changed(), BKE_curvemapping_compute_range_dividers(), BKE_curvemapping_set_black_white_ex(), BKE_curvemapping_set_defaults(), BKE_curveprofile_move_point(), BKE_defvert_normalize_lock_map(), BKE_fcurves_calc_keyed_frames_ex(), BKE_gpencil_stroke_delete_tagged_points(), BKE_mask_spline_feather_resolution(), BKE_maskrasterize_handle_sample(), BKE_mesh_remap_calc_faces_from_mesh(), BKE_tracking_marker_clamp_search_size(), BKE_tracking_max_distortion_delta_across_bound(), blend_color_burn_float(), blend_color_erase_alpha_float(), blend_color_lighten_float(), blend_color_linearburn_float(), blend_color_linearlight_float(), blend_color_pinlight_float(), blend_color_screen_float(), blend_color_sub_float(), blend_color_vividlight_float(), blf_glyph_to_curves(), BLI_bvhtree_new(), blinn_specular(), blo_do_versions_300(), blo_do_versions_400(), block_align_proximity_compute(), BM_face_splits_check_legal(), brightcontrast_apply_threaded(), blender::ed::sculpt_paint::brush_dynamic_size_get(), brush_edit_apply(), button2d_geom_draw_backdrop(), calc_bbox(), calc_bevfac_mapping(), blender::ed::sculpt_paint::expand::calc_new_mask_mesh(), calc_tw_center(), calculate_autoscale_factor(), calculate_bezt_bounds_y(), calculate_collision_balls(), calculate_fpt_bounds(), ccd_mesh_make(), ccd_mesh_update(), clamp_nonzero(), clipUVData(), cloth_collision_response_static(), cloth_record_result(), cloth_selfcollision_response_static(), blender::nodes::node_composite_color_ramp_cc::ColorRampShaderNode::compile(), compute_bbone_segment_boundaries(), computeBindWeights(), blender::gpu::convert(), create_display_buffer_processor(), ArmatureBoneDrawStrategyEnvelope::culling_test(), curvemap_make_table(), cylinder_project_exec(), damptrack_do_transform(), dist_signed_squared_to_corner_v3v3v3(), do_multires_bake(), do_sub_effect_float(), do_versions_sequencer_speed_effect_recursive(), do_vert_pair(), draw_fcurve_curve(), draw_horizontal_scale_indicators(), draw_seq_fcurve_overlay(), draw_seq_text_overlay(), draw_seq_waveform_overlay(), draw_strip_icons(), drawLine(), drawmeta_contents(), DRW_globals_update(), drw_shgroup_bone_envelope(), DRW_view_create_with_zoffset(), dynamic_paint_effect_shrink_cb(), dynamic_paint_paint_particle_cell_point_cb_ex(), dynamic_paint_paint_single_point_cb_ex(), dynamicPaint_mixPaintColors(), ED_mask_draw_region(), ED_view3d_polygon_offset(), edbm_bevel_init(), edbm_bevel_modal(), edbm_inset_init(), edbm_inset_modal(), EDBM_preselect_edgering_draw(), ElementResize(), expand_key_bounds(), fcurve_scene_coord_range_get(), find_last_key(), blender::animrig::get_frame_range_of_fcurves(), get_keyframe_extents(), gizmo2d_xform_draw_prepare(), gizmo_bbone_offset_set(), gpencil_vfx_shadow(), gpencil_vfx_wave(), GPU_line_width(), blender::nodes::node_shader_color_ramp_cc::gpu_shader_valtorgb(), gpu_texture_create_tile_array(), heat_set_H(), IDP_EqualsProperties_ex(), image_camera_background_matrix_get(), imagewraposa(), imagewraposa_aniso(), IMB_colormanagement_setup_glsl_draw_from_space(), blender::eevee::AmbientOcclusion::init(), blender::workbench::CavityEffect::init(), blender::compositor::GaussianAlphaBlurBaseOperation::init_data(), blender::compositor::GaussianBlurBaseOperation::init_data(), blender::compositor::ProjectorLensDistortionOperation::init_data(), interp_weights_poly_v2(), interp_weights_poly_v3(), isect_seg_seg_v2_point_ex(), label_rect_get(), label_rect_init(), layer_bucket_init(), blender::bke::greasepencil::convert::legacy_gpencil_frame_to_grease_pencil_drawing(), blender::bke::pbvh::long_edge_queue_edge_add_recursive(), loopcut_modal(), make_box_union(), blender::color::FloatTraits::max(), max_fff(), max_ffff(), max_v3_v3v3(), meshdeform_ray_tree_intersect(), MOD_solidify_extrude_modifyMesh(), MOD_solidify_nonmanifold_modifyMesh(), modify_mesh(), move_segment(), nearest_world_tree(), blender::ed::space_node::node_update_hidden(), blender::ed::space_node::nodelink_get_draw_config(), blender::ed::object::object_rand_transverts(), blender::draw::overlay::Lights::object_sync(), blender::ed::object::object_warp_transverts_minmax_x(), offset_meet(), OVERLAY_bounds(), OVERLAY_gpencil_legacy_cache_init(), OVERLAY_grid_init(), OVERLAY_light_cache_populate(), blender::eevee::Film::overscan_pixels_get(), blender::geometry::pack_islands_alpaca_rotate(), blender::geometry::pack_islands_alpaca_turbo(), blender::geometry::pack_islands_optimal_pack(), blender::ed::sculpt_paint::paint_cursor_context_init(), blender::ed::sculpt_paint::paint_space_stroke_spacing(), blender::ed::sculpt_paint::paint_stroke_new(), blender::ed::sculpt_paint::paint_stroke_overlapped_curve(), blender::ed::sculpt_paint::image::ops::paint::paint_stroke_update_step(), polyedge_beauty_cost_update_single(), py_bvhtree_overlap(), quad_calc_error(), radial_control_invoke(), ramp_blend(), RE_GetWindowMatrixWithOverscan(), blender::io::usd::USDCameraReader::read_object_data(), blender::io::alembic::AbcCameraReader::readObjectData(), recalc_face_normals_find_index(), blender::eevee::DepthOfField::render(), rgb_to_cpack(), RNA_property_float_ui_range(), safe_sqrtf(), blender::gpu::MTLContext::sampler_state_cache_init(), scan_for_ext_face_forces(), blender::ed::sculpt_paint::expand::sculpt_expand_modal(), blender::ed::sculpt_paint::sculpt_update_cache_invariants(), SEQ_give_frame_index(), sequencer_main_clamp_view(), sequencer_retiming_draw_continuity(), SimpleDeformModifier_do(), slider_update_factor(), smart_uv_project_calculate_project_normals(), smooth_view_rect_to_fac(), smoothminf(), snap_to_superellipsoid(), softbody_apply_forces(), softbody_step(), sphclassical_calc_dens(), sphere_project_exec(), splineik_evaluate_bone(), square_roughness_node_insert(), blender::draw::statvis_calc_distort(), blender::draw::statvis_calc_sharp(), stitch_island_calculate_edge_rotation(), stitch_island_calculate_vert_rotation(), stretchto_evaluate(), strip_draw_context_get(), svd_m4(), blender::eevee::DepthOfField::sync(), blender::gpu::tests::texture_create_upload_read_with_bias(), tracking_check_marker_margin(), transformEvent(), ui_block_bounds_calc(), ui_block_bounds_calc_text(), ui_but_range_set_soft(), ui_do_but_NUM(), ui_draw_but_CURVE(), ui_draw_but_CURVEPROFILE(), ui_draw_dropshadow(), ui_menu_scroll_apply_offset_y(), ui_numedit_begin(), ui_numedit_but_NUM(), ui_popup_block_position(), ui_popup_block_refresh(), ui_tooltip_create_with_data(), blender::ed::sculpt_paint::update_curve_mask(), blender::ed::sculpt_paint::expand::update_mask_bmesh(), blender::ed::sculpt_paint::expand::update_mask_grids(), blender::compositor::BrightnessOperation::update_memory_buffer_partial(), blender::compositor::ConvertHSLToRGBOperation::update_memory_buffer_partial(), blender::compositor::ConvertHSVToRGBOperation::update_memory_buffer_partial(), blender::compositor::MixExclusionOperation::update_memory_buffer_row(), blender::compositor::MixLightenOperation::update_memory_buffer_row(), blender::bke::pbvh::uv_islands::UVBorderCorner::uv(), uv_cylinder_project(), uv_map_mirror(), uv_sphere_project(), v3d_cursor_plane_draw(), vertex_color_brightness_contrast_exec(), vfont_to_curve(), blender::ed::object::vgroup_normalize(), view3d_from_minmax(), view3d_localview_init(), view3d_orbit_apply_dyn_ofs_ortho_correction(), view3d_zoom_border_exec(), blender::draw::overlay::State::view_dist_get(), blender::ed::space_node::viewer_border_exec(), viewzoom_scale_value(), blender::ed::object::voxel_size_edit_invoke(), blender::ed::object::voxel_size_edit_modal(), walkEvent(), widget_scroll(), WIDGETGROUP_empty_image_refresh(), wm_software_cursor_draw_crosshair(), WM_window_set_dpi(), wrapped_lighting(), and zspan_scanconvert().

◆ max_fff()

◆ max_ffff()

◆ max_ii()

MINLINE int max_ii ( int a,
int b )

Definition at line 453 of file math_base_inline.c.

References b.

Referenced by accessor_get_ibuf(), blender::eevee::GBuffer::acquire(), action_space_icon_get(), action_space_name_get(), actionzone_modal(), blender::gpu::MTLFrameBuffer::add_color_attachment(), blender::gpu::MTLFrameBuffer::add_depth_attachment(), blender::gpu::MTLShaderInterface::add_input_attribute(), blender::gpu::MTLFrameBuffer::add_stencil_attachment(), blender::gpu::MTLShaderInterface::add_storage_block(), blender::gpu::MTLShaderInterface::add_texture(), blender::gpu::MTLShaderInterface::add_uniform_block(), blender::bke::pbvh::uv_islands::add_uv_island(), blender::draw::alloc_final_points_vbo(), animviz_calc_motionpaths(), annotation_draw_eraser(), area_move_set_limits(), attr_align(), azone_clipped_rect_calc(), blender::gpu::MTLShader::bake_pipeline_state(), blender::ed::space_node::best_socket_input(), bevel_build_cutoff(), blender::gpu::VKVertexAttributeObject::bind(), BKE_autotrack_context_sync(), BKE_curve_material_index_validate(), BKE_icon_geom_rasterize(), BKE_image_get_tile_info(), BKE_mask_get_duration(), BKE_mask_spline_resolution(), BKE_mesh_remap_calc_faces_from_mesh(), BKE_mesh_remap_calc_loops_from_mesh(), BKE_mesh_validate_material_indices(), BKE_nurb_order_clamp_u(), BKE_nurb_order_clamp_v(), BKE_render_num_threads(), BKE_sculpt_mask_layers_ensure(), BKE_tracking_get_plane_imbuf(), BKE_tracking_reconstruction_context_new(), BKE_tracking_tracks_first_last_frame_minmax(), blend_color_burn_byte(), blend_color_erase_alpha_byte(), blend_color_lighten_byte(), blend_color_linearburn_byte(), blend_color_linearlight_byte(), blend_color_pinlight_byte(), blend_color_screen_byte(), blend_color_sub_byte(), blend_color_vividlight_byte(), blend_file_thumb_clamp_size(), BLI_bitmap_draw_2d_poly_v2i_n(), BLI_bvhtree_find_nearest_projected(), BLI_ghash_calc_quality_ex(), BLI_rcti_do_minmax_rcti(), bm_edgering_pair_subdiv(), BM_mesh_bevel(), BM_mesh_decimate_dissolve_ex(), BM_mesh_partial_create_from_verts_group_multi(), BM_mesh_partial_create_from_verts_group_single(), bmo_create_grid_exec(), bmo_unsubdivide_exec(), brush_scale_size_exec(), calculate_autoscale_factor(), blender::bke::pbvh::pixels::CopyPixelCommand::can_be_extended(), blender::gpu::VKBackend::capabilities_init(), change_spacing_exec(), channels_bake_exec(), circle_select_exec(), clamp_i(), clip_set_scene_frames_exec(), blender::eevee::DeferredPipeline::closure_layer_count(), cloth_record_result(), blender::gpu::VKFrameBuffer::color_attachments_resource_size(), colorband_init_from_table_rgba_simple(), blender::nodes::node_composite_crop_cc::CropOperation::compute_cropping_bounds(), blender::gpu::MTLContext::compute_dispatch(), blender::draw::View::compute_visibility(), console_select_to_buffer(), cp_cu_key(), create_missing_media_image(), create_primitive_from_points(), createTransSeqData(), curve_decimate_exec(), curvemap_buttons_layout(), curvemap_make_table(), CurveProfile_buttons_layout(), displayed_channel_range_get(), do_sub_effect_byte(), dopesheet_view_all_exec(), blender::workbench::DofPass::draw(), blender::ed::space_node::draw_background_color(), draw_current_frame(), draw_geometry_execute(), draw_seq_fcurve_overlay(), draw_seq_timeline_channels(), draw_spline_curve(), drawmeta_contents(), blender::ed::object::drop_named_material_invoke(), blender::ed::object::drop_named_material_tooltip(), blender::draw::DRW_curve_material_count_get(), blender::draw::DRW_curves_material_count_get(), blender::draw::DRW_pointcloud_material_count_get(), blender::draw::DRW_volume_material_count_get(), ED_curve_editfont_select_pick(), ED_info_draw_stats(), ed_preview_draw_rect(), ED_scene_fps_average_accumulate(), ED_view3d_backbuf_sample_size_clamp(), ED_view3d_depth_read_cached(), ED_view3d_update_viewmat(), blender::gpu::MTLImmediate::end(), blender::eevee::LightModule::end_sync(), blender::gpu::MTLContext::ensure_render_pipeline_state(), fcurve_scene_coord_range_get(), file_smoothscroll_invoke(), filelist_file_cache_block(), blender::bke::pbvh::pixels::Rows::find_second_source(), blender::eevee::VelocityModule::geometry_steps_fill(), gesture_box_apply_rect(), get_active_fcurve_keyframe_edit(), blender::get_factor_from_index(), blender::ed::space_node::get_main_socket(), blender::gpu::VKQueryPool::get_occlusion_result(), blender::gpu::GLPixelBuffer::GLPixelBuffer(), blender::gpu::GLShaderInterface::GLShaderInterface(), gpencil_material_pool_create(), gpencil_vfx_blur(), gpencil_vfx_glow(), gpencil_vfx_rim(), gpencil_vfx_shadow(), gpu_batch_preset_panel_drag_widget(), GPU_offscreen_create(), gpu_texture_create_tile_array(), gpu_texture_update_from_ibuf(), blender::ed::sculpt_paint::grease_pencil_eraser_draw(), image_sample_apply(), image_view_all(), IMB_create_gpu_texture(), implicit_needed_branches(), blender::eevee::MotionBlurModule::init(), blender::eevee::Sampling::init(), blender::eevee::Sampling::init(), blender::workbench::DofPass::init(), blender::workbench::SceneState::init(), blender::gpu::Texture::init_2D(), blender::gpu::Texture::init_cubemap(), initSnapping(), left_fake_key_frame_get(), blender::bke::image::partial_update::PartialUpdateRegisterImpl::limit_history(), M_Geometry_interpolate_bezier(), blender::bke::image::partial_update::TileChangeset::mark_region(), blender::eevee::SphereProbeAtlasCoord::LocationFinder::mark_space_used(), blender::bke::pbvh::uv_islands::mask_resolution_from_tile_resolution(), blender::eevee::DeferredLayer::material_add(), blender::eevee::DeferredProbePipeline::material_add(), blender::eevee::PlanarProbePipeline::material_add(), Matrix_str(), blender::color::ByteTraits::max(), max_iii(), max_iiii(), mesh_join_offset_face_sets_ID(), blender::gpu::Texture::mip_depth_get(), blender::gpu::Texture::mip_height_get(), blender::gpu::Texture::mip_size_get(), blender::gpu::Texture::mip_width_get(), MOD_lineart_gpencil_generate_v3(), MOD_meshcache_calc_range(), motion_path_cache(), motion_path_get_frame_range_to_draw(), motionpath_calculate_update_range(), motionpath_get_global_framerange(), blender::gpu::name_buffer_copystr(), blender::ed::space_node::node_socket_calculate_height(), blender::eevee::DeferredPipeline::normal_layer_count(), ZstdWriteWrap::open(), blender::ed::outliner::outliner_data_api_buttons_start_x(), panel_calculate_size_recursive(), blender::draw::particle_batch_cache_ensure_procedural_final_points(), paste_get_y_offset(), pipe_adj_vmesh(), prefetch_data_fn(), blender::gpu::MSLGeneratorInterface::prepare_from_createinfo(), blender::ed::space_node::preview_prepare_scene(), preview_prepare_scene(), psys_get_pointcache_start_end(), psys_thread_context_init_path(), blender::gpu::VKPushConstants::push_constant_set(), pygpu_texture__tp_new(), radial_control_invoke(), blender::ed::sculpt_paint::face_set::randomize_colors_exec(), blender::gpu::MTLTexture::read(), blender::gpu::VKFrameBuffer::read(), realize_fake_keys_in_rect(), blender::gpu::FrameBuffer::recursive_downsample(), region_rect_recursive(), blender::eevee::RayTraceModule::render(), blender::gpu::VKFrameBuffer::rendering_ensure(), RNA_property_int_ui_range(), screen_animation_step_invoke(), blender::ed::sculpt_paint::expand::sculpt_expand_modal(), seq_cache_cleanup_sequence(), SEQ_render_give_ibuf(), seq_retiming_clamp_timeline_frame(), seq_retiming_clamp_transition_offset(), SEQ_retiming_transition_key_frame_set(), seq_time_effect_range_set(), SEQ_time_update_meta_strip_range(), SEQ_transform_seqbase_shuffle_ex(), seq_update_meta_disp_range(), seq_update_sound_bounds_recursive_impl(), seq_view_collection_rect_timeline(), sequencer_add_effect_strip_exec(), sequencer_all_free_anim_ibufs(), sequencer_drop_copy(), sequencer_export_subtitles_exec(), sequencer_image_seq_get_minmax_frame(), sequencer_meta_make_exec(), sequencer_select_side_exec(), sequencer_set_range_to_strips_exec(), sequencer_visible_strips_get(), set_profile_spacing(), shuffle_seq_time_offset_get(), SIM_hair_volume_add_segment(), svd_m4(), blender::draw::TestDefrag::TestDefrag(), text_scroll_state_init(), textview_draw_sel(), tracking_dopesheet_calc_coverage(), tracking_dopesheet_channels_segments_calc(), ui_do_but_NUM(), ui_item_rna_size(), ui_litem_estimate_column_flow(), ui_litem_estimate_grid_flow(), ui_litem_grid_flow_compute(), ui_litem_layout_absolute(), ui_litem_layout_radial(), UI_panel_category_draw_all(), ui_panels_size(), ui_text_clip_cursor(), ui_text_clip_middle(), ui_text_clip_middle_protect_right(), ui_text_clip_right_label(), ui_tooltip_create_with_data(), uiItemFullR(), uilist_prepare(), uiTemplateReportsBanner(), uiTemplateStatusInfo(), unit_as_string_split_pair(), blender::compositor::CropBaseOperation::update_area(), blender::compositor::GaussianAlphaBlurBaseOperation::update_memory_buffer_partial(), blender::compositor::GaussianBokehBlurOperation::update_memory_buffer_partial(), blender::gpu::VKTexture::update_sub(), vfont_to_curve(), widget_draw_text(), widget_scroll(), wm_main_playanim_intern(), WM_window_set_dpi(), and zspan_scanconvert().

◆ max_iii()

MINLINE int max_iii ( int a,
int b,
int c )

◆ max_iiii()

MINLINE int max_iiii ( int a,
int b,
int c,
int d )

Definition at line 516 of file math_base_inline.c.

References b, max_ii(), and max_iii().

Referenced by _bli_array_iter_spiral_square().

◆ max_uu()

◆ max_zz()

MINLINE size_t max_zz ( size_t a,
size_t b )

Definition at line 525 of file math_base_inline.c.

References b.

Referenced by clamp_z().

◆ min_cc()

MINLINE char min_cc ( char a,
char b )

Definition at line 530 of file math_base_inline.c.

References b.

◆ min_dd()

MINLINE double min_dd ( double a,
double b )

Definition at line 440 of file math_base_inline.c.

References b.

Referenced by min_ddd().

◆ min_ddd()

MINLINE double min_ddd ( double a,
double b,
double c )

Definition at line 476 of file math_base_inline.c.

References b, and min_dd().

◆ min_ff()

MINLINE float min_ff ( float a,
float b )

Definition at line 404 of file math_base_inline.c.

References b.

Referenced by alpha_circle_mask(), annotation_draw_apply(), apply_heights_callback(), area_draw_azone_fullscreen(), blender::ed::space_node::backimage_fit_exec(), bezier_clamp(), bezier_handle_calc_smooth_fcurve(), BKE_curvemapping_changed(), BKE_curvemapping_set_defaults(), BKE_curveprofile_move_point(), BKE_maskrasterize_handle_sample(), BKE_tracking_marker_clamp_search_size(), blend_color_add_alpha_float(), blend_color_darken_float(), blend_color_dodge_float(), blend_color_hardlight_float(), blend_color_linearlight_float(), blend_color_overlay_float(), blend_color_pinlight_float(), blend_color_vividlight_float(), blo_do_versions_270(), blo_do_versions_300(), blo_do_versions_400(), bm_decim_build_edge_cost_single__topology(), bm_decim_build_edge_cost_single_squared__topology(), bmo_create_uvsphere_exec(), bmo_dissolve_degenerate_exec(), bmo_dissolve_limit_exec(), boid_body(), btw_smooth_graph_keys(), butterworth_smooth_fcurve_segment(), button2d_geom_draw_backdrop(), calc_bevfac_mapping(), blender::ed::sculpt_paint::expand::calc_new_mask_mesh(), calc_tw_center(), calctrackballvec(), calculate_autoscale_factor(), calculate_bezt_bounds_y(), calculate_collision_balls(), calculate_fpt_bounds(), ccd_mesh_make(), ccd_mesh_update(), channel_draw_context_init(), check_zone(), clamp_nonzero(), clickable_handle_size_get(), clip_view_calculate_view_selection(), clipUVData(), cloth_collision_response_static(), cloth_record_result(), cloth_selfcollision_response_static(), computeAngularWeight(), computeBindWeights(), convert_tree(), curvemap_make_table(), damptrack_do_transform(), dist_signed_squared_to_corner_v3v3v3(), do_multires_bake(), do_projectpaint_thread(), draw_fcurve_curve(), draw_keylist_block_gpencil(), draw_marker_slide_zones(), draw_seq_fcurve_overlay(), draw_seq_in_view(), draw_seq_text_overlay(), draw_seq_waveform_overlay(), draw_strip_icons(), drawmeta_contents(), dynamic_paint_effect_drip_cb(), dynamic_paint_effect_spread_cb(), ED_view3d_backbuf_sample_size_clamp(), ED_view3d_update_viewmat(), edge_slide_apply_elem(), expand_key_bounds(), fcurve_scene_coord_range_get(), find_next_key(), flyApply(), flyEvent(), geodesic_distance_propagate_across_triangle(), blender::animrig::get_frame_range_of_fcurves(), get_keyframe_extents(), blender::bke::pbvh::uv_islands::UVIslandsMask::Tile::get_pixel_size_in_uv_space(), get_seq_strip_thumbnails(), get_shortest_pattern_side(), getArrowEndPoint(), gpu_texture_create_tile_array(), graph_key_shortest_dist(), image_camera_background_matrix_get(), image_view_all(), IMB_rectblend(), immDrawBorderCorners(), blender::compositor::GaussianAlphaBlurBaseOperation::init_data(), blender::compositor::GaussianBlurBaseOperation::init_data(), blender::compositor::ProjectorLensDistortionOperation::init_data(), blender::ed::sculpt_paint::expand::init_from_face_set_boundary(), isect_seg_seg_v2_point_ex(), knife_snap_size(), label_rect_get(), layer_bucket_init(), line_rect_clip(), make_box_union(), merge_frame_corners(), blender::color::FloatTraits::min(), min_fff(), min_ffff(), mix_normals(), MOD_solidify_extrude_modifyMesh(), MOD_solidify_nonmanifold_modifyMesh(), modify_mesh(), modify_mesh(), move_segment(), nla_action_draw_keyframes(), blender::ed::space_node::node_insert_on_link_flags_set(), blender::ed::space_node::node_update_basis(), blender::ed::object::object_warp_transverts_minmax_x(), OVERLAY_grid_init(), paint_calculate_rake_rotation(), pipe_adj_vmesh(), quad_calc_error(), radial_control_invoke(), ramp_blend(), blender::eevee::DepthOfField::render(), retiming_fake_key_frame_clicked(), rgb_to_hsl(), rgb_to_hsv(), RNA_property_float_ui_range(), blender::gpu::GLTexture::samplers_update(), sb_detect_edge_collisionCached(), scan_for_ext_face_forces(), scanfill(), seq_view_collection_rect_preview(), sequence_handle_size_get_clamped(), sequencer_main_clamp_view(), sequencer_retiming_draw_continuity(), sequencer_view_all_preview_exec(), sima_zoom_set_from_bounds(), SimpleDeformModifier_do(), slider_update_factor(), smooth_view_rect_to_fac(), smoothminf(), snap_to_superellipsoid(), softbody_apply_forces(), softbody_step(), sphclassical_calc_dens(), spline_under_mouse_get(), splineik_evaluate_bone(), stitch_island_calculate_edge_rotation(), stitch_island_calculate_vert_rotation(), stretchto_evaluate(), strip_draw_context_get(), texture_value_blend(), blender::geometry::Occupancy::trace_triangle(), transformEvent(), ui_but_range_set_soft(), ui_do_animate(), ui_do_but_NUM(), ui_draw_but_CURVE(), ui_draw_but_CURVEPROFILE(), ui_draw_but_UNITVEC(), ui_draw_dropshadow(), ui_menu_scroll_apply_offset_y(), ui_numedit_begin(), ui_numedit_but_HISTOGRAM(), ui_numedit_but_HSVCIRCLE(), ui_numedit_set_active(), ui_popup_block_refresh(), UI_text_clip_middle_ex(), ui_update_flexible_spacing(), unified_findnearest(), blender::ed::sculpt_paint::expand::update_mask_bmesh(), blender::ed::sculpt_paint::expand::update_mask_grids(), blender::compositor::MixDarkenOperation::update_memory_buffer_row(), uv_map_mirror(), uv_rip_single_from_loop(), versioning_eevee_material_blend_mode_settings(), vfont_to_curve(), view3d_center_camera_exec(), view3d_ruler_pick(), view_all_exec(), blender::ed::space_node::viewer_border_exec(), walkApply(), walkEvent(), zbuf_add_to_span(), and zspan_scanconvert().

◆ min_fff()

◆ min_ffff()

◆ min_ii()

MINLINE int min_ii ( int a,
int b )

Definition at line 449 of file math_base_inline.c.

References b.

Referenced by accessor_get_ibuf(), add_bezt_vertices(), blender::bke::pbvh::uv_islands::add_uv_island(), animviz_calc_motionpaths(), area_move_set_limits(), azone_clipped_rect_calc(), BKE_autotrack_context_sync(), BKE_blendfile_userdef_from_defaults(), BKE_image_get_tile_info(), BKE_key_evaluate_object_ex(), BKE_keyblock_convert_to_curve(), BKE_keyblock_convert_to_lattice(), BKE_keyblock_convert_to_mesh(), BKE_mask_spline_feather_collapse_inner_loops(), BKE_maskrasterize_handle_init(), BKE_mesh_remap_calc_edges_from_mesh(), BKE_tracking_get_projection_matrix(), BKE_tracking_reconstruction_context_new(), BKE_tracking_tracks_first_last_frame_minmax(), blend_color_add_alpha_byte(), blend_color_add_byte(), blend_color_darken_byte(), blend_color_dodge_byte(), blend_color_exclusion_byte(), blend_color_hardlight_byte(), blend_color_linearlight_byte(), blend_color_overlay_byte(), blend_color_pinlight_byte(), blend_color_vividlight_byte(), BLI_bitmap_draw_2d_poly_v2i_n(), BLI_rcti_do_minmax_rcti(), blender::gpu::blit_aspect(), blo_do_versions_280(), BM_mesh_bm_from_me(), bm_mesh_edges_select_get_n(), BM_mesh_partial_create_from_verts(), BM_mesh_partial_create_from_verts_group_multi(), BM_mesh_partial_create_from_verts_group_single(), bm_mesh_verts_select_get_n(), bmo_bisect_plane_exec(), brush_painter_imbuf_partial_update(), brush_painter_mask_imbuf_partial_update(), butterworth_smooth_fcurve_segment(), calcknots(), calculate_autoscale_factor(), blender::bke::curves::nurbs::calculate_knots(), channels_bake_exec(), check_zone(), clamp_i(), cloth_record_result(), color_clamp_index(), colorband_init_from_table_rgba_simple(), blender::nodes::node_composite_crop_cc::CropOperation::compute_cropping_bounds(), console_select_to_buffer(), cp_cu_key(), createTransSeqData(), CurveProfile_buttons_layout(), do_add_effect_byte(), do_drop_effect_byte(), do_drop_effect_float(), blender::bke::pbvh::pixels::do_encode_pixels(), do_history(), dopesheet_view_all_exec(), draw_movieclip_cache(), drawmeta_contents(), ED_region_header_layout(), ED_region_info_draw_multiline(), ED_region_panels_layout_ex(), ED_view3d_depth_read_cached(), edbm_fill_grid_prepare(), blender::eevee::DeferredLayer::end_sync(), blender::eevee::LightModule::end_sync(), blender::gpu::MTLContext::ensure_render_pipeline_state(), euler_filter_perform_filter(), fcurve_scene_coord_range_get(), file_draw_list(), filelist_file_cache_block(), find_next_key(), blender::bke::pbvh::pixels::Rows::find_second_source(), gesture_box_apply_rect(), blender::gpu::VKQueryPool::get_occlusion_result(), get_render_subsurf_level(), gpencil_vfx_blur(), gpencil_vfx_glow(), gpencil_vfx_rim(), gpencil_vfx_shadow(), GPU_batch_draw_advanced(), GPU_batch_draw_parameter_get(), GPU_texture_size_with_limit(), gpu_texture_update_from_ibuf(), imb_loadiris(), blender::eevee::ShadowModule::init(), blender::workbench::CavityEffect::init(), blender::workbench::SceneState::init(), ViewportColorSampleSession::init(), blender::gpu::Texture::init_1D(), blender::gpu::Texture::init_2D(), blender::gpu::Texture::init_3D(), blender::bke::image::partial_update::TileChangeset::init_chunks(), blender::gpu::Texture::init_cubemap(), blender::compositor::GaussianAlphaBlurBaseOperation::init_data(), blender::compositor::GaussianBlurBaseOperation::init_data(), blender::gpu::Texture::init_view(), blender::bke::image::partial_update::TileChangeset::mark_region(), mathutils_matrix_col_get(), mathutils_matrix_col_set(), Matrix_to_NxN(), matrix_unit_internal(), blender::color::ByteTraits::min(), min_iii(), min_iiii(), MOD_meshcache_calc_range(), motionpath_calculate_update_range(), motionpath_get_global_framerange(), multiply_ibuf(), blender::ed::space_node::node_update_basis_socket(), non_recursive_bvh_div_nodes(), paste_get_y_offset(), prefetch_get_final_frame(), blender::gpu::present(), psys_get_pointcache_start_end(), psys_tasks_create(), query_right_side_strips(), radial_control_invoke(), read_bone_collections(), realize_fake_keys_in_rect(), blender::gpu::FrameBuffer::recursive_downsample(), blender::eevee::DepthOfField::render(), right_fake_key_frame_get(), RNA_property_int_ui_range(), round_box__edges(), blender::eevee::ShadowModule::screen_pixel_radius(), seq_cache_cleanup_sequence(), seq_retiming_clamp_timeline_frame(), seq_retiming_clamp_transition_offset(), seq_time_effect_range_set(), SEQ_time_update_meta_strip_range(), seq_update_meta_disp_range(), seq_update_sound_bounds_recursive_impl(), seq_view_collection_rect_timeline(), sequencer_all_free_anim_ibufs(), sequencer_image_seq_get_minmax_frame(), sequencer_meta_make_exec(), sequencer_select_side_exec(), sequencer_set_range_to_strips_exec(), sequencer_visible_strips_get(), blender::eevee::ShadowTileMapPool::ShadowTileMapPool(), shuffle_seq_time_offset_get(), SIM_hair_volume_add_segment(), startConstraint(), svd_m4(), blender::draw::TestDefrag::TestDefrag(), textview_draw_sel(), tile_remove_exec(), track_init_markers(), tracking_dopesheet_calc_coverage(), ui_block_func_POPUP(), ui_but_drag_init(), ui_but_v3_get(), ui_but_v3_set(), ui_but_v4_get(), ui_but_v4_set(), ui_do_but_NUM(), ui_draw_but_HSVCIRCLE(), ui_hsvcircle_pos_from_vals(), ui_hsvcircle_vals_from_pos(), ui_item_array(), ui_litem_estimate_absolute(), ui_litem_estimate_column_flow(), ui_litem_estimate_grid_flow(), ui_litem_layout_absolute(), ui_litem_layout_column_flow(), ui_litem_layout_grid_flow(), ui_litem_layout_radial(), ui_litem_layout_row(), ui_panels_size(), ui_searchbox_region_draw_cb__operator(), ui_tooltip_create_with_data(), uilist_prepare(), uiTemplateReportsBanner(), blender::compositor::CropBaseOperation::update_area(), blender::ed::sculpt_paint::update_curve_mask(), blender::compositor::GaussianAlphaBlurBaseOperation::update_memory_buffer_partial(), blender::compositor::GaussianBokehBlurOperation::update_memory_buffer_partial(), blender::gpu::MTLBufferPool::update_memory_pools(), vfont_to_curve(), blender::gpu::MTLShader::warm_cache(), widget_numbut_draw(), WM_operator_properties_checker_interval(), wm_xr_session_action_test_bimanual(), and zspan_scanconvert().

◆ min_iii()

◆ min_iiii()

MINLINE int min_iiii ( int a,
int b,
int c,
int d )

Definition at line 512 of file math_base_inline.c.

References b, min_ii(), and min_iii().

Referenced by _bli_array_iter_spiral_square().

◆ min_uu()

◆ min_zz()

MINLINE size_t min_zz ( size_t a,
size_t b )

◆ mod_i()

◆ pow2f()

MINLINE float pow2f ( float x)

Definition at line 30 of file math_base_inline.c.

References x.

Referenced by blender::ed::spreadsheet::apply_row_filter(), BKE_brush_gen_radial_control_imbuf(), BKE_curveprofile_update(), BKE_kelvinlet_grab_triscale(), blender::ed::sculpt_paint::cache_paint_invariants_update(), blender::ed::sculpt_paint::filter::calc_sharpen_detail_translations(), blender::ed::sculpt_paint::CombOperationExecutor::comb_projected(), blender::ed::sculpt_paint::CombOperationExecutor::comb_spherical(), blender::ed::sculpt_paint::DeleteOperationExecutor::delete_projected(), blender::ed::sculpt_paint::DeleteOperationExecutor::delete_spherical(), draw_start_vertex_circle(), ease_sigmoid_function(), blender::draw::edituv_get_edituv_stretch_angle(), blender::ed::curves::find_closest_curve_to_screen_co(), blender::ed::curves::find_closest_point_to_screen_co(), blender::ed::sculpt_paint::PuffOperationExecutor::find_curve_weights_projected(), blender::ed::sculpt_paint::find_curves_brush_position(), blender::ed::sculpt_paint::SlideOperationExecutor::find_curves_to_slide(), blender::ed::sculpt_paint::PuffOperationExecutor::find_curves_weights_spherical(), blender::ed::sculpt_paint::SmoothOperationExecutor::find_projected_smooth_factors(), blender::ed::sculpt_paint::SmoothOperationExecutor::find_spherical_smooth_factors(), blender::ed::sculpt_paint::CurvesEffectOperationExecutor::gather_influences_projected(), blender::ed::sculpt_paint::CurvesEffectOperationExecutor::gather_influences_spherical(), blender::eevee::Film::init(), blender::ed::sculpt_paint::auto_mask::init_boundary_masking_bmesh(), blender::ed::sculpt_paint::auto_mask::init_boundary_masking_grids(), blender::ed::sculpt_paint::auto_mask::init_boundary_masking_mesh(), init_kelvinlet_grab(), kelvinlet_scale(), kelvinlet_twist(), blender::ed::sculpt_paint::filter::mesh_filter_sharpen_init(), blender::ed::sculpt_paint::SelectionPaintOperationExecutor::paint_curve_selection_projected(), blender::ed::sculpt_paint::SelectionPaintOperationExecutor::paint_curve_selection_spherical(), blender::ed::sculpt_paint::SelectionPaintOperationExecutor::paint_point_selection_projected(), blender::ed::sculpt_paint::SelectionPaintOperationExecutor::paint_point_selection_spherical(), blender::ed::sculpt_paint::PinchOperationExecutor::pinch_projected(), blender::ed::sculpt_paint::PinchOperationExecutor::pinch_spherical(), pow3f(), pow4f(), pow7f(), blender::ed::sculpt_paint::SnakeHookOperatorExecutor::projected_snake_hook(), blender::ed::sculpt_paint::DensitySubtractOperationExecutor::reduce_density_projected(), blender::ed::sculpt_paint::DensitySubtractOperationExecutor::reduce_density_spherical(), blender::ed::sculpt_paint::AddOperationExecutor::sample_spherical(), blender::ed::sculpt_paint::DensityAddOperationExecutor::sample_spherical_with_symmetry(), blender::bke::mesh_surface_sample::sample_surface_points_spherical(), SCULPT_calc_vertex_displacement(), blender::ed::curves::select_circle(), blender::ed::curves::select_circle_mask(), blender::geometry::curve_constraints::solve_length_and_collision_constraints(), sphclassical_force_cb(), blender::ed::sculpt_paint::SnakeHookOperatorExecutor::spherical_snake_hook(), ui_numedit_but_HISTOGRAM(), UI_view2d_dot_grid_draw(), blender::ed::sculpt_paint::use_add_density_mode(), and WM_gesture_lasso_modal().

◆ pow3f()

◆ pow4f()

◆ pow7f()

MINLINE float pow7f ( float x)

Definition at line 46 of file math_base_inline.c.

References pow2f(), pow3f(), and x.

Referenced by sphclassical_force_cb().

◆ pow_i()

int pow_i ( int base,
int exp )

Definition at line 13 of file math_base.c.

References BLI_assert, exp(), and result.

Referenced by multires_create_grids_in_unsubdivided_base_mesh(), and paint_proj_new_stroke().

◆ power_of_2()

MINLINE float power_of_2 ( float f)

Used for zoom values.

Definition at line 116 of file math_base_inline.c.

References ceil(), log(), M_LN2, and pow().

Referenced by clip_view_calculate_view_selection(), image_view_all(), sequencer_view_all_preview_exec(), and view_all_exec().

◆ power_of_2_max_i()

MINLINE int power_of_2_max_i ( int n)

Returns next (or previous) power of 2 or the input number if it is already a power of 2.

Definition at line 126 of file math_base_inline.c.

References is_power_of_2_i().

Referenced by array_chunk_size_calc(), checker_board_color_fill(), blender::compositor::jump_flooding(), blender::realtime_compositor::jump_flooding(), parse_alloc_ops(), blender::eevee::RayTraceModule::render(), and set_profile_spacing().

◆ power_of_2_max_u()

◆ power_of_2_min_i()

MINLINE int power_of_2_min_i ( int n)

◆ power_of_2_min_u()

MINLINE unsigned int power_of_2_min_u ( unsigned int x)

Definition at line 159 of file math_base_inline.c.

◆ ratiod()

◆ ratiof()

MINLINE float ratiof ( float min,
float max,
float pos )

◆ round_db_to_char()

MINLINE signed char round_db_to_char ( double a)

Definition at line 230 of file math_base_inline.c.

References _round_db_impl.

◆ round_db_to_char_clamp()

MINLINE signed char round_db_to_char_clamp ( double a)

Definition at line 252 of file math_base_inline.c.

References _round_clamp_db_impl.

◆ round_db_to_int()

MINLINE int round_db_to_int ( double a)

Definition at line 234 of file math_base_inline.c.

References _round_db_impl.

Referenced by BKE_scene_frame_snap_by_seconds().

◆ round_db_to_int_clamp()

MINLINE int round_db_to_int_clamp ( double a)

Definition at line 260 of file math_base_inline.c.

References _round_clamp_db_impl.

Referenced by ui_but_value_set().

◆ round_db_to_short()

MINLINE short round_db_to_short ( double a)

Definition at line 232 of file math_base_inline.c.

References _round_db_impl.

◆ round_db_to_short_clamp()

MINLINE short round_db_to_short_clamp ( double a)

Definition at line 256 of file math_base_inline.c.

References _round_clamp_db_impl.

Referenced by ui_but_value_set().

◆ round_db_to_uchar()

MINLINE unsigned char round_db_to_uchar ( double a)

Definition at line 231 of file math_base_inline.c.

References _round_db_impl.

◆ round_db_to_uchar_clamp()

MINLINE unsigned char round_db_to_uchar_clamp ( double a)

Definition at line 254 of file math_base_inline.c.

References _round_clamp_db_impl.

Referenced by ui_but_value_set().

◆ round_db_to_uint()

MINLINE unsigned int round_db_to_uint ( double a)

Definition at line 235 of file math_base_inline.c.

References _round_db_impl.

◆ round_db_to_uint_clamp()

MINLINE unsigned int round_db_to_uint_clamp ( double a)

Definition at line 261 of file math_base_inline.c.

References _round_clamp_db_impl, and UINT_MAX.

◆ round_db_to_ushort()

MINLINE unsigned short round_db_to_ushort ( double a)

Definition at line 233 of file math_base_inline.c.

References _round_db_impl.

◆ round_db_to_ushort_clamp()

MINLINE unsigned short round_db_to_ushort_clamp ( double a)

Definition at line 258 of file math_base_inline.c.

References _round_clamp_db_impl.

◆ round_fl_to_char()

MINLINE signed char round_fl_to_char ( float a)

Definition at line 223 of file math_base_inline.c.

References _round_fl_impl.

◆ round_fl_to_char_clamp()

MINLINE signed char round_fl_to_char_clamp ( float a)

Definition at line 240 of file math_base_inline.c.

References _round_clamp_fl_impl.

◆ round_fl_to_int()

MINLINE int round_fl_to_int ( float a)

Definition at line 227 of file math_base_inline.c.

References _round_fl_impl.

Referenced by actkeys_framejump_exec(), align_frame_with_pixel(), ANIM_channel_draw_widgets(), area_move_apply_do(), area_snap_calc_location(), BLF_position(), BLI_timecode_string_from_time(), BLI_timecode_string_from_time_seconds(), change_frame_apply(), cmp_fn(), do_render_strip_uncached(), draw_background(), draw_channels(), draw_current_frame(), draw_seq_waveform_overlay(), ED_annotation_draw_view3d(), ED_area_global_max_size_y(), ED_area_global_min_size_y(), ED_area_global_size_y(), ED_markers_find_nearest_marker_time(), ED_markers_post_apply_transform(), ED_region_panel_category_gutter_calc_rect(), ED_region_panels_draw(), blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::execute(), file_draw_list(), file_draw_string(), flushTransSeq(), frame_from_event(), frame_from_event(), gather_frames_to_render_for_adt(), gpu_batch_preset_panel_drag_widget(), graphkeys_framejump_exec(), graphkeys_previewrange_exec(), graphview_cursor_apply(), handle_number_input(), icon_draw_rect(), blender::seq::image_size_to_thumb_size(), imagewraposa_aniso(), blender::compositor::BlurBaseOperation::init_data(), label_str_get(), MOD_meshcache_calc_range(), mouse_over_key_get_from_strip(), nlaedit_previewrange_exec(), blender::ed::space_node::node_draw_hidden(), blender::ed::outliner::outliner_draw_overrides_rna_buts(), panel_draw_aligned_widgets(), previewrange_define_exec(), recalcData_actedit(), recalcData_sequencer_retiming(), seq_get_thumb_image_dimensions(), seq_proxy_fetch(), SEQ_render_give_stripelem(), seq_render_movie_strip_custom_file_proxy(), seq_render_movie_strip_view(), SEQ_retiming_key_speed_get(), SEQ_retiming_key_speed_set(), SEQ_retiming_key_timeline_frame_get(), seq_snap_threshold_get_frame_distance(), seq_snap_threshold_get_frame_distance(), seq_speed_effect_target_frame_get(), seq_split_set_left_hold_offset(), seq_split_set_right_hold_offset(), SEQ_time_get_rounded_sound_offset(), sequencer_slip_exec(), blender::ed::greasepencil::snap_selected_frames(), transform_convert_sequencer_channel_clamp(), transform_snap_sequencer_calc_timeline(), ui_do_drag(), ui_numedit_but_NUM(), ui_numedit_but_SLI(), UI_panel_category_draw_all(), UI_preview_tile_size_x(), UI_preview_tile_size_y(), UI_preview_tile_size_y_no_label(), uiAlignPanelStep(), uilist_resize_update(), widget_draw_text(), widget_draw_text_icon(), wm_drag_imbuf_icon_height_get(), wm_drag_imbuf_icon_width_get(), and WM_event_drag_direction().

◆ round_fl_to_int_clamp()

MINLINE int round_fl_to_int_clamp ( float a)

Definition at line 248 of file math_base_inline.c.

References _round_clamp_fl_impl.

Referenced by ui_do_but_NUM().

◆ round_fl_to_short()

MINLINE short round_fl_to_short ( float a)

◆ round_fl_to_short_clamp()

MINLINE short round_fl_to_short_clamp ( float a)

Definition at line 244 of file math_base_inline.c.

References _round_clamp_fl_impl.

◆ round_fl_to_uchar()

MINLINE unsigned char round_fl_to_uchar ( float a)

Definition at line 224 of file math_base_inline.c.

References _round_fl_impl.

Referenced by blender::color::ByteTraits::round().

◆ round_fl_to_uchar_clamp()

MINLINE unsigned char round_fl_to_uchar_clamp ( float a)

Definition at line 242 of file math_base_inline.c.

References _round_clamp_fl_impl.

Referenced by layerInterp_mcol(), and layerInterp_mloopcol().

◆ round_fl_to_uint()

MINLINE unsigned int round_fl_to_uint ( float a)

Definition at line 228 of file math_base_inline.c.

References _round_fl_impl.

Referenced by blf_ensure_size(), and blf_font_size().

◆ round_fl_to_uint_clamp()

MINLINE unsigned int round_fl_to_uint_clamp ( float a)

Definition at line 249 of file math_base_inline.c.

References _round_clamp_fl_impl, and UINT_MAX.

◆ round_fl_to_ushort()

MINLINE unsigned short round_fl_to_ushort ( float a)

Definition at line 226 of file math_base_inline.c.

References _round_fl_impl.

◆ round_fl_to_ushort_clamp()

MINLINE unsigned short round_fl_to_ushort_clamp ( float a)

Definition at line 246 of file math_base_inline.c.

References _round_clamp_fl_impl.

◆ round_to_even()

MINLINE float round_to_even ( float f)

Round to closest even number, halfway cases are rounded away from zero.

Definition at line 267 of file math_base_inline.c.

Referenced by blender::compositor::BlurBaseOperation::determine_canvas(), and blender::compositor::BokehBlurOperation::determine_canvas().

◆ scalenorm()

MINLINE float scalenorm ( float a,
float b,
float x )

Map a normalized value, i.e. from interval [0, 1] to interval [a, b].

Definition at line 104 of file math_base_inline.c.

References b, BLI_assert, and x.

◆ scalenormd()

MINLINE double scalenormd ( double a,
double b,
double x )

Map a normalized value, i.e. from interval [0, 1] to interval [a, b].

Definition at line 110 of file math_base_inline.c.

References b, BLI_assert, and x.

◆ signf()

◆ signum_i()

◆ signum_i_ex()

MINLINE int signum_i_ex ( float a,
float eps )

Definition at line 639 of file math_base_inline.c.

References eps.

Referenced by bm_edge_calc_rotate_beauty__area().

◆ sqrt3d()

MINLINE double sqrt3d ( double d)

Definition at line 64 of file math_base_inline.c.

References exp(), log(), and UNLIKELY.

Referenced by solve_cubic().

◆ sqrt3f()

MINLINE float sqrt3f ( float f)

Definition at line 51 of file math_base_inline.c.

References exp(), float, log(), and UNLIKELY.

Referenced by ui_numedit_but_HSVCIRCLE().

◆ sqrtf_signed()

MINLINE float sqrtf_signed ( float f)

Definition at line 77 of file math_base_inline.c.

References sqrtf.

Referenced by invGammaCorrect(), mesh_calc_eigen_matrix(), and modify_mesh().

◆ square_d()

MINLINE double square_d ( double a)

Definition at line 365 of file math_base_inline.c.

◆ square_f()

MINLINE float square_f ( float a)

Definition at line 360 of file math_base_inline.c.

Referenced by BKE_brush_jitter_pos(), bm_edge_symmetry_map(), bm_edgexedge_isect_impl(), bm_edgexvert_isect_impl(), BM_mesh_intersect_edges(), bmo_planar_faces_exec(), blender::ed::sculpt_paint::brush_delta_update(), calc_duplicates_fast(), calctrackballvec(), cloth_collision_response_static(), cloth_selfcollision_response_static(), contarget_get_mesh_mat(), blender::ed::curves::curve_draw_event_add(), curve_draw_event_add(), blender::ed::curves::curve_draw_exec_precalc(), curve_draw_exec_precalc(), curve_draw_modal(), blender::ed::curves::curves_draw_modal(), blender::deform_drawing(), deformVerts_do(), dist_squared_ray_to_seg_v3(), draw_culling_sphere_test(), dynamic_paint_find_island_border(), ED_armature_from_edit(), ED_transform_snap_object_project_view3d_ex(), EDBM_verts_mirror_cache_begin_ex(), execute_posetree(), gizmo_arrow_test_select(), blender::workbench::CavityEffect::init(), isect_seg_seg_v2_point_ex(), len_squared_vnvn(), blender::bke::pbvh::long_edge_queue_edge_add_recursive(), mat4_to_dquat(), mesh_edges_spherecast(), blender::geometry::mesh_merge_by_distance_connected(), mesh_remove_doubles_on_axis(), mouse_to_plane_slide_zone_distance_squared(), mouse_to_slide_zone_distance_squared(), blender::ed::space_node::node_under_mouse_tweak(), object_mouse_select_menu(), blender::ed::sculpt_paint::paint_smooth_stroke(), py_bvhtree_find_nearest_range(), blender::eevee::Sampling::sample_ball(), blender::eevee::Sampling::sample_hemisphere(), blender::eevee::Sampling::sample_sphere(), seq_select_seq_from_preview(), snap_target_uv_fn(), sphere_normal_from_uv(), spline_under_mouse_get(), blender::eevee::BackgroundPipeline::sync(), ui_do_but_CURVE(), ui_do_but_CURVEPROFILE(), uv_find_nearest_edge(), uv_find_nearest_vert(), uv_image_outset(), uv_nearest_hit_init_dist_px(), v3d_cursor_plane_draw(), warpModifier_do(), and WM_gesture_lasso_modal().

◆ square_i()

◆ square_s()

MINLINE int square_s ( short a)

Definition at line 340 of file math_base_inline.c.

Referenced by project_state_init().

◆ square_uchar()

MINLINE int square_uchar ( unsigned char a)

Definition at line 355 of file math_base_inline.c.

◆ square_uint()

◆ ulp_diff_ff()

MINLINE uint ulp_diff_ff ( float a,
float b )

Computes the distance between two floats in ulps.

In other words, returns zero if the floats are exactly equal, and otherwise returns 1 plus the number of (unique) representable floats between a and b on the number line.

Notes:

  • The order of a and b doesn't matter. The returned value is the absolute difference.
  • Unlike many ulp difference functions, this function handles the difference between positive and negative floats in a meaningful way. It returns the number (plus 1) of representable floats between those two values as they would be arranged on a number line.
  • Zero and negative zero are not considered unique from each other. They are counted together as a single float in the difference.
  • NaNs are not handled meaningfully. If either number is NaN, this function returns uint max (0xffffffff).

Definition at line 565 of file math_base_inline.c.

References b, and BLI_assert.

Referenced by compare_ff_relative(), normalization_factor_get(), blender::tests::TEST(), and blender::animrig::tests::AnimationEvaluationTest::test_evaluate_layer().

Variable Documentation

◆ NAN_INT

const int NAN_INT = 0x7FC00000
static

Definition at line 100 of file BLI_math_base.h.