Blender V5.3
BKE_attribute_math.hh File Reference
#include "BLI_array.hh"
#include "BLI_color_types.hh"
#include "BLI_cpp_type.hh"
#include "BLI_generic_span.hh"
#include "BLI_math_axis_angle.hh"
#include "BLI_math_color.hh"
#include "BLI_math_quaternion.hh"
#include "BLI_math_vector.hh"
#include "BLI_math_vector_c.hh"
#include "BLI_offset_indices.hh"
#include "PRF_profile.hh"
#include "BKE_attribute.hh"

Go to the source code of this file.

Classes

class  blender::bke::attribute_math::SimpleMixer< T >
class  blender::bke::attribute_math::BooleanPropagationMixer
class  blender::bke::attribute_math::SimpleMixerWithAccumulationType< T, AccumulationT, ValueToAccumulate, AccumulateToValue >
class  blender::bke::attribute_math::ColorGeometry4fMixer
class  blender::bke::attribute_math::ColorGeometry4bMixer
class  blender::bke::attribute_math::float4x4Mixer
struct  blender::bke::attribute_math::DefaultMixerStruct< T >
struct  blender::bke::attribute_math::DefaultMixerStruct< float >
struct  blender::bke::attribute_math::DefaultMixerStruct< float2 >
struct  blender::bke::attribute_math::DefaultMixerStruct< float3 >
struct  blender::bke::attribute_math::DefaultMixerStruct< float4 >
struct  blender::bke::attribute_math::DefaultMixerStruct< ColorGeometry4f >
struct  blender::bke::attribute_math::DefaultMixerStruct< ColorGeometry4b >
struct  blender::bke::attribute_math::DefaultMixerStruct< float4x4 >
struct  blender::bke::attribute_math::DefaultMixerStruct< int >
struct  blender::bke::attribute_math::DefaultMixerStruct< short2 >
struct  blender::bke::attribute_math::DefaultMixerStruct< int2 >
struct  blender::bke::attribute_math::DefaultMixerStruct< bool >
struct  blender::bke::attribute_math::DefaultMixerStruct< int8_t >
struct  blender::bke::attribute_math::DefaultMixerStruct< math::Quaternion >
struct  blender::bke::attribute_math::DefaultPropagationMixerStruct< T >
struct  blender::bke::attribute_math::DefaultPropagationMixerStruct< bool >

Namespaces

namespace  blender
 BMesh Iterators.
namespace  blender::bke
namespace  blender::bke::attribute_math
namespace  blender::bke::attribute_math::detail

Functions

template<typename Fn>
void blender::bke::attribute_math::to_static_type (const CPPType &cpp_type, Fn &&fn)
template<typename Fn>
void blender::bke::attribute_math::to_static_type (const bke::AttrType data_type, Fn &&fn)
static double blender::bke::attribute_math::detail::int_to_double (const int &value)
static int blender::bke::attribute_math::detail::double_to_int (const double &value)
static double2 blender::bke::attribute_math::detail::int2_to_double2 (const int2 &value)
static int2 blender::bke::attribute_math::detail::double2_to_int2 (const double2 &value)
static float blender::bke::attribute_math::detail::int8_t_to_float (const int8_t &value)
static int8_t blender::bke::attribute_math::detail::float_to_int8_t (const float &value)
static float2 blender::bke::attribute_math::detail::short2_to_float2 (const short2 &value)
static short2 blender::bke::attribute_math::detail::float2_to_short2 (const float2 &value)
static float3 blender::bke::attribute_math::detail::quat_to_expmap (const math::Quaternion &value)
static math::Quaternion blender::bke::attribute_math::detail::expmap_to_quat (const float3 &value)
static float4 blender::bke::attribute_math::detail::byte_color_to_float4 (const ColorGeometry4b &value)
static ColorGeometry4b blender::bke::attribute_math::detail::float4_to_byte_color (const float4 &value)
Mix two values of the same type.

This is just basic linear interpolation.

template<typename T>
T blender::bke::attribute_math::mix2 (float factor, const T &a, const T &b)
template<>
bool blender::bke::attribute_math::mix2 (const float factor, const bool &a, const bool &b)
template<>
int8_t blender::bke::attribute_math::mix2 (const float factor, const int8_t &a, const int8_t &b)
template<>
int blender::bke::attribute_math::mix2 (const float factor, const int &a, const int &b)
template<>
short2 blender::bke::attribute_math::mix2 (const float factor, const short2 &a, const short2 &b)
template<>
int2 blender::bke::attribute_math::mix2 (const float factor, const int2 &a, const int2 &b)
template<>
float blender::bke::attribute_math::mix2 (const float factor, const float &a, const float &b)
template<>
float2 blender::bke::attribute_math::mix2 (const float factor, const float2 &a, const float2 &b)
template<>
float3 blender::bke::attribute_math::mix2 (const float factor, const float3 &a, const float3 &b)
template<>
float4 blender::bke::attribute_math::mix2 (const float factor, const float4 &a, const float4 &b)
template<>
ColorGeometry4f blender::bke::attribute_math::mix2 (const float factor, const ColorGeometry4f &a, const ColorGeometry4f &b)
template<>
ColorGeometry4b blender::bke::attribute_math::mix2 (const float factor, const ColorGeometry4b &a, const ColorGeometry4b &b)
Mix three values of the same type.

