Blender V4.3
math.h File Reference
#include <cmath>
#include <float.h>
#include <math.h>
#include <stdio.h>
#include "util/types.h"
#include "util/math_int2.h"
#include "util/math_int3.h"
#include "util/math_int4.h"
#include "util/math_int8.h"
#include "util/math_float2.h"
#include "util/math_float4.h"
#include "util/math_float8.h"
#include "util/math_float3.h"
#include "util/rect.h"

Go to the source code of this file.

Macros

#define __has_builtin(v)   0
 

Functions

ccl_device_inline int abs (int x)
 
ccl_device_inline int max (int a, int b)
 
ccl_device_inline int min (int a, int b)
 
ccl_device_inline uint32_t max (uint32_t a, uint32_t b)
 
ccl_device_inline uint32_t min (uint32_t a, uint32_t b)
 
ccl_device_inline uint64_t max (uint64_t a, uint64_t b)
 
ccl_device_inline uint64_t min (uint64_t a, uint64_t b)
 
template<class T >
ccl_device_inline std::enable_if_t< std::is_same_v< T, size_t >, Tmax (T a, T b)
 
template<class T >
ccl_device_inline std::enable_if_t< std::is_same_v< T, size_t >, Tmin (T a, T b)
 
ccl_device_inline float max (float a, float b)
 
ccl_device_inline float min (float a, float b)
 
ccl_device_inline double max (double a, double b)
 
ccl_device_inline double min (double a, double b)
 
template<typename T >
ccl_device_inline T min4 (const T &a, const T &b, const T &c, const T &d)
 
template<typename T >
ccl_device_inline T max4 (const T &a, const T &b, const T &c, const T &d)
 
ccl_device_inline float min4 (float a, float b, float c, float d)
 
ccl_device_inline float max4 (float a, float b, float c, float d)
 
ccl_device_inline int as_int (uint i)
 
ccl_device_inline uint as_uint (int i)
 
ccl_device_inline uint as_uint (float f)
 
ccl_device_inline int __float_as_int (float f)
 
ccl_device_inline float __int_as_float (int i)
 
ccl_device_inline uint __float_as_uint (float f)
 
ccl_device_inline float __uint_as_float (uint i)
 
ccl_device_inline int4 __float4_as_int4 (float4 f)
 
ccl_device_inline float4 __int4_as_float4 (int4 i)
 
template<typename T >
ccl_device_inline uint pointer_pack_to_uint_0 (T *ptr)
 
template<typename T >
ccl_device_inline uint pointer_pack_to_uint_1 (T *ptr)
 
template<typename T >
ccl_device_inline Tpointer_unpack_from_uint (const uint a, const uint b)
 
ccl_device_inline uint uint16_pack_to_uint (const uint a, const uint b)
 
ccl_device_inline uint uint16_unpack_from_uint_0 (const uint i)
 
ccl_device_inline uint uint16_unpack_from_uint_1 (const uint i)
 
ccl_device_inline bool isnan_safe (float f)
 
ccl_device_inline bool isfinite_safe (float f)
 
ccl_device_inline float ensure_finite (float v)
 
ccl_device_inline int clamp (int a, int mn, int mx)
 
ccl_device_inline float clamp (float a, float mn, float mx)
 
ccl_device_inline float mix (float a, float b, float t)
 
ccl_device_inline float smoothstep (float edge0, float edge1, float x)
 
ccl_device_inline float saturatef (float a)
 
ccl_device_inline int float_to_int (float f)
 
ccl_device_inline int floor_to_int (float f)
 
ccl_device_inline float floorfrac (float x, ccl_private int *i)
 
ccl_device_inline int ceil_to_int (float f)
 
ccl_device_inline float fractf (float x)
 
ccl_device_inline float wrapf (float value, float max, float min)
 
ccl_device_inline float pingpongf (float a, float b)
 
ccl_device_inline float smoothminf (float a, float b, float k)
 
ccl_device_inline float signf (float f)
 
