bezierInterpolation: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "_{10,} " to "") |
Lou Montana (talk | contribs) m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments \("local" or "global"\)|Multiplayer Effects \("local" or "global"\)|Multiplayer Execution \("serv...) |
||
Line 1: | Line 1: | ||
{{Command | {{Command | ||
| arma3 | | arma3 | ||
|1.92 | |1.92 | ||
|arg= |Multiplayer Arguments = | |arg= |Multiplayer Arguments = | ||
Line 9: | Line 9: | ||
|eff= |Multiplayer Effects = | |eff= |Multiplayer Effects = | ||
|serverExec | |serverExec= | ||
|gr1= Math | |gr1= Math | ||
| Gets interpolated value based on [https://en.wikipedia.org/wiki/Bézier_curve Bézier curve] with given control points (progress value is 0...1 for a curve that starts at pos0 and finishes at posN) <br> | | Gets interpolated value based on [https://en.wikipedia.org/wiki/Bézier_curve Bézier curve] with given control points (progress value is 0...1 for a curve that starts at pos0 and finishes at posN) <br> | ||
[[Image:bezierInterpolation2.jpg|400px]] | [[Image:bezierInterpolation2.jpg|400px]] | ||
| progress [[bezierInterpolation]] <nowiki>[pos0, pos1,... posN]</nowiki> | | progress [[bezierInterpolation]] <nowiki>[pos0, pos1,... posN]</nowiki> | ||
|p1=progress: [[Number]] - interpolation value | |p1=progress: [[Number]] - interpolation value | ||
|p2=[pos0, pos1,... posN]: [[Array]] | |p2=[pos0, pos1,... posN]: [[Array]] | ||
|p3=pos: [[Array]] in format [[Position3D]] | |p3=pos: [[Array]] in format [[Position3D]] | ||
| [[Array]] - a single point position in format [[Position3D]] based on progress value | | [[Array]] - a single point position in format [[Position3D]] based on progress value | ||
|x1= Quick demonstration that spawns some spheres around player object:<code>[[for]] "_i" from 0 to 1 step 0.05 do { | |x1= Quick demonstration that spawns some spheres around player object:<code>[[for]] "_i" from 0 to 1 step 0.05 do { | ||
Line 32: | Line 32: | ||
[[player]] [[modelToWorld]] [0,0,4] | [[player]] [[modelToWorld]] [0,0,4] | ||
]),[],0,"CAN_COLLIDE"]; | ]),[],0,"CAN_COLLIDE"]; | ||
};</code> | };</code> | ||
|x2= Create a map marker curve from 4 control points with overlap (progress is -0.5...1.5 instead of 0...1):<code>[[private]] _controlPoints = [[100,-90],[200,-30],[150,60],[100,90]] [[apply]] { [[player]] [[getRelPos]] [[_x]] }; | |x2= Create a map marker curve from 4 control points with overlap (progress is -0.5...1.5 instead of 0...1):<code>[[private]] _controlPoints = [[100,-90],[200,-30],[150,60],[100,90]] [[apply]] { [[player]] [[getRelPos]] [[_x]] }; | ||
Line 46: | Line 46: | ||
_marker [[setMarkerTypeLocal]] "mil_dot"; | _marker [[setMarkerTypeLocal]] "mil_dot"; | ||
}; | }; | ||
[[openMap]] [[true]];</code> | [[openMap]] [[true]];</code> | ||
| [[linearConversion]], [[vectorLinearConversion]] | | [[linearConversion]], [[vectorLinearConversion]] | ||
}} | }} | ||
Revision as of 00:02, 18 January 2021
Description
- Description:
- Gets interpolated value based on Bézier curve with given control points (progress value is 0...1 for a curve that starts at pos0 and finishes at posN)
- Groups:
- Math
Syntax
- Syntax:
- progress bezierInterpolation [pos0, pos1,... posN]
- Parameters:
- progress: Number - interpolation value
- [pos0, pos1,... posN]: Array
- pos: Array in format Position3D
- Return Value:
- Array - a single point position in format Position3D based on progress value
Examples
- Example 1:
- Quick demonstration that spawns some spheres around player object:
for "_i" from 0 to 1 step 0.05 do { createVehicle ["Sign_Sphere10cm_F",(_i bezierInterpolation [ player modelToWorld [0,0,0], player modelToWorld [0,2,2], player modelToWorld [2,0,2], player modelToWorld [0,0,4] ]),[],0,"CAN_COLLIDE"]; };
- Example 2:
- Create a map marker curve from 4 control points with overlap (progress is -0.5...1.5 instead of 0...1):
private _controlPoints = [[100,-90],[200,-30],[150,60],[100,90]] apply { player getRelPos _x }; { private _marker = createMarkerLocal [str _x, _x]; _marker setMarkerTypeLocal "mil_objective"; _marker setMarkerTextLocal ("P" + str _forEachIndex); } forEach _controlPoints; for "_i" from -0.5 to 1.5 step 0.01 do { private _marker = createMarkerLocal [str _i, _i bezierInterpolation _controlPoints]; _marker setMarkerTypeLocal "mil_dot"; }; openMap true;
Additional Information
- See also:
- linearConversionvectorLinearConversion
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