This is typically used to interpolate values within a triangle.

template<typename T>
T blender::bke::attribute_math::mix3 (const float3 &weights, const T &v0, const T &v1, const T &v2)
template<>
int8_t blender::bke::attribute_math::mix3 (const float3 &weights, const int8_t &v0, const int8_t &v1, const int8_t &v2)
template<>
bool blender::bke::attribute_math::mix3 (const float3 &weights, const bool &v0, const bool &v1, const bool &v2)
template<>
int blender::bke::attribute_math::mix3 (const float3 &weights, const int &v0, const int &v1, const int &v2)
template<>
short2 blender::bke::attribute_math::mix3 (const float3 &weights, const short2 &v0, const short2 &v1, const short2 &v2)
template<>
int2 blender::bke::attribute_math::mix3 (const float3 &weights, const int2 &v0, const int2 &v1, const int2 &v2)
template<>
float blender::bke::attribute_math::mix3 (const float3 &weights, const float &v0, const float &v1, const float &v2)
template<>
float2 blender::bke::attribute_math::mix3 (const float3 &weights, const float2 &v0, const float2 &v1, const float2 &v2)
template<>
float3 blender::bke::attribute_math::mix3 (const float3 &weights, const float3 &v0, const float3 &v1, const float3 &v2)
template<>
float4 blender::bke::attribute_math::mix3 (const float3 &weights, const float4 &v0, const float4 &v1, const float4 &v2)
template<>
ColorGeometry4f blender::bke::attribute_math::mix3 (const float3 &weights, const ColorGeometry4f &v0, const ColorGeometry4f &v1, const ColorGeometry4f &v2)
template<>
ColorGeometry4b blender::bke::attribute_math::mix3 (const float3 &weights, const ColorGeometry4b &v0, const ColorGeometry4b &v1, const ColorGeometry4b &v2)
Mix four values of the same type.
template<typename T>
T blender::bke::attribute_math::mix4 (const float4 &weights, const T &v0, const T &v1, const T &v2, const T &v3)
template<>
int8_t blender::bke::attribute_math::mix4 (const float4 &weights, const int8_t &v0, const int8_t &v1, const int8_t &v2, const int8_t &v3)
template<>
bool blender::bke::attribute_math::mix4 (const float4 &weights, const bool &v0, const bool &v1, const bool &v2, const bool &v3)
template<>
int blender::bke::attribute_math::mix4 (const float4 &weights, const int &v0, const int &v1, const int &v2, const int &v3)
template<>
short2 blender::bke::attribute_math::mix4 (const float4 &weights, const short2 &v0, const short2 &v1, const short2 &v2, const short2 &v3)
template<>
int2 blender::bke::attribute_math::mix4 (const float4 &weights, const int2 &v0, const int2 &v1, const int2 &v2, const int2 &v3)
template<>
float blender::bke::attribute_math::mix4 (const float4 &weights, const float &v0, const float &v1, const float &v2, const float &v3)
template<>
float2 blender::bke::attribute_math::mix4 (const float4 &weights, const float2 &v0, const float2 &v1, const float2 &v2, const float2 &v3)
template<>
float3 blender::bke::attribute_math::mix4 (const float4 &weights, const float3 &v0, const float3 &v1, const float3 &v2, const float3 &v3)
template<>
float4 blender::bke::attribute_math::mix4 (const float4 &weights, const float4 &v0, const float4 &v1, const float4 &v2, const float4 &v3)
template<>
ColorGeometry4f blender::bke::attribute_math::mix4 (const float4 &weights, const ColorGeometry4f &v0, const ColorGeometry4f &v1, const ColorGeometry4f &v2, const ColorGeometry4f &v3)
template<>
ColorGeometry4b blender::bke::attribute_math::mix4 (const float4 &weights, const ColorGeometry4b &v0, const ColorGeometry4b &v1, const ColorGeometry4b &v2, const ColorGeometry4b &v3)
Generic Array Utils Implementations

Extra implementations of functions from #BLI_array_utils.hh for all attribute types, used to avoid templating the same logic for each type in many places.