ccl_device_inline float nonzerof (float f, float eps)
 
ccl_device_inline float compatible_atan2 (const float y, const float x)
 
ccl_device_inline float compatible_signf (float f)
 
ccl_device_inline float smoothstepf (float f)
 
ccl_device_inline int mod (int x, int m)
 
ccl_device_inline float3 float2_to_float3 (const float2 a)
 
ccl_device_inline float2 float3_to_float2 (const float3 a)
 
ccl_device_inline float3 float4_to_float3 (const float4 a)
 
ccl_device_inline float4 float3_to_float4 (const float3 a)
 
ccl_device_inline float4 float3_to_float4 (const float3 a, const float w)
 
ccl_device_inline float inverse_lerp (float a, float b, float x)
 
ccl_device_inline float cubic_interp (float a, float b, float c, float d, float x)
 
CCL_NAMESPACE_END CCL_NAMESPACE_BEGIN ccl_device_inline float triangle_area (ccl_private const float3 &v1, ccl_private const float3 &v2, ccl_private const float3 &v3)
 
ccl_device_inline void make_orthonormals (const float3 N, ccl_private float3 *a, ccl_private float3 *b)
 
ccl_device_inline Spectrum safe_invert_color (Spectrum a)
 
ccl_device_inline Spectrum safe_divide_color (Spectrum a, Spectrum b)
 
ccl_device_inline float3 safe_divide_even_color (float3 a, float3 b)
 
ccl_device_inline float3 rotate_around_axis (float3 p, float3 axis, float angle)
 
ccl_device_inline float safe_sqrtf (float f)
 
ccl_device_inline float inversesqrtf (float f)
 
ccl_device float safe_asinf (float a)
 
ccl_device float safe_acosf (float a)
 
ccl_device float compatible_powf (float x, float y)
 
ccl_device float safe_powf (float a, float b)
 
ccl_device float safe_divide (float a, float b)
 
ccl_device float safe_logf (float a, float b)
 
ccl_device float safe_modulo (float a, float b)
 
ccl_device float safe_floored_modulo (float a, float b)
 
ccl_device_inline float sqr (float a)
 
ccl_device_inline float sin_from_cos (const float c)
 
ccl_device_inline float cos_from_sin (const float s)
 
ccl_device_inline float sin_sqr_to_one_minus_cos (const float s_sq)
 
ccl_device_inline float one_minus_cos (const float angle)
 
ccl_device_inline float pow20 (float a)
 
ccl_device_inline float pow22 (float a)
 
ccl_device_inline float beta (float x, float y)
 
ccl_device_inline float xor_signmask (float x, int y)
 
ccl_device float bits_to_01 (uint bits)
 
ccl_device_inline uint popcount (uint x)
 
ccl_device_inline uint count_leading_zeros (uint x)
 
ccl_device_inline uint count_trailing_zeros (uint x)
 
ccl_device_inline uint find_first_set (uint x)
 
ccl_device_inline float2 map_to_tube (const float3 co)
 
ccl_device_inline float2 map_to_sphere (const float3 co)
 
ccl_device_inline bool compare_floats (float a, float b, float abs_diff, int ulp_diff)
 
ccl_device_inline float precise_angle (float3 a, float3 b)
 
ccl_device_inline float tan_angle (float3 a, float3 b)
 
ccl_device_inline uint next_power_of_two (uint x)
 
ccl_device_inline uint prev_power_of_two (uint x)
 
ccl_device_inline uint32_t reverse_integer_bits (uint32_t x)
 
ccl_device_inline bool intervals_intersect (ccl_private float2 *first, const float2 second)
 
ccl_device_inline bool solve_quadratic (const float a, const float b, const float c, ccl_private float &x1, ccl_private float &x2)
 

Macro Definition Documentation

◆ __has_builtin

#define __has_builtin ( v)    0

Definition at line 1012 of file util/math.h.

Function Documentation

◆ __float4_as_int4()

ccl_device_inline int4 __float4_as_int4 ( float4 f)

