# SRect

## Index

### Functions Index

| Function                                                                                                                                                                   |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>bool <a href="#contains"><strong>Contains</strong> </a>(SVector point)<br>bool <a href="#contains"><strong>Contains</strong> </a>(SVector point, bool allowInverse)</p> |
| <p>bool <a href="#overlaps"><strong>Overlaps</strong> </a>(SRect other)<br>bool <a href="#overlaps"><strong>Overlaps</strong> </a>(SRect other, bool allowInverse)</p>     |
| bool [**Equals** ](#equals)(SRect other)                                                                                                                                   |
| <p>string <a href="#tostring"><strong>ToString</strong> </a>(string format)<br>string <a href="#tostring"><strong>ToString</strong> </a>()</p>                             |
|                                                                                                                                                                            |
| **Static Functions**                                                                                                                                                       |
| static SRect [**New** ](#new)(float x, float y, float width, float height)                                                                                                 |

### Properties Index

| Property                                |
| --------------------------------------- |
| float [**X**](#x) `get` `set`           |
| float [**Y**](#y) `get` `set`           |
| float [**Width**](#width) `get` `set`   |
| float [**Height** ](#height)`get` `set` |
| SVector [**Position** ](#position)`get` |
| SVector [**Center** ](#center)`get`     |
| SVector [**Min** ](#min)`get`           |
| SVector [**Max** ](#max)`get`           |
| SVector [**Size** ](#size)`get`         |
| float [**XMin** ](#xmin)`get`           |
| float [**YMin** ](#ymin)`get`           |
| float [**XMax** ](#xmax)`get`           |
| float [**YMax** ](#ymax)`get`           |
| float [**Left** ](#left)`get`           |
| float [**Right** ](#right)`get`         |
| float [**Top** ](#top)`get`             |
| float [**Bottom** ](#bottom)`get`       |

## Functions

### Contains

bool **Contains** ([SVector](https://docs.sine.space/scripting/client-scripting-api-reference/types/svector) point)\
bool **Contains** ([SVector](https://docs.sine.space/scripting/client-scripting-api-reference/types/svector) point, bool allowInverse)

*Returns true if the x and y components of point is a point inside this rectangle. If allowInverse is present and true, the width and height of the Rect are allowed to take negative values (ie, the min value is greater than the max), and the test will still work.*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)

isContains = newRect.Contains(otherRect)
--or
isContains = newRect.Contains(otherRect , true)
```

{% endtab %}
{% endtabs %}

### Overlaps

bool **Overlaps** (SRect other)\
bool **Overlaps** (SRect other, bool allowInverse)

*Returns true if the other rectangle overlaps this one. If allowInverse is present and true, the widths and heights of the Rects are allowed to take negative values (ie, the min value is greater than the max), and the test will still work.*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)

isOverlapping = newRect.Overlaps(otherRect)
--or
isOverlapping = newRect.Overlaps(otherRect , true)
```

{% endtab %}
{% endtabs %}

### Equals

bool **Equals** (SRect other)

Returns true if the rectangles are the same.

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)
AreEqual = newRect.Equals(otherRect)
```

{% endtab %}
{% endtabs %}

### ToString

string **ToString** (string format)\
string **ToString** ()

Returns string for this Rect.

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)
AreEqual = newRect.Equals(otherRect)
```

{% endtab %}
{% endtabs %}

### New

static SRect **New** (float x, float y, float width, float height)

*Constructs a new SRect*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
```

{% endtab %}
{% endtabs %}

## Properties

### X

float **X** `get` `set`

*Property Description*

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
newRect.X = 10.0
```

{% endtab %}
{% endtabs %}

### Y

float **Y** `get` `set`

*Property Description*

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
newRect.Y = 10.0
```

{% endtab %}
{% endtabs %}

### Width

float **Width** `get` `set`

*Property Description*

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
newRect.Width = 10.0
```

{% endtab %}
{% endtabs %}

### Height

float **Height** `get` `set`

*Property Description*

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
newRect.Height = 10.0
```

{% endtab %}
{% endtabs %}

### Position

[SVector](https://docs.sine.space/scripting/client-scripting-api-reference/types/svector) **Position** `get`

*The X and Y position of the rectangle.*

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(50,50,150,150)
positionVector = newRect.position
```

{% endtab %}
{% endtabs %}

### Center

[SVector](https://docs.sine.space/scripting/client-scripting-api-reference/types/svector) **Center** `get`

*The position of the center of the rectangle.*

{% tabs %}
{% tab title="Lua" %}

```lua
newRect = Rect.New(50,50,150,150)
VectorCenter = newRect.Center
```

{% endtab %}
{% endtabs %}

### Min

[SVector](https://docs.sine.space/scripting/client-scripting-api-reference/types/svector) **Min** `get`

*The position of the minimum corner of the rectangle.*

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
vectorMin = newRect.Min
```

{% endtab %}
{% endtabs %}

### Max

[SVector](https://docs.sine.space/scripting/client-scripting-api-reference/types/svector) **Max** `get`

*The position of the maximum corner of the rectangle.*

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
vectorMax = newRect.Max
```

{% endtab %}
{% endtabs %}

### Size

[SVector](https://docs.sine.space/scripting/client-scripting-api-reference/types/svector) **Size** `get`

*The width and height of the rectangle.*

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
vectorSize = newRect.Size
```

{% endtab %}
{% endtabs %}

### XMin

float **XMin** `get`

*The minimum X coordinate of the rectangle.*

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
floatXMin = newRect.XMin
```

{% endtab %}
{% endtabs %}

### YMin

float **YMin** `get`

*The minimum Y coordinate of the rectangle.*

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
floatYMin = newRect.YMin
```

{% endtab %}
{% endtabs %}

### XMax

float **XMax** `get`

*The maximum Y coordinate of the rectangle.*

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
floatXMax = newRect.XMax
```

{% endtab %}
{% endtabs %}

### YMax

float **YMax** `get`

*The maximum Y coordinate of the rectangle.*

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
floatYMax = newRect.YMax
```

{% endtab %}
{% endtabs %}

### Left

float **Left** `get`

*Property Description*

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
floatLeft = newRect.Left
```

{% endtab %}
{% endtabs %}

### Right

float **Right** `get`

*Property Description*

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
floatRight = newRect.Right
```

{% endtab %}
{% endtabs %}

### Top

float **Top** `get`

*Property Description*

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
floatTop = newRect.Top
```

{% endtab %}
{% endtabs %}

### Bottom

float **Bottom** `get`

*Property Description*

{% tabs %}
{% tab title="Lua" %}

```lua
newRect=Rect.New(0,0,150,150)
floatBottom = newRect.Bottom
```

{% endtab %}
{% endtabs %}
