LUA Scripting Examples 2
The context is:
$ROICIIndex contains index of ROI sampling point
$ROICIIndexMin = 1
$ROICIIndexMax = 7
$ROICIIndexMin <= $ROICIIndex <= $ROICIIndexMax
The following example shows how to use a rotation matrix to apply on the 3D vector of dataset profile M2 at sampling point of ROI:
vec = vector.new
mat = matrix.new
-- Define one time the 3D rotation matrix of 180 degrees
if $ROICIIndex == $ROICIIndexMin then
local a = mat(3, 'rotation', math.rad(180), 0) -- 0 = X rotation, 1 = Y rotation, 2 = Z rotation
_luacache['rot'] = a
end
-- Returns the result of rotation of the 3D vector of dataset profile M2 at sampling point of ROI
_luareturnvalue = _luacache['rot']*M2!Vector