Definition at line 296 of file util/math.h.

References __float_as_int, and make_int4().

Referenced by fast_exp2f4().

◆ __float_as_int()

ccl_device_inline int __float_as_int ( float f)

Definition at line 255 of file util/math.h.

◆ __float_as_uint()

ccl_device_inline uint __float_as_uint ( float f)

Definition at line 275 of file util/math.h.

◆ __int4_as_float4()

ccl_device_inline float4 __int4_as_float4 ( int4 i)

Definition at line 306 of file util/math.h.

References __int_as_float, make_float4(), int4::w, int4::x, int4::y, and int4::z.

Referenced by fast_exp2f4().

◆ __int_as_float()

ccl_device_inline float __int_as_float ( int i)

Definition at line 265 of file util/math.h.

◆ __uint_as_float()

ccl_device_inline float __uint_as_float ( uint i)

Definition at line 285 of file util/math.h.

◆ abs()

Definition at line 120 of file util/math.h.

References x.

Referenced by actionzone_modal(), annotation_draw_apply_event(), area_join_update_data(), area_move_apply_do(), area_snap_calc_location(), area_split_factor(), BKE_fcurve_delete_key(), BKE_gpencil_layer_frame_get(), BKE_mask_spline_project_co(), blend_color_difference_byte(), blf_glyph_calc_rect_test(), BLI_listbase_link_move(), BLI_str_format_integer_unit(), blo_do_versions_280(), blo_do_versions_300(), bm_loop_build(), bm_loop_path_build_step(), brush_scale_size_exec(), blender::build_sequential(), blender::nodes::node_shader_tex_checker_cc::NodeTexChecker::call(), compare_floats(), compare_floats(), compare_rgb_uchar(), slim::compute_least_squares_scaling(), createTransActionData(), distance(), draw_horizontal_scale_indicators(), DRW_select_buffer_find_nearest_to_point(), ED_preview_draw(), ed_preview_draw_rect(), ED_region_generic_tools_region_snap_size(), ED_region_snap_size_test(), establish_track_initialization_order(), file_smoothscroll_invoke(), find_nearest_seq(), flushTransSeq(), blender::nodes::node_fn_compare_cc::get_multi_function(), Freestyle::GaussianFilter::getSmoothedPixel(), gpencil_layer_final_tint_and_alpha_get(), grease_pencil_layer_final_tint_and_alpha_get(), hsl_to_rgb(), image_buf_fill_checker_slice(), len_manhattan_v2_int(), GHOST_Wintab::mapWintabToSysCoordinates(), blender::color::mix_difference(), modf_to_index(), mouse_select_knot(), moviecache_getitempriority(), nla_draw_strip_curves(), node_mix_diff(), pingpong(), GHOST_SystemWin32::processWheelEvent(), Freestyle::AppView::rabs(), region_scale_modal(), region_visible_rect_calc(), screen_area_trim(), screen_areas_can_align(), screen_geom_area_map_find_active_scredge(), select_adjacent_cp(), select_nth_bezt(), select_nth_bp(), seq_frame_snap_update_best(), seq_retiming_transition_is_linear(), SEQ_retiming_transition_key_frame_set(), SEQ_time_find_next_prev_edit(), blender::ed::object::set_constraint_nth_target(), GHOST_DisplayManagerX11::setCurrentDisplaySetting(), setCustomPointsFromDirection(), setNearestAxis2d(), smoothmin(), blender::ed::greasepencil::snap_8_angles(), blender::ed::greasepencil::snap_diagonals_box(), snapNode(), svm_checker(), svm_image_texture_wrap_mirror(), blender::bke::tests::test_vec_roll_to_mat3_orthogonal(), GHOST_Wintab::testCoordinates(), blender::gpu::tests::texture_create_upload_read_with_bias(), thumb_create_ex(), blender::math::to_axis_angle(), transdata_get_track_shuffle_offset(), transform_snap_nla_calc(), transform_snap_sequencer_calc_preview(), transform_snap_sequencer_calc_timeline(), blender::nodes::try_dispatch_float_math_fl3_to_fl3(), ui_but_drag_init(), ui_but_dragedit_update_mval(), ui_do_but_COLORBAND(), ui_do_but_NUM(), ui_do_but_SLI(), ui_do_button(), ui_numedit_but_NUM(), ui_pan_to_scroll(), blender::compositor::ConvertDepthToRadiusOperation::update_memory_buffer_partial(), blender::compositor::KuwaharaAnisotropicOperation::update_memory_buffer_partial(), vert_pair_adjacent_in_orig_face(), view2d_scroll_delta_y_snap_page_size(), view2d_totRect_set_resize(), voronoi_distance(), voronoi_distance(), voronoi_distance(), voronoi_distance(), voronoi_distance_to_edge(), voronoi_n_sphere_radius(), wm_autosave_location(), WM_event_drag_test_with_delta(), wm_gesture_straightline_do_angle_snap(), and CCL_NAMESPACE_BEGIN::TextureInterpolator< TexT, OutT >::wrap_mirror().

