IndexedGradientSampler< T_ModeNone, T_ModeLinearKnot, T_ModeSmoothKnot, T_ModeBlend, T_ModeCubicKnot, T_ModeCubicBias > Class Template Reference

#include <gradientmath.h>

详细描述

template<UInt T_ModeNone = 0, UInt T_ModeLinearKnot = 1, UInt T_ModeSmoothKnot = 2, UInt T_ModeBlend = 3, UInt T_ModeCubicKnot = 4, UInt T_ModeCubicBias = 5>
class maxon::IndexedGradientSampler< T_ModeNone, T_ModeLinearKnot, T_ModeSmoothKnot, T_ModeBlend, T_ModeCubicKnot, T_ModeCubicBias >

This class implements the gradient blending operation for a series of knots with different interpolation modes. For performance reasons interpolation modes are handled as unsigned integers.

Template Parameters
T_ModeNone The index of constant / stairstep interpolation of 1 knot.
T_ModeLinearKnot The index of linear interpolation between 2 knots.
T_ModeSmoothKnot The index of the smooth-stepped linear interpolation between 2 knots.
T_ModeBlend The index of the box-stepped linear interpolation between 2 knots.
T_ModeCubicKnot The index of the cubic interpolation between 4 knots.
T_ModeCubicBias The index of the cubic interpolation between 2 knots.

公共成员函数

template<typename ValueType , typename SortedKnotsType , typename GetKnotValueFunc , typename GetKnotInterpolationModeFunc , typename GetKnotBiasFunc >
Result < ValueType >  Sample (typename SortedKnotsType::FloatType absolutePosition, const SortedKnotsType &sortedKnots, const GetKnotValueFunc &getKnotValue, const GetKnotInterpolationModeFunc &getKnotInterpolationMode, const GetKnotBiasFunc &getKnotBias) const

Static Private Member Functions

template<typename FloatType >
static FloatType  GetBiasedWeight (FloatType weight, FloatType bias)
template<typename FloatType >
static Vec4 < FloatType >  GetCubicBlendWeights (FloatType a)
template<typename ValueType , typename FloatType , typename IntType , typename GetKnotValueFunc >
static Result < ValueType >  BlendTwoValuesLinear ( IntType leftIndex, IntType rightIndex, FloatType weight, const GetKnotValueFunc &getKnotValue)
template<typename ValueType , typename FloatType , typename IntType , typename GetKnotValueFunc >
static Result < ValueType >  BlendTwoValuesCubic ( IntType leftIndex, IntType rightIndex, FloatType biasLeft, FloatType biasRight, const Vec4 < FloatType > &cubicWeights, const GetKnotValueFunc &getKnotValue)
template<typename ValueType , typename FloatType , typename IntType , typename GetKnotValueFunc >
static Result < ValueType >  BlendFourValues ( IntType index0, IntType index1, IntType index2, IntType index3, FloatType weight, const GetKnotValueFunc &getKnotValue)

Static Private Attributes

static const UInt   InterpolationNone
static const UInt   InterpolationLinearKnot
static const UInt   InterpolationSmoothKnot
static const UInt   InterpolationBlend
static const UInt   InterpolationCubicKnot
static const UInt   InterpolationCubicBias

成员函数文档编制

◆  GetBiasedWeight()

static FloatType GetBiasedWeight ( FloatType  weight ,
FloatType  bias  
)
static private

Applies the bias blending to a weight.

Template Parameters
FloatType The type of real number.
参数
[in] weight The original unbiased weight.
[in] bias The bias to apply.
返回
The biased weight.

◆  GetCubicBlendWeights()

static Vec4 <FloatType> GetCubicBlendWeights ( FloatType  a )
static private

Computes the four blend weights of cubic interpolation.

Template Parameters
FloatType The type of real number.
参数
[in] a The original weight.
返回
The cubic blend weights.

◆  BlendTwoValuesLinear()

static Result <ValueType> BlendTwoValuesLinear ( IntType   leftIndex ,
IntType   rightIndex ,
FloatType  weight ,
const GetKnotValueFunc &  getKnotValue  
)
static private

Linearly interpolates between two values.

Template Parameters
ValueType The type of value to interpolate.
FloatType The type of real number.
IntType The type of index.
GetKnotValueFunc The type of value sample function.
参数
[in] leftIndex The index of the left knot.
[in] rightIndex The index of the right knot.
[in] weight The interpolation weight between the 2 knots.
[in] getKnotValue The value sample function.
返回
The interpolated value on success.

◆  BlendTwoValuesCubic()

static Result <ValueType> BlendTwoValuesCubic ( IntType   leftIndex ,
IntType   rightIndex ,
FloatType  biasLeft ,
FloatType  biasRight ,
const Vec4 < FloatType > &  cubicWeights ,
const GetKnotValueFunc &  getKnotValue  
)
static private

Computes the biased cubic interpolation between two values.

Template Parameters
ValueType The type of value to interpolate.
FloatType The type of real number.
IntType The type of index.
GetKnotValueFunc The type of value sample function.
参数
[in] leftIndex The index of the left knot.
[in] rightIndex The index of the right knot.
[in] biasLeft The bias towards the left knot.
[in] biasRight The bias towards the right knot.
[in] cubicWeights The cubic weights.
[in] getKnotValue The value sample function.
返回
The interpolated value.

◆  BlendFourValues()

static Result <ValueType> BlendFourValues ( IntType   index0 ,
IntType   index1 ,
IntType   index2 ,
IntType   index3 ,
FloatType  weight ,
const GetKnotValueFunc &  getKnotValue  
)
static private

Computes the interpolation between four values.

Template Parameters
ValueType The type of value to interpolate.
FloatType The type of real number.
IntType The type of index.
GetKnotValueFunc The type of value sample function.
参数
[in] index0 The index of the first knot.
[in] index1 The index of the second knot.
[in] index2 The index of the third knot.
[in] index3 The index of the fourth knot.
[in] weight The interpolation weight.
[in] getKnotValue The value sample function.
返回
The interpolated value on success.

◆  Sample()

Result <ValueType> Sample ( typename SortedKnotsType::FloatType  absolutePosition ,
const SortedKnotsType &  sortedKnots ,
const GetKnotValueFunc &  getKnotValue ,
const GetKnotInterpolationModeFunc &  getKnotInterpolationMode ,
const GetKnotBiasFunc &  getKnotBias  
) const

Samples the gradient at the requested position.

Template Parameters
ValueType The type of value to sample.
SortedKnotsType The type of sorted knot sequence.
GetKnotValueFunc The type of value sample function.
GetKnotInterpolationModeFunc The type of interpolation mode sample function.
GetKnotBiasFunc The type of bias sample function.
参数
[in] absolutePosition The position to sample in the gradient.
[in] sortedKnots The sorted knot sequence.
[in] getKnotValue The value sample function..
[in] getKnotInterpolationMode The interpolation mode sample function.
[in] getKnotBias The bias sample function.
返回
The sampled value on success, error otherwise.

Member Data Documentation

◆  InterpolationNone

const UInt InterpolationNone
static private

◆  InterpolationLinearKnot

const UInt InterpolationLinearKnot
static private

◆  InterpolationSmoothKnot

const UInt InterpolationSmoothKnot
static private

◆  InterpolationBlend

const UInt InterpolationBlend
static private

◆  InterpolationCubicKnot

const UInt InterpolationCubicKnot
static private

◆  InterpolationCubicBias

const UInt InterpolationCubicBias
static private