TouchOSC

Next generation modular control surface
TouchOSC Manual

Script · Objects · Vectors


TouchOSC provides 2,3 and 4 component vector types as Vec2 Vec3 Vec4 objects.



Fields

vec2.x
vec3.x
vec4.x

The x component of the vector.

vec2.y
vec3.y
vec4.y

The y component of the vector.

vec3.z
vec4.z

The z component of the vector.

vec4.w

The w component of the vector.

 


Constructor Functions

Vec2()                                -- [1]
Vec2(vec2)                            -- [2]
Vec2(number)                          -- [3]
Vec2(number, number)                  -- [4]

Vec3()                                -- [1]
Vec3(vec3)                            -- [2]
Vec3(number)                          -- [3]
Vec3(number, number, number)          -- [4]

Vec4()                                -- [1]
Vec4(vec4)                            -- [2]
Vec4(number)                          -- [3]
Vec4(number, number, number, number)  -- [4]

Returns a new vector with

  1. all components initialized with 0.0.
  2. all components copied from another vector object.
  3. all components initialized with number.
  4. each component initialized with the numbers provided.

 


Functions

vec:length()

Returns the length of the vector

vec:normalize()

Returns a new vector that is the normalized vector

 


Operators

-- multiplication
vector * vector
vector * number

-- division
vector / vector
vector / number

-- addition
vector + vector
vector + number

-- subtraction
vector - vector
vector - number

All operators operate component-wise and return a new vector object.


hexler.net uses cookies to deliver website content. By continuing without changing your preferences, you agree to our use of cookies.