◆ as_int()

ccl_device_inline int as_int ( uint i)

Definition at line 224 of file util/math.h.

Referenced by BM_mesh_intersect_edges().

◆ as_uint() [1/2]

Definition at line 244 of file util/math.h.

◆ as_uint() [2/2]

ccl_device_inline uint as_uint ( int i)

Definition at line 234 of file util/math.h.

Referenced by emit_attribute_map_entry().

◆ beta()

◆ bits_to_01()

ccl_device float bits_to_01 ( uint bits)

Definition at line 843 of file util/math.h.

References float.

◆ ceil_to_int()

ccl_device_inline int ceil_to_int ( float f)

Definition at line 441 of file util/math.h.

References ceilf, and float_to_int().

Referenced by RenderScheduler::calculate_resolution_divider_for_time().

◆ clamp() [1/2]

ccl_device_inline float clamp ( float a,
float mn,
float mx )

Definition at line 384 of file util/math.h.

References max, and min.

◆ clamp() [2/2]

ccl_device_inline int clamp ( int a,
int mn,
int mx )

Definition at line 379 of file util/math.h.

References max, and min.

Referenced by area_light_rect_sample(), background_map_pdf(), bake_offset_towards_center(), bsdf_ashikhmin_shirley_setup(), bsdf_hair_reflection_setup(), bsdf_hair_transmission_setup(), bsdf_sheen_setup(), bsdf_toon_setup_common(), bssrdf_setup(), BVHSpatialSplit::BVHSpatialSplit(), Freestyle::CalligraphicShader::CalligraphicShader(), ClampNode::constant_fold(), MixColorNode::constant_fold(), MixFloatNode::constant_fold(), MixVectorNode::constant_fold(), RGBRampNode::constant_fold(), create_mesh(), SceneParams::curve_subdivisions(), cycles_precompute(), blender::gpu::MTLContext::ensure_depth_stencil_state(), fast_exp2f(), fast_exp2f4(), fast_log2f(), fast_logb(), blender::bke::pbvh::pixels::Rows::filter_pixels_for_closer_examination(), float_ramp_lookup(), float_ramp_lookup(), BVHObjectBinning::get_bin(), BlenderSync::get_session_params(), SkyTextureNode::get_sun_average_radiance(), guiding_record_bssrdf_bounce(), guiding_record_surface_bounce(), hsl_to_rgb(), hsl_to_rgb(), interpolate_curve_points(), ior_from_F0(), kernel_curve_shadow_transparency_evaluate(), light_distribution_sample(), light_tree_emitter_importance(), light_tree_node_importance(), node_mix_clamp(), ObtainCacheParticleData(), quat_interpolate(), rgb_ramp_lookup(), rgb_ramp_lookup(), rgb_ramp_lookup(), rgb_ramp_lookup(), safe_acosf(), safe_asinf(), sample_trimmed_logistic(), saturatef(), schlick_fresnel(), blender::nodes::node_shader_mix_rgb_cc::sh_node_mix_rgb_build_multi_function(), shadow_ray_offset(), sky_texture_precompute_hosek(), smootherstep(), BVHSpatialSplit::split_curve_primitive(), BVHSpatialSplit::split_triangle_primitive(), svm_image_texture_wrap_clamp(), svm_node_clamp(), svm_node_closure_bsdf(), svm_node_layer_weight(), svm_node_tex_gabor(), svm_node_tex_noise(), svm_node_tex_voronoi(), svm_node_vector_map_range(), blender::compositor::KuwaharaAnisotropicOperation::update_memory_buffer_partial(), and CCL_NAMESPACE_BEGIN::TextureInterpolator< TexT, OutT >::wrap_clamp().

