Two dimensional immutable vector.
Parameters: |
|
---|
Compare vectors for approximate equality.
Parameter: | other (Vec2) – Vector being compared. |
---|---|
Returns: | True if distance between the vectors < EPSILON. |
Compute the smallest angle from this vector to another.
Parameter: | other (Vec2) – Vector to compute the angle to. |
---|---|
Returns: | Angle in degrees in the range (-180, 180]. |
Return type: | float |
Compute a vector in the same direction with a bounded length. If min_length <= self.length <= max_length then the original vector is returned.
Parameters: |
|
---|---|
Return type: | Vec2 |
Compute the cross product with another vector.
Parameter: | other (Vec2) – The vector with which to compute the cross product. |
---|---|
Returns: | The length of the cross-product vector |
Return type: | float |
Compute the distance to another point vector.
Parameter: | other (Vec2) – The point vector to which to compute the distance. |
---|---|
Return type: | float |
Compute the dot product with another vector.
Parameter: | other (Vec2) – The vector with which to compute the dot product. |
---|---|
Return type: | float |
Compute a vector by linear interpolation between this vector and another.
Parameters: |
|
---|---|
Return type: | Vec2 |
Return the vector scaled to unit length. If the vector is null, the null vector is returned.
Return type: | Vec2 |
---|
Compute the perpendicular vector.
Return type: | Vec2 |
---|
Create a vector from polar coordinates.
Parameters: |
|
---|---|
Return type: | Vec2 |
Compute the projection of another vector onto this one.
Parameter: | other (Vec2) – The vector to project. |
---|---|
Return type: | Vec2 |
Compute the reflection of this vector against another.
Parameter: | other (Vec2) – The vector to reflect against. |
---|---|
Return type: | Vec2 |
Compute the vector rotated by an angle.
Parameter: | angle (float) – The angle to rotate by, in degrees. |
---|---|
Return type: | Vec2 |
Compute the vector scaled to a given length. If the vector is null, the null vector is returned.
Parameter: | length (float) – The length of the vector returned, unless the vector is null. |
---|---|
Return type: | Vec2 |
Flag indicating if the vector is effectively zero-length.
Returns: | True if the vector length < EPSILON. |
---|