TouchOSC

Next generation modular control surface
TouchOSC Manual

Script · Objects · Rectangle


A rectangle object native to TouchOSC. Will be returned and can be passed anywhere a rectangle is required.



Fields

 

rectangle.x

The x position of the rectangle.

 

rectangle.y

The y position of the rectangle.

 

rectangle.w

The width of the rectangle.

 

rectangle.h

The height of the rectangle.

 


Constructor Functions

 

function Rectangle()                               -- [1]
function Rectangle(rectangle)                      -- [2]
function Rectangle(number, number)                 -- [3]
function Rectangle(number, number, number, number) -- [4]

Returns a new rectangle object with

  1. position and size set to (0,0).
  2. position and size copied from another Rectangle object.
  3. position set to (0,0) and size set to the two numbers.
  4. position set to the first pair of numbers and size set to the second two numbers.

 


Functions

 

function contains(number, number)


-- example
local r = Rectangle(10,10,50,50)
local b = r:contains(20,20)
print(b)
> true

Tests if the point at position (number, number) is contained within the rectangle and returns a boolean value.


Cookie Policy

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