移動先: 概要 戻り値 MEL 例.

概要

constrainValue float float float float

constrainValue は 「元に戻す」が可能、「照会」が不可能「編集」が不可能 です。

与えられた開始/終了値の範囲の 3 番目の引数の整数乗数を、float 値で返します。

最初の引数は、範囲の開始値を表します。
2 番目の引数は、範囲の終了値を表します。
3 番目の引数は、コンストレインする値を計算するために用いる乗数を表します。
最後の 4 番目の引数はコンストレインされた値を表します。

戻り値

float

MEL 例

// All the the examples use a range from 3.0 to 9.0, and a by value of 1.5.
//
// 0.0 is less than the start value (3.0), so the value is clamped to 3.0.
//
constrainValue 3.0 9.0 1.5 0.0;
// Result: 3 //

// 12.0 is greater than the end value (9.0), so it gets clamped to 9.0
//
constrainValue 3.0 9.0 1.5 12.0;
// Result: 9 //

// For a value of 8.0, The answer is ( 3.0 + ( 1.5 * 3 ) ) which is to say
// it is ( start + ( by * n ) ) where n is an integer.
//
constrainValue 3.0 9.0 1.5 8.0;
// Result: 7.5 //

// The answer is ( 3.0 + ( 1.5 * 2 ) ), which is less than 7.0
//
constrainValue 3.0 9.0 1.5 7.0;
// Result: 6 //