Difference between revisions of "Kray3 SDK/Arithmetic operations"

From Kray
Jump to: navigation, search
(Arithmetic operations)
m
Line 1: Line 1:
{{Category:Kray3 SDK}}
+
[[Category:Kray3 SDK]]
 
= Arithmetic operations =
 
= Arithmetic operations =
  

Revision as of 08:39, 16 August 2012

Arithmetic operations

Several standard arithmetic operations can be used inside Kray script.

Add

You can perform ADD operation on doubles, strings and vectors.

<include highlight="kray3" lines="3-9" src="http://www.kraytracing.com/pub/kray3_script/operators.kray" />

Run in KrayLive

Subtract

You can perform SUBTRACT operation on doubles and vectors.

<include highlight="kray3" lines="11-14" src="http://www.kraytracing.com/pub/kray3_script/operators.kray" />

Run in KrayLive

Unary -

Unary operations can also be performed on doubles and vectors.

<include highlight="kray3" lines="16-18" src="http://www.kraytracing.com/pub/kray3_script/operators.kray" />

Run in KrayLive

Division

Can be performed on double, axes/axes, vector/axes, vector/vector.

<include highlight="kray3" lines="27-34" src="http://www.kraytracing.com/pub/kray3_script/operators.kray" />

Run in KrayLive

Modulo

Modulo (%) can be performed on doubles.

<include highlight="kray3" lines="36-37" src="http://www.kraytracing.com/pub/kray3_script/operators.kray" />

Run in KrayLive

Power

^ to the power of operator works on doubles. <include highlight="kray3" lines="39-40" src="http://www.kraytracing.com/pub/kray3_script/operators.kray" />

Run in KrayLive

Comparision

You can use comparision operators < > <= >= on doubles, strings.

<include highlight="kray3" lines="43-47" src="http://www.kraytracing.com/pub/kray3_script/operators.kray" />

Run in KrayLive

You can use comparision operators == != on doubles, strings, vectors and axes.

<include highlight="kray3" lines="49-56" src="http://www.kraytracing.com/pub/kray3_script/operators.kray" />

Run in KrayLive

Logic operators

And (&) Or (|), Not (!) logic operators can be used on doubles.

<include highlight="kray3" lines="59-64" src="http://www.kraytracing.com/pub/kray3_script/operators.kray" />

Run in KrayLive

Concatenation

Concatenation operators work on doubles, vectors, strings. <include highlight="kray3" lines="67-70" src="http://www.kraytracing.com/pub/kray3_script/operators.kray" />

Run in KrayLive

Convert vector>axis

<> converts vector to axis.

Concatenation operators work on doubles, vectors, strings. <include highlight="kray3" lines="73-74" src="http://www.kraytracing.com/pub/kray3_script/operators.kray" />

Run in KrayLive

Exponential operator

E - exponential operator.

Concatenation operators work on doubles, vectors, strings. <include highlight="kray3" lines="77-80" src="http://www.kraytracing.com/pub/kray3_script/operators.kray" />

Run in KrayLive