# Difference between revisions of "Kray3 SDK/Arithmetic operations"

m (→Power) |
(→Comparision) |
||

Line 44: | Line 44: | ||

{{Kray3script | path=operators/vector_math.kray | runbutton=1}} | {{Kray3script | path=operators/vector_math.kray | runbutton=1}} | ||

− | |||

− | |||

− | |||

− | |||

− | |||

− | |||

− | |||

== Convert vector>axis == | == Convert vector>axis == | ||

<> converts vector to axis. | <> converts vector to axis. |

## Revision as of 15:57, 17 August 2012

## Contents

# 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" src="/pub/kray3_script/operators/operators1.kray"></include>{{#ifeq: 1|1|

|}}

## Subtract

You can perform **SUBTRACT** operation on doubles and vectors.

<include highlight="kray3" src="/pub/kray3_script/operators/operators2.kray"></include>{{#ifeq: 1|1|

|}}

## Unary -

Unary operations can also be performed on doubles and vectors.

<include highlight="kray3" src="/pub/kray3_script/operators/operators3.kray"></include>{{#ifeq: 1|1|

|}}

## Multiplication

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

<include highlight="kray3" src="/pub/kray3_script/operators/operators4.kray"></include>{{#ifeq: 1|1|

|}}

## Division

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

<include highlight="kray3" src="/pub/kray3_script/operators/operators5.kray"></include>{{#ifeq: 1|1|

|}}

## Modulo

Modulo (%) can be performed on doubles.

<include highlight="kray3" src="/pub/kray3_script/operators/operators6.kray"></include>{{#ifeq: 1|1|

|}}

## Power

^ to the power of operator works on doubles.

<include highlight="kray3" src="/pub/kray3_script/operators/operators7.kray"></include>{{#ifeq: 1|1|

|}}

## Standard math functions

Some standard math functions are also available:

<include highlight="kray3" src="/pub/kray3_script/operators/math.kray"></include>{{#ifeq: 1|1|

|}}

## Trigonometric functions

The following trigonometric functions are also available. Argument should be passed in radians.

<include highlight="kray3" src="/pub/kray3_script/operators/trigonometrc.kray"></include>{{#ifeq: 1|1|

|}}

## Vector Math

There are several built in functions available for vector math.

<include highlight="kray3" src="/pub/kray3_script/operators/vector_math.kray"></include>{{#ifeq: 1|1|

|}}

## Convert vector>axis

<> converts vector to axis.

<include highlight="kray3" src="/pub/kray3_script/operators/operators12.kray"></include>{{#ifeq: 1|1|

|}}

## Exponential operator

E - exponential operator.

Concatenation operators work on doubles, vectors, strings.

<include highlight="kray3" src="/pub/kray3_script/operators/operators13.kray"></include>{{#ifeq: 1|1|

|}}