BIS fnc smoothStep: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (template:command argument fix)
m (Some wiki formatting)
 
(27 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Function|= Comments
{{RV|type=function
____________________________________________________________________________________________


| arma3 |= Game name
|game1= arma3
|version1= 1.76


|1.76|= Game version
|gr1= Interpolation
____________________________________________________________________________________________


| Interpolates between 0 and 1 with smoothing at the limits. Formula is {{Inline code|n² × (3 - 2n)}}. |DESCRIPTION=
|descr= Interpolates between 0 and 1 with smoothing at the limits. Formula is {{hl|n<sup>2</sup> &times; (3 - 2n)}}.
____________________________________________________________________________________________


| number call [[BIS_fnc_smoothStep]] |SYNTAX=
|s1= number call [[BIS_fnc_smoothStep]]


|p1= number: [[Number]] - a number in range 0..1. A value not in range will be [[floor|floored]] to 0 or [[ceil|ceiled]] to 1 |PARAMETER1=
|p1= number: [[Number]] - a number in range 0..1. A value not in range will be [[floor|floored]] to 0 or [[ceil|ceiled]] to 1


| [[Number]] - interpolation result |RETURNVALUE=
|r1= [[Number]] - interpolation result
____________________________________________________________________________________________


|x1= <code>_smoothedStep = 0.75 [[call]] [[BIS_fnc_smoothStep]];</code> |PARAMETER1=
|x1= <sqf>private _smoothedStep = 0.75 call BIS_fnc_smoothStep;</sqf>


|x2= <code>[0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0] [[apply]] { [[_x]] [[call]] [[BIS_fnc_smoothStep]]; };
|x2= <sqf>
{{codecomment|// returns [0, 0.028, 0.104, 0.216, 0.352, 0.5, 0.648, 0.784, 0.896, 0.972, 1]}}</code> |PARAMETER2=
[0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0] apply { _x call BIS_fnc_smoothStep; };
____________________________________________________________________________________________
// returns [0, 0.028, 0.104, 0.216, 0.352, 0.5, 0.648, 0.784, 0.896, 0.972, 1]
</sqf>


| |SEEALSO=
|seealso= [[BIS_fnc_lerp]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Misc|{{uc:smoothStep}}]]
[[Category:Functions|{{uc:smoothStep}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:smoothStep}}]]

Latest revision as of 11:50, 27 July 2022

Hover & click on the images for description

Description

Description:
Interpolates between 0 and 1 with smoothing at the limits. Formula is n2 × (3 - 2n).
Execution:
call
Groups:
Interpolation

Syntax

Syntax:
number call BIS_fnc_smoothStep
Parameters:
number: Number - a number in range 0..1. A value not in range will be floored to 0 or ceiled to 1
Return Value:
Number - interpolation result

Examples

Example 1:
private _smoothedStep = 0.75 call BIS_fnc_smoothStep;
Example 2:
[0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0] apply { _x call BIS_fnc_smoothStep; }; // returns [0, 0.028, 0.104, 0.216, 0.352, 0.5, 0.648, 0.784, 0.896, 0.972, 1]

Additional Information

See also:
BIS_fnc_lerp

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note