◆ compare_floats()

ccl_device_inline bool compare_floats ( float a,
float b,
float abs_diff,
int ulp_diff )

Definition at line 970 of file util/math.h.

References __float_as_int, abs(), b, and fabsf.

◆ compatible_atan2()

ccl_device_inline float compatible_atan2 ( const float y,
const float x )

Definition at line 492 of file util/math.h.

References atan2f.

Referenced by svm_math().

◆ compatible_powf()

ccl_device float compatible_powf ( float x,
float y )

Definition at line 730 of file util/math.h.

References fmodf, and powf.

Referenced by safe_powf().

◆ compatible_signf()

ccl_device_inline float compatible_signf ( float f)

Definition at line 498 of file util/math.h.

References signf().

◆ cos_from_sin()

◆ count_leading_zeros()

ccl_device_inline uint count_leading_zeros ( uint x)

◆ count_trailing_zeros()

ccl_device_inline uint count_trailing_zeros ( uint x)

Definition at line 894 of file util/math.h.

◆ cubic_interp()

ccl_device_inline float cubic_interp ( float a,
float b,
float c,
float d,
float x )

Definition at line 556 of file util/math.h.

References b.

Referenced by interpolate_ies_vertical(), and kernel_ies_interp().

◆ ensure_finite()

◆ find_first_set()

ccl_device_inline uint find_first_set ( uint x)

Definition at line 914 of file util/math.h.

References count_leading_zeros().

◆ float2_to_float3()

ccl_device_inline float3 float2_to_float3 ( const float2 a)

◆ float3_to_float2()

◆ float3_to_float4() [1/2]

◆ float3_to_float4() [2/2]

ccl_device_inline float4 float3_to_float4 ( const float3 a,
const float w )

Definition at line 545 of file util/math.h.

References make_float4(), and w().

◆ float4_to_float3()

◆ float_to_int()

◆ floor_to_int()

ccl_device_inline int floor_to_int ( float f)

Definition at line 429 of file util/math.h.

References float_to_int(), and floorf.

Referenced by HdCyclesDelegate::GetRenderStats(), and svm_brick().

◆ floorfrac()

ccl_device_inline float floorfrac ( float x,
ccl_private int * i )

Definition at line 434 of file util/math.h.

References float_to_int(), and floorf.

Referenced by perlin_1d(), perlin_2d(), perlin_3d(), and perlin_4d().

◆ fractf()

Definition at line 446 of file util/math.h.

References floorf.

Referenced by pingpongf().

◆ intervals_intersect()

ccl_device_inline bool intervals_intersect ( ccl_private float2 * first,
const float2 second )

Definition at line 1055 of file util/math.h.

References fmaxf, fminf, float2::x, and float2::y.

Referenced by ray_cone_intersect(), and ray_infinite_cylinder_intersect().

◆ inverse_lerp()

◆ inversesqrtf()

◆ isfinite_safe()

◆ isnan_safe()

ccl_device_inline bool isnan_safe ( float f)

Definition at line 359 of file util/math.h.

References __float_as_uint.

Referenced by bsdf_hair_huang_eval(), and fresnel_dielectric_polarized().

◆ make_orthonormals()

◆ map_to_sphere()

