Difference between revisions of "IC Python API:RLPy RVector2"
From Reallusion Wiki!
Chuck (RL) (Talk | contribs) (Created page with "{{TOC}} {{Parent|IC_Python_API:RL_Python_Modules|Modules}} == Detailed Description == This class represent the 2D vector. ==Member Functions== ===AddWithWeight=== <syntaxhighl...") |
Chuck (RL) (Talk | contribs) m |
||
Line 1: | Line 1: | ||
{{TOC}} | {{TOC}} | ||
{{Parent|IC_Python_API:RL_Python_Modules|Modules}} | {{Parent|IC_Python_API:RL_Python_Modules|Modules}} | ||
− | == Detailed Description == | + | ==Detailed Description== |
This class represent the 2D vector. | This class represent the 2D vector. | ||
+ | ==Operators== | ||
+ | This class supports the following operators: | ||
+ | {| class="wikitable" | ||
+ | !Member | ||
+ | !Operation | ||
+ | !Syntax | ||
+ | !Description | ||
+ | !Example | ||
+ | |- | ||
+ | ! scope="row"|__add__ | ||
+ | |Addition | ||
+ | |a + b | ||
+ | |Adds values on either side of the operator. | ||
+ | |a + b = 30 | ||
+ | |- | ||
+ | ! scope="row"|__sub__ | ||
+ | |Subtraction | ||
+ | |a - b | ||
+ | |Subtracts right hand operand from left hand operand. | ||
+ | |a – b = -10 | ||
+ | |- | ||
+ | ! scope="row"|__mul__ | ||
+ | |Multiplication | ||
+ | |a * b | ||
+ | |Multiplies values on either side of the operator. | ||
+ | |a * b = 200 | ||
+ | |- | ||
+ | ! scope="row"|__truediv__ | ||
+ | |Division | ||
+ | |a / b | ||
+ | |Divides left hand operand by right hand operand. | ||
+ | |b / a = 2 | ||
+ | |- | ||
+ | ! scope="row"|__eq__ | ||
+ | |Equality | ||
+ | |a == b | ||
+ | |If the values of two operands are equal, then the condition becomes true. | ||
+ | |(a == b) is not true. | ||
+ | |- | ||
+ | ! scope="row"|__ne__ | ||
+ | |Difference | ||
+ | |a != b | ||
+ | |If values of two operands are not equal, then condition becomes true. | ||
+ | |(a != b) is true. | ||
+ | |- | ||
+ | ! scope="row"|__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. | ||
+ | |- | ||
+ | ! scope="row"|__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. | ||
+ | |- | ||
+ | ! scope="row"|__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. | ||
+ | |- | ||
+ | ! scope="row"|__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. | ||
+ | |- | ||
+ | ! scope="row"|__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 | ||
+ | |- | ||
+ | ! scope="row"|__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 | ||
+ | |- | ||
+ | ! scope="row"|__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 | ||
+ | |- | ||
+ | ! scope="row"|__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== | ==Member Functions== | ||
===AddWithWeight=== | ===AddWithWeight=== | ||
Line 11: | Line 104: | ||
====Parameters==== | ====Parameters==== | ||
<div style="margin-left: 2em;"> | <div style="margin-left: 2em;"> | ||
+ | |||
'''vSrc''' [IN] The vector to add - RLPy.RVector2 | '''vSrc''' [IN] The vector to add - RLPy.RVector2 | ||
+ | |||
'''fWeight''' [IN] The value of weight - float | '''fWeight''' [IN] The value of weight - float | ||
</div> | </div> | ||
Line 22: | Line 117: | ||
====Parameters==== | ====Parameters==== | ||
<div style="margin-left: 2em;"> | <div style="margin-left: 2em;"> | ||
+ | |||
'''vV''' [IN] The vector - RLPy.RVector2 | '''vV''' [IN] The vector - RLPy.RVector2 | ||
</div> | </div> | ||
====Returns==== | ====Returns==== | ||
− | <div style="margin-left: 2em;"> | + | <div style="margin-left: 2em;">The value of the dot production - float |
− | The value of the dot production - float | + | |
</div> | </div> | ||
----- | ----- | ||
Line 35: | Line 130: | ||
Inverse this vector. | Inverse this vector. | ||
====Returns==== | ====Returns==== | ||
− | <div style="margin-left: 2em;"> | + | <div style="margin-left: 2em;">The inversed vector - RLPy.RVector2 |
− | The inversed vector - RLPy.RVector2 | + | |
</div> | </div> | ||
----- | ----- | ||
Line 45: | Line 139: | ||
Length of the vector. | Length of the vector. | ||
====Returns==== | ====Returns==== | ||
− | <div style="margin-left: 2em;"> | + | <div style="margin-left: 2em;">The length of this vector - float |
− | The length of this vector - float | + | |
</div> | </div> | ||
----- | ----- | ||
Line 55: | Line 148: | ||
Normalizes this vector. | Normalizes this vector. | ||
====Returns==== | ====Returns==== | ||
− | <div style="margin-left: 2em;"> | + | <div style="margin-left: 2em;">The normalized vector - float |
− | The normalized vector - float | + | |
</div> | </div> | ||
----- | ----- | ||
Line 66: | Line 158: | ||
====Parameters==== | ====Parameters==== | ||
<div style="margin-left: 2em;"> | <div style="margin-left: 2em;"> | ||
+ | |||
'''tX''' [IN] the value of the x-axis - float | '''tX''' [IN] the value of the x-axis - float | ||
</div> | </div> | ||
Line 76: | Line 169: | ||
====Parameters==== | ====Parameters==== | ||
<div style="margin-left: 2em;"> | <div style="margin-left: 2em;"> | ||
+ | |||
'''tX''' [IN] the value of the y-axis. | '''tX''' [IN] the value of the y-axis. | ||
</div> | </div> | ||
Line 85: | Line 179: | ||
Squared length of the vector. | Squared length of the vector. | ||
====Returns==== | ====Returns==== | ||
− | <div style="margin-left: 2em;"> | + | <div style="margin-left: 2em;">The squared length of this vector - float |
− | The squared length of this vector - float | + | |
</div> | </div> | ||
----- | ----- | ||
Line 95: | Line 188: | ||
Get the value of the x-axis. | Get the value of the x-axis. | ||
====Returns==== | ====Returns==== | ||
− | <div style="margin-left: 2em;"> | + | <div style="margin-left: 2em;">The value of the x-axis - float |
− | The value of the x-axis - float | + | |
</div> | </div> | ||
----- | ----- | ||
Line 105: | Line 197: | ||
Get the value of the y-axis. | Get the value of the y-axis. | ||
====Returns==== | ====Returns==== | ||
− | <div style="margin-left: 2em;"> | + | <div style="margin-left: 2em;">The value of the y-axis - float |
− | The value of the y-axis - float | + | |
</div> | </div> |
Revision as of 03:05, 27 March 2019
- 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