---
title: "Int2"
description: "API documentation for Int2"
url: https://developer.disguise.one/python-api/docs/int2/
---

# Int2

A two-dimensional integer vector with x and y components

See also: [Utility Guide](/plugins/guides/utility)

Base class: _\_BlipValue_

## Properties

#### **maxComponent** : _int_ _(Read-Only)_

The maximum component of the vector.

#### **minComponent** : _int_ _(Read-Only)_

The minimum component of the vector.

#### **x** : _int_

The x component of the vector.

_UserName: X_

#### **y** : _int_

The y component of the vector.

_UserName: Y_

## Constructors

#### **\_\_init\_\_**(self)

#### **\_\_init\_\_**(self, other: _[Int2](/python-api/docs/int2#int2)_)

Copy constructor for Int2

#### **\_\_init\_\_**(self, v: _[Vec2](/python-api/docs/vec2#vec2)_)

#### **\_\_init\_\_**(self, x\_: _int_, y\_: _int_)

## Methods

#### **\_initParams**(self) -> _Any_

A serialisable tuple of the Int2 parameters

#### **anyLargerThan**(self, v: _[Int2](/python-api/docs/int2#int2) | [Vec2](/python-api/docs/vec2#vec2)_) -> _bool_

Checks whether any component of this vector is larger than the corresponding component of another vector.

**Parameters**:

-   v: The other vector to compare with.

**Returns** True if any component of this vector is larger than the corresponding component of the other vector.

#### **anySmallerThan**(self, v: _[Int2](/python-api/docs/int2#int2) | [Vec2](/python-api/docs/vec2#vec2)_) -> _bool_

Checks if any component of this vector is smaller than the corresponding component of another vector.

**Parameters**:

-   v: The other vector to compare with.

**Returns** True if any component of this vector is smaller than the corresponding component of the other vector.

#### **area**(self) -> _int_

The area of the vector if its components are treated as the sides of a rectangle.

**Returns** The area of the vector, defined as the absolute value of x \* y.

#### **aspect**(self) -> _float_

The aspect ratio of the vector, defined as the ratio of the x component to the y component.

**Returns** The aspect ratio of the vector.

#### **length**(self) -> _float_

The length of the vector in 2D space.

**Returns** The length of the vector.

#### **restrict**(self, a: _[Int2](/python-api/docs/int2#int2) | [Vec2](/python-api/docs/vec2#vec2)_, b: _[Int2](/python-api/docs/int2#int2) | [Vec2](/python-api/docs/vec2#vec2)_) -> _[Int2](/python-api/docs/int2#int2)_

Restricts the vector to be within a minimum and maximum range.

**Parameters**:

-   a: A vector of minimum values for each component.
-   b: A vector of maximum values for each component.

**Returns** A new vector with components restricted to the minimum and maximum range.

#### **vmax**(self, o: _[Int2](/python-api/docs/int2#int2) | [Vec2](/python-api/docs/vec2#vec2)_) -> _[Int2](/python-api/docs/int2#int2)_

Component-wise maximum of two vectors.

**Parameters**:

-   o: The other vector to compare with.

**Returns** A new vector containing the component-wise maximum of this and the other vector.

#### **vmin**(self, o: _[Int2](/python-api/docs/int2#int2) | [Vec2](/python-api/docs/vec2#vec2)_) -> _[Int2](/python-api/docs/int2#int2)_

Component-wise minimum of two vectors.

**Parameters**:

-   o: The other vector to compare with.

**Returns** A new vector containing the component-wise minimum of this and the other vector.

## Special Methods

#### **\_\_add\_\_**(self, v: _[Int2](/python-api/docs/int2#int2) | [Vec2](/python-api/docs/vec2#vec2)_) -> _[Int2](/python-api/docs/int2#int2)_

Adds two vectors.

**Parameters**:

-   v: The vector to add to this one.

**Returns** The component-wise sum of this and the input vector.

#### **\_\_eq\_\_**(self, other: _[Int2](/python-api/docs/int2#int2) | [Vec2](/python-api/docs/vec2#vec2)_) -> _bool_

Tests for equality between two vectors.

**Parameters**:

-   other: The vector to compare with.

**Returns** True if both components of the vectors are equal, false otherwise.

#### **\_\_getitem\_\_**(self, key) -> _Any_

Get an item from the Int2 by index.

**Parameters**:

-   key: The index of the desired item. Must be 0 or 1

**Returns** The x element if the index is 0, the y element if the index is 1

#### **\_\_len\_\_**(self) -> _Any_

The length of the Int2

**Returns** Always returns 2

#### **\_\_mul\_\_**(self, d) -> _Any_

Multiplies two vectors component-wise.

**Parameters**:

-   v: The other vector to multiply with.

**Returns** The component-wise product of the two vectors.

#### **\_\_ne\_\_**(self, other: _[Int2](/python-api/docs/int2#int2) | [Vec2](/python-api/docs/vec2#vec2)_) -> _bool_

Tests for inequality between two vectors.

**Parameters**:

-   other: The other vector to compare with.

**Returns** True if either of the components of the vectors are not equal, false otherwise.

#### **\_\_neg\_\_**(self) -> _Any_

The negative of the Int2

**Returns** The Int2 with its x and y components negated

#### **\_\_repr\_\_**(self) -> _Any_

String representation of the Int2

#### **\_\_rmul\_\_**(self, d) -> _Any_

Multiplies two vectors component-wise.

**Parameters**:

-   v: The other vector to multiply with.

**Returns** The component-wise product of the two vectors.

#### **\_\_str\_\_**(self) -> _Any_

String representation of the Int2

#### **\_\_sub\_\_**(self, v: _[Int2](/python-api/docs/int2#int2) | [Vec2](/python-api/docs/vec2#vec2)_) -> _[Int2](/python-api/docs/int2#int2)_

Subtracts another vector from this vector.

**Parameters**:

-   v: The vector to subtract from this vector.

**Returns** The resulting vector after component-wise subtraction.
