disguise developers

Designer Plugins

Plugins for Disguise Designer software.

Vec2

A two-dimensional vector with x and y components.

Category: Utility

Base class: _BlipValue

Properties

maxComponent : float (Read-Only)

Maximum component of the vector.

minComponent : float (Read-Only)

The minimum component of the vector.

x : float

The x component of the vector.

UserName: X

y : float

The y component of the vector.

UserName: Y

Constructors

__init__(self)

__init__(self, other: Vec2)

Copy constructor for Vec2

__init__(self, v: Int2)

__init__(self, v: Vec)

__init__(self, _x: float, _y: float)

Methods

_initParams(self) -> Any

A serialisable tuple of the Int2 parameters

abs(self) -> Vec2

The absolute value of the vector.

Returns A new vector containing the component-wise absolute value of this vector.

angle(self) -> float

The angle of the vector, measured counter-clockwise from the positive x-axis.

Returns The angle of the vector in normalised coordinates.

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.

dot(self, v: Vec2) -> float

The dot product of two vectors.

Parameters:

Returns The dot product of this vector and the other vector.

length(self) -> float

The length of the vector in 2D space.

Returns The length of the vector.

normalise(self) -> Vec2

Normalises the vector to have a length of 1.

Returns The normalised vector.

restrict(self, min: Vec2, max: Vec2) -> Vec2

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

Parameters:

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

rotate(self, a: float) -> Vec2

Rotates the vector by a degrees anticlockwise.

Parameters:

Returns A new vector rotated by the specified angle.

round(self, f: float) -> Vec2

Rounds the components of this vector down to the nearest integer multiple of a given factor.

Parameters:

Returns A new vector with rounded components.

vmax(self, v: Vec2) -> Vec2

Component-wise maximum of two vectors.

Parameters:

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

vmin(self, v: Vec2) -> Vec2

Component-wise minimum of two vectors.

Parameters:

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

Special Methods

__add__(self, v: Vec2) -> Vec2

Adds two vectors.

Parameters:

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

__div__(self, s) -> Any

Divides the vector by a scalar value.

Parameters:

Returns A new vector that is the result of dividing the components of this vector by the given scalar value.

__eq__(self, v: Vec2) -> bool

Tests for equality between two vectors.

Parameters:

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

__getitem__(self, key) -> Any

Get an item from the Vec2 by index.

Parameters:

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

__len__(self) -> Any

The length of the Vec2

Returns Always returns 2

__mul__(self, s) -> Any

Multiplies the vector by a scalar value.

Parameters:

Returns A new vector that is the result of multiplying the components of this vector by the given scalar value.

__ne__(self, v: Vec2) -> bool

Tests for inequality between two vectors.

Parameters:

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

__neg__(self) -> Any

The negative of the Vec2

Returns The Vec2 with its x and y components negated

__rdiv__(self, other) -> Any

Divide another vector by this vector

Parameters:

Returns The element-wise division other/self

__repr__(self) -> Any

String representation of the Vec2

__rmul__(self, s) -> Any

Multiplies the vector by a scalar value.

Parameters:

Returns A new vector that is the result of multiplying the components of this vector by the given scalar value.

__str__(self) -> Any

String representation of the Vec2

__sub__(self, v: Vec2) -> Vec2

Subtracts another vector from this vector.

Parameters:

Returns The resulting vector after component-wise subtraction.