# IC Python API:RLPy RVector2

From Reallusion Wiki!

Main article: Modules.

## Detailed Description

This class represent the 2D vector.

## Operators

This class supports the following operators:

Member | Operation | Syntax | Description | Example |
---|---|---|---|---|

__add__ | Addition | a + b | Adds values on either side of the operator. | a + b = 30 |

__sub__ | Subtraction | a - b | Subtracts right hand operand from left hand operand. | a – b = -10 |

__mul__ | Multiplication | a * b | Multiplies values on either side of the operator. | a * b = 200 |

__truediv__ | Division | a / b | Divides left hand operand by right hand operand. | b / a = 2 |

__eq__ | Equality | a == b | If the values of two operands are equal, then the condition becomes true. | (a == b) is not true. |

__ne__ | Difference | a != b | If values of two operands are not equal, then condition becomes true. | (a != b) is true. |

__gt__ | Greater Than | a > b | If the value of left operand is greater than the value of right operand, then condition becomes true. | (a > b) is not true. |

__lt__ | Less Than | a < b | If the value of left operand is less than the value of right operand, then condition becomes true. | (a < b) is true. |

__ge__ | Greater Than or Equal | a >= b | If the value of left operand is greater than or equal to the value of right operand, then condition becomes true. | (a >= b) is not true. |

__le__ | Less or Equal | a <= b | If the value of left operand is less than or equal to the value of right operand, then condition becomes true. | (a <= b) is true. |

__iadd__ | Addition (Inplace) | a += b | It adds right operand to the left operand and assign the result to left operand. | c += a is equivalent to c = c + a |

__isub__ | Subtraction (Inplace) | a -= b | It subtracts right operand from the left operand and assign the result to left operand. | c -= a is equivalent to c = c - a |

__imul__ | Multiply (Inplace) | a *= b | It multiplies right operand with the left operand and assign the result to left operand. | c *= a is equivalent to c = c * a |

__itruediv__ | Divide (Inplace) | a /= b | It divides left operand with the right operand and assign the result to left operand. | c /= a is equivalent to c = c / ac /= a is equivalent to c = c / a |

## Member Functions

### AddWithWeight

```
RLPy.RVector2.AddWithWeight ( self, vSrc, fWeight )
```

Add a vector with weight.

#### Parameters

**vSrc** [IN] The vector to add - RLPy.RVector2

**fWeight** [IN] The value of weight - float

### Dot

```
RLPy.RVector2.Dot ( self, vV )
```

Calculate dot production of the two vectors.

#### Parameters

**vV** [IN] The vector - RLPy.RVector2

#### Returns

The value of the dot production - float

### Inverse

```
RLPy.RVector2.Inverse ( self )
```

Inverse this vector.

#### Returns

The inversed vector - RLPy.RVector2

### Length

```
RLPy.RVector2.Length ( self )
```

Length of the vector.

#### Returns

The length of this vector - float

### Normalize

```
RLPy.RVector2.Normalize ( self )
```

Normalizes this vector.

#### Returns

The normalized vector - float

### SetX

```
RLPy.RVector2.SetX ( self, tX )
```

Set the value of the x-axis.

#### Parameters

**tX** [IN] the value of the x-axis - float

### SetY

```
RLPy.RVector2.SetY ( self, tY )
```

Set the value of the y-axis.

#### Parameters

**tX** [IN] the value of the y-axis.

### SquaredLength

```
RLPy.RVector2.SquaredLength ( self )
```

Squared length of the vector.

#### Returns

The squared length of this vector - float

### X

```
RLPy.RVector2.X ( self, args )
```

Get the value of the x-axis.

#### Returns

The value of the x-axis - float

### Y

```
RLPy.RVector2.Y ( self, args )
```

Get the value of the y-axis.

#### Returns

The value of the y-axis - float