ccl_device_inline float2 map_to_sphere ( const float3 co)

Definition at line 944 of file util/math.h.

References atan2f, dot(), l, make_float2(), safe_acosf(), sqrtf, UNLIKELY, v, float3::x, float3::y, and float3::z.

◆ map_to_tube()

ccl_device_inline float2 map_to_tube ( const float3 co)

Definition at line 930 of file util/math.h.

References atan2f, len, M_PI_F, make_float2(), sqrtf, v, float3::x, float3::y, and float3::z.

◆ max() [1/6]

Definition at line 184 of file util/math.h.

References b.

◆ max() [2/6]

Definition at line 174 of file util/math.h.

References b.

◆ max() [3/6]

ccl_device_inline int max ( int a,
int b )

Definition at line 125 of file util/math.h.

References b.

◆ max() [4/6]

template<class T >
ccl_device_inline std::enable_if_t< std::is_same_v< T, size_t >, T > max ( T a,
T b )

Definition at line 163 of file util/math.h.

References b.

◆ max() [5/6]

Definition at line 135 of file util/math.h.

References b.

◆ max() [6/6]

Definition at line 145 of file util/math.h.

References b.

◆ max4() [1/2]

template<typename T >
ccl_device_inline T max4 ( const T & a,
const T & b,
const T & c,
const T & d )

Definition at line 205 of file util/math.h.

References b, and max.

Referenced by bvh_aligned_node_intersect(), and bvh_unaligned_node_intersect_child().

◆ max4() [2/2]

ccl_device_inline float max4 ( float a,
float b,
float c,
float d )

Definition at line 216 of file util/math.h.

References b, and max.

◆ min() [1/6]

Definition at line 189 of file util/math.h.

References b.

◆ min() [2/6]

Definition at line 179 of file util/math.h.

References b.

◆ min() [3/6]

ccl_device_inline int min ( int a,
int b )

Definition at line 130 of file util/math.h.

References b.

◆ min() [4/6]

template<class T >
ccl_device_inline std::enable_if_t< std::is_same_v< T, size_t >, T > min ( T a,
T b )

Definition at line 169 of file util/math.h.

References b.

◆ min() [5/6]

Definition at line 140 of file util/math.h.

References b.

◆ min() [6/6]

Definition at line 150 of file util/math.h.

References b.

◆ min4() [1/2]

template<typename T >
ccl_device_inline T min4 ( const T & a,
const T & b,
const T & c,
const T & d )

Definition at line 200 of file util/math.h.

References b, and min.

Referenced by bvh_aligned_node_intersect(), and bvh_unaligned_node_intersect_child().

◆ min4() [2/2]

ccl_device_inline float min4 ( float a,
float b,
float c,
float d )

Definition at line 211 of file util/math.h.

References b, and min.

◆ mix()

Definition at line 389 of file util/math.h.

References b.

◆ mod()

◆ next_power_of_two()

ccl_device_inline uint next_power_of_two ( uint x)

Definition at line 1000 of file util/math.h.

References count_leading_zeros().

Referenced by round_num_samples_to_power_of_2(), round_up_to_power_of_two(), and TEST().

◆ nonzerof()

ccl_device_inline float nonzerof ( float f,
float eps )

Definition at line 479 of file util/math.h.

References eps, fabsf, and signf().

◆ one_minus_cos()

◆ pingpongf()

ccl_device_inline float pingpongf ( float a,
float b )

Definition at line 458 of file util/math.h.

References b, fabsf, and fractf().

◆ pointer_pack_to_uint_0()

template<typename T >
ccl_device_inline uint pointer_pack_to_uint_0 ( T * ptr)

Definition at line 328 of file util/math.h.

References ptr.

◆ pointer_pack_to_uint_1()

template<typename T >
ccl_device_inline uint pointer_pack_to_uint_1 ( T * ptr)

Definition at line 333 of file util/math.h.

References ptr.

◆ pointer_unpack_from_uint()

