Difference between revisions of "IC Python API:RLPy RVector2"
Chuck (RL) (Talk | contribs) m (→Operators) |
Chuck (RL) (Talk | contribs) m (→Constructor & Destructor) |
||
Line 24: | Line 24: | ||
|} | |} | ||
− | == | + | ==Constructors & Destructors== |
===__init__=== | ===__init__=== |
Revision as of 21:52, 19 February 2020
- Main article: Modules.
Description
2D Vector math class for float values. This class provides access to RLPy's internal vector math library allowing vectors to be handled effortlessly, and in a manner compatible with internal RLPy data structures. It also supports operators and vector related functions.
RVector2 also provides some constants for your convenience:
Constant | Description |
---|---|
RVector2.ZERO | 2D zero vector: (0, 0) |
RVector2.UNIT_X | 2D x unit vector: (1, 0) |
RVector2.UNIT_Y | 2D y unit vector: (0, 1) |
RVector2.UNIT_XY | 2D vector: (1, 1) |
Constructors & Destructors
__init__
Initialize a new RVector2 object as a 2D zero vector: (0, 0).
a = RLPy.RVector2()
__init__( self, x, y )
Initialize a new RVector2 object as a 2D vector: (x, y).
a = RLPy.RVector2(1, 2)
Parameters
x [IN] a numerical value for x coordinate - float or int
y [IN] a numerical value for y coordinate - float or int
__init__( self, args )
Initialize a new RVector2 object with another RVector2 object: args. This new RVector2 object has the same value as args.
a = RLPy.RVector2(1, 2)
b = RLPy.RVector2(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
Inverse
RLPy.RVector2.Inverse ( self )
Inverse this vector.
Returns
Length
RLPy.RVector2.Length ( self )
Length of the vector.
Returns
Normalize
RLPy.RVector2.Normalize ( self )
Normalizes this vector.
Returns
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
X
RLPy.RVector2.X ( self, args )
Get the value of the x-axis.
Returns
Y
RLPy.RVector2.Y ( self, args )
Get the value of the y-axis.