Matrix ApplyOperationWithScalar

From GECK
(Redirected from Mat ApplyOpWithScal)
Jump to: navigation, search


A function added by the ShowOff NVSE Plugin version 1.40.

Description

Returns the matrix affected by an operation by a scalar number; each matrix element is individually affected by this operation.

The operation to apply is specified via the operator string. See Notes for valid operator strings.

Syntax

[help]
(resultMatrix:array) Matrix ApplyOperationWithScalar matrix:array_var operator:string scalar:float 

Or:

(resultMatrix:array) Mat_ApplyOpWithScal matrix:array_var operator:string scalar:float 

Notes

  • Valid operator strings:
Operators
+
-
*
/

Examples

array_var aMatrix
array_var aRes

Example #1:

aMatrix = ar_List (ar_List 3, 4) (ar_List 5, 6)
aRes = Mat_ApplyOpWithScal aMatrixA "+" 2

By dumping aRes with Matrix_Dump, we get:

** Dumping Array 4 as Matrix **
   5.0000   6.0000
   7.0000   8.0000

Example #2:

aMatrix = ar_List (ar_List 3, 4) (ar_List 5, 6)
aRes = Mat_ApplyOpWithScal aMatrixA "/" 2

By dumping aRes with Matrix_Dump, we get:

** Dumping Array 10 as Matrix **
   1.5000   2.0000
   2.5000   3.0000

Example #3:

aMatrix = ar_List (ar_List 3, 4) (ar_List 5, 6)
aRes = Mat_ApplyOpWithScal aMatrixA "%" 2

aRes will be an invalid array, since "%" is not a supported operator.

Example #4:

aMatrix = ar_List (ar_List 3, 4) (ar_List 5, 6)
aRes = Mat_ApplyOpWithScal aMatrixA "-" 2

By dumping aRes with Matrix_Dump, we get:

** Dumping Array 19 as Matrix **
   1.0000   2.0000
   3.0000   4.0000

Example #5:

aMatrix = ar_List (ar_List 3, 4) (ar_List 5, 6)
aRes = Mat_ApplyOpWithScal aMatrixA "*" 2

By dumping aRes with Matrix_Dump, we get:

** Dumping Array 25 as Matrix **
    6.0000    8.0000
   10.0000   12.0000

See Also