template<typename T >
ccl_device_inline T * pointer_unpack_from_uint ( const uint a,
const uint b )

Definition at line 338 of file util/math.h.

References b.

Referenced by get_payload_ptr_0(), and get_payload_ptr_2().

◆ popcount()

◆ pow20()

Definition at line 809 of file util/math.h.

References sqr().

◆ pow22()

Definition at line 814 of file util/math.h.

References sqr().

◆ precise_angle()

ccl_device_inline float precise_angle ( float3 a,
float3 b )

Definition at line 988 of file util/math.h.

References atan2f, b, and len.

Referenced by pdf_uniform_cone(), and sky_radiance_nishita().

◆ prev_power_of_two()

ccl_device_inline uint prev_power_of_two ( uint x)

Definition at line 1006 of file util/math.h.

References count_leading_zeros(), and x.

Referenced by round_down_to_power_of_two(), and TEST().

◆ reverse_integer_bits()

◆ rotate_around_axis()

ccl_device_inline float3 rotate_around_axis ( float3 p,
float3 axis,
float angle )

◆ safe_acosf()

◆ safe_asinf()

◆ safe_divide()

◆ safe_divide_color()

◆ safe_divide_even_color()

ccl_device_inline float3 safe_divide_even_color ( float3 a,
float3 b )

Definition at line 643 of file util/math.h.

References b, make_float3(), float3::x, x, y, and z().

Referenced by film_get_pass_pixel_light_path().

◆ safe_floored_modulo()

ccl_device float safe_floored_modulo ( float a,
float b )

Definition at line 777 of file util/math.h.

References b, and floorf.

◆ safe_invert_color()

ccl_device_inline Spectrum safe_invert_color ( Spectrum a)

Definition at line 621 of file util/math.h.

References FOREACH_SPECTRUM_CHANNEL, and GET_SPECTRUM_CHANNEL.

◆ safe_logf()

ccl_device float safe_logf ( float a,
float b )

Definition at line 763 of file util/math.h.

References b, logf, safe_divide(), and UNLIKELY.

Referenced by svm_math(), TEST(), and blender::nodes::try_dispatch_float_math_fl_fl_to_fl().

◆ safe_modulo()

ccl_device float safe_modulo ( float a,
float b )

Definition at line 772 of file util/math.h.

References b, and fmodf.

◆ safe_powf()

ccl_device float safe_powf ( float a,
float b )

◆ safe_sqrtf()

◆ saturatef()

ccl_device_inline float saturatef ( float a)

Definition at line 418 of file util/math.h.

References clamp().

◆ signf()

◆ sin_from_cos()

◆ sin_sqr_to_one_minus_cos()

ccl_device_inline float sin_sqr_to_one_minus_cos ( const float s_sq)

Definition at line 797 of file util/math.h.

References safe_sqrtf().

Referenced by point_light_sample(), sphere_light_pdf(), spot_light_pdf(), and spot_light_sample().

◆ smoothminf()

ccl_device_inline float smoothminf ( float a,
float b,
float k )

Definition at line 463 of file util/math.h.

References b, fabsf, fmaxf, and fminf.

◆ smoothstep()

ccl_device_inline float smoothstep ( float edge0,
float edge1,
float x )

Definition at line 394 of file util/math.h.

References result.

◆ smoothstepf()

ccl_device_inline float smoothstepf ( float f)

Definition at line 508 of file util/math.h.

Referenced by spot_light_attenuation(), spot_light_tree_parameters(), and svm_brick().

◆ solve_quadratic()

ccl_device_inline bool solve_quadratic ( const float a,
const float b,
const float c,
ccl_private float & x1,
ccl_private float & x2 )

Definition at line 1066 of file util/math.h.

References b, copysignf, fmaxf, fminf, safe_sqrtf(), and sqr().

Referenced by ray_cone_intersect(), and ray_infinite_cylinder_intersect().

◆ sqr()

Definition at line 782 of file util/math.h.

