Vector2 python

From WiCWiki

Jump to: navigation, search

Contents

Vector2

The Vector2 is a 2D vector representation. Most basic mathematical operations (add, subtract, multipy, divide ) will work as expected.

Members

X

Type
float
Description
The X component of the Vector2.


Y

Type
float
Description
The Y component of the Vector2.


X

Type
float
Description
The Z component is really an alias for the the Y component of the Vector2. This member is just created for semantic reasons. F ex screenspace = XY, mapspace = XZ.



Methods

Set

Syntax
import wic
wic.common.Vector2.Set( anXPart, anYPart )
Description
Sets the individual parts of the Vector2.
Exceptions
TypeError
The supplied arguments was of the wrong type
See also
#X
#Y



Length

Syntax
import wic
wic.common.Vector2.Length()
Description
Returns the length of the Vector2
Exceptions
-
See also
#Length2



Length2

Syntax
import wic
wic.common.Vector2.Length2()
Description
Returns the square length of the Vector2
Exceptions
-
See also
#Length



LeftOf

Syntax
import wic
wic.common.Vector2.LeftOf( aCompareVector )
Description
Returns true if aCompareVector is left of the Vector2
Exceptions
TypeError
aCompareVector isn't a Vector2
See also
#RightOf



RightOf

Syntax
import wic
wic.common.Vector2.RightOf( aCompareVector )
Description
Returns true if aCompareVector is right of the Vector2
Exceptions
TypeError
aCompareVector isn't a Vector2
See also
#LeftOf



Scale

Syntax
import wic
wic.common.Vector3.Scale( aFactor )
Description
-
Exceptions
TypeError
The factor wasn't a float
See also
-



Normalize

Syntax
import wic
wic.common.Vector2.Normalize()
Description
Normalizes the vector to length 1.0
Exceptions
-
See also
-



Dot

Syntax
import wic
wic.common.Vector2.Dot( aDotVector )
Description
Returns the Vector2 that is the dot product of the Vector2 and aDotVector
Exceptions
TypeError
aDotVector was not a Vector2
See also
-



Rotate

Syntax
import wic
wic.common.Vector2.Rotate( aRotation )
Description
Returns the Vector2 rotated by aRotation
Exceptions
TypeError
aRotation isn't a float
See also
-


Personal tools
User Created Content