void blender::bke::attribute_math::shift_left (GMutableSpan data, int src_begin, int src_end, int dst_begin)
void blender::bke::attribute_math::shift_right (GMutableSpan data, int src_begin, int src_end, int dst_begin)
void blender::bke::attribute_math::gather (GSpan src, Span< int > map, GMutableSpan dst)
void blender::bke::attribute_math::gather (const GVArray &src, Span< int > map, GMutableSpan dst)
void blender::bke::attribute_math::gather (GSpan src, Span< int > map, const IndexMask &dst_mask, GMutableSpan dst)
void blender::bke::attribute_math::gather (const GVArray &src, Span< int > map, const IndexMask &dst_mask, GMutableSpan dst)
void blender::bke::attribute_math::gather_group_to_group (OffsetIndices< int > src_offsets, OffsetIndices< int > dst_offsets, const IndexMask &selection, GSpan src, GMutableSpan dst)
void blender::bke::attribute_math::gather_to_groups (OffsetIndices< int > dst_offsets, const IndexMask &src_selection, GSpan src, GMutableSpan dst)
void blender::bke::attribute_math::gather_ranges_to_groups (Span< IndexRange > src_ranges, OffsetIndices< int > dst_offsets, GSpan src, GMutableSpan dst)

Mix a dynamic amount of values with weights for many elements.

This section provides an abstraction for "mixers". The abstraction encapsulates details about how different types should be mixed. Usually #DefaultMixer<T> should be used to get a mixer for a specific type.

template<typename T>
using blender::bke::attribute_math::DefaultPropagationMixer = typename DefaultPropagationMixerStruct<T>::type
template<typename T>
using blender::bke::attribute_math::DefaultMixer = typename DefaultMixerStruct<T>::type
template<typename T>
T blender::bke::attribute_math::mix_indices (const Span< T > src, const Span< int > indices)
template<typename T, typename ToAccumFn, typename ToFinalFn>
T blender::bke::attribute_math::mix_indices (const Span< T > src, const Span< int > indices, const ToAccumFn &to_accum_fn, const ToFinalFn &to_final_fn)
bool blender::bke::attribute_math::mix_indices (const Span< bool > src, const Span< int > indices)
int blender::bke::attribute_math::mix_indices (const Span< int > src, const Span< int > indices)
int2 blender::bke::attribute_math::mix_indices (const Span< int2 > src, const Span< int > indices)
int8_t blender::bke::attribute_math::mix_indices (const Span< int8_t > src, const Span< int > indices)
short2 blender::bke::attribute_math::mix_indices (const Span< short2 > src, const Span< int > indices)
math::Quaternion blender::bke::attribute_math::mix_indices (const Span< math::Quaternion > src, const Span< int > indices)
ColorGeometry4b blender::bke::attribute_math::mix_indices (const Span< ColorGeometry4b > src, const Span< int > indices)
ColorGeometry4f blender::bke::attribute_math::mix_indices (const Span< ColorGeometry4f > src, const Span< int > indices)
float4x4 blender::bke::attribute_math::mix_indices (Span< float4x4 > src, Span< int > indices)
template<typename T>
T blender::bke::attribute_math::mix_indices (const Span< T > src, const Span< int > indices, const Span< float > weights)
template<typename T, typename ToAccumFn, typename ToFinalFn>
T blender::bke::attribute_math::mix_indices (const Span< T > src, const Span< int > indices, const Span< float > weights, const ToAccumFn &to_accum_fn, const ToFinalFn &to_final_fn)
bool blender::bke::attribute_math::mix_indices (const Span< bool > src, const Span< int > indices, const Span< float > weights)
int blender::bke::attribute_math::mix_indices (const Span< int > src, const Span< int > indices, const Span< float > weights)
int2 blender::bke::attribute_math::mix_indices (const Span< int2 > src, const Span< int > indices, const Span< float > weights)
int8_t blender::bke::attribute_math::mix_indices (const Span< int8_t > src, const Span< int > indices, const Span< float > weights)
short2 blender::bke::attribute_math::mix_indices (const Span< short2 > src, const Span< int > indices, const Span< float > weights)
math::Quaternion blender::bke::attribute_math::mix_indices (const Span< math::Quaternion > src, const Span< int > indices, const Span< float > weights)
ColorGeometry4b blender::bke::attribute_math::mix_indices (const Span< ColorGeometry4b > src, const Span< int > indices, const Span< float > weights)
ColorGeometry4f blender::bke::attribute_math::mix_indices (const Span< ColorGeometry4f > src, const Span< int > indices, const Span< float > weights)
float4x4 blender::bke::attribute_math::mix_indices (Span< float4x4 > src, Span< int > indices, Span< float > weights)
void blender::bke::attribute_math::mix_groups (GSpan src, OffsetIndices< int > groups, Span< int > all_indices, std::optional< Span< float > > all_weights, GMutableSpan dst)
void blender::bke::attribute_math::mix_groups (GSpan src, OffsetIndices< int > groups, Span< int > all_indices, std::optional< Span< float > > all_weights, const IndexMask &dst_mask, GMutableSpan dst)
void blender::bke::attribute_math::mix_groups (GSpan src, OffsetIndices< int > groups, Span< int > all_indices, GMutableSpan dst)
void blender::bke::attribute_math::mix_groups (GSpan src, GroupedSpan< int > indices, GMutableSpan dst)