Referenced by arc_length(), area_light_rect_sample(), area_light_sample(), area_light_spread_clamp_light(), area_light_valid_ray_segment(), atmosphere_intersection(), bessel_I0(), bsdf_aniso_D(), bsdf_aniso_lambda(), bsdf_D(), bsdf_get_roughness_pass_squared(), bsdf_hair_chiang_eval(), bsdf_hair_chiang_sample(), bsdf_hair_huang_albedo(), bsdf_hair_huang_eval_r(), bsdf_hair_huang_eval_residual(), bsdf_hair_huang_eval_trrt(), bsdf_hair_huang_sample(), bsdf_lambda(), bsdf_microfacet_eval(), bsdf_microfacet_sample(), bsdf_microfacet_setup_fresnel_f82_tint(), bsdf_oren_nayar_G(), bsdf_oren_nayar_setup(), bsdf_sheen_eval(), bsdf_sheen_sample(), bump_shadowing_term(), color_highlight_compress(), compute_v(), computeBindWeights(), cos_from_sin(), cos_theta(), LightManager::device_update_lights(), ensure_valid_specular_reflection(), F0_from_ior(), fresnel_dielectric_polarized(), SkyTextureNode::get_sun_average_radiance(), hair_alpha_angles(), hair_attenuation(), ior_parametrization(), iridescence_airy_summation(), iridescence_lookup_sensitivity(), light_tree_importance(), logistic(), microfacet_beckmann_sample_vndf(), microfacet_fresnel(), microfacet_ggx_sample_vndf(), one_minus_cos(), OVERLAY_light_cache_populate(), phase_draine(), phase_draine_sample_cos(), phase_fournier_forand_delta(), phase_fournier_forand_impl(), phase_fournier_forand_newton(), phase_henyey_greenstein(), phase_henyey_greenstein_sample(), phase_mie(), phase_rayleigh(), phase_rayleigh(), phase_rayleigh_sample(), point_light_mnee_sample_update(), point_light_sample(), point_light_sample_from_intersection(), point_light_tree_parameters(), pow20(), pow22(), precompute_ggx_E(), precompute_ggx_gen_schlick_s(), precompute_ggx_glass_E(), ray_cone_intersect(), ray_disk_intersect(), sin_from_cos(), SKY_nishita_skymodel_precompute_texture(), sky_radiance_nishita(), solve_quadratic(), sphg_dir(), spot_light_mnee_sample_update(), spot_light_sample(), spot_light_sample_from_intersection(), spot_light_tree_parameters(), spot_light_valid_ray_segment(), surface_intersection(), surface_shader_prepare_closures(), svm_node_closure_bsdf(), and svm_node_principled_volume().

◆ tan_angle()

ccl_device_inline float tan_angle ( float3 a,
float3 b )

Definition at line 994 of file util/math.h.

References b, cross(), dot(), and len.

Referenced by area_light_spread_attenuation().

◆ triangle_area()

◆ uint16_pack_to_uint()

ccl_device_inline uint uint16_pack_to_uint ( const uint a,
const uint b )

Definition at line 343 of file util/math.h.

References b.

Referenced by __anyhit__kernel_optix_shadow_all_hit().

◆ uint16_unpack_from_uint_0()

ccl_device_inline uint uint16_unpack_from_uint_0 ( const uint i)

Definition at line 348 of file util/math.h.

Referenced by __anyhit__kernel_optix_shadow_all_hit().

◆ uint16_unpack_from_uint_1()

ccl_device_inline uint uint16_unpack_from_uint_1 ( const uint i)

Definition at line 353 of file util/math.h.

Referenced by __anyhit__kernel_optix_shadow_all_hit().

◆ wrapf()

ccl_device_inline float wrapf ( float value,
float max,
float min )

Definition at line 452 of file util/math.h.

References floorf, and min.

◆ xor_signmask()

ccl_device_inline float xor_signmask ( float x,
int y )

Definition at line 838 of file util/math.h.

References __float_as_int, and __int_as_float.

Referenced by isect_ray_tri_watertight_v3().