10.1.4.17. Vector¶
Module to implement vector.
Example of usage:
v = Vector2D(10, 20)
v = Vector2D((10, 20))
v = Vector2D([10, 20])
v = Vector2D(iterable)
v = Vector2D(v)
v.x
v.y
# array interface
v[0], v[1]
iter(v)
-v
v + v
v += v
v - v
v -= v
v * 2
2 * v
v *= 2
v / 2
v /= 2
-
class
Patro.GeometryEngine.Vector.
HomogeneousVector2D
(vector)[source]¶ Bases:
Patro.GeometryEngine.Vector.Vector2D
2D Homogeneous Coordinate Vector
-
v
¶
-
w
¶
-
-
class
Patro.GeometryEngine.Vector.
NormalisedVector2D
(*args)[source]¶ Bases:
Patro.GeometryEngine.Vector.Vector2DFloatBase
2D Normalised Vector
-
class
Patro.GeometryEngine.Vector.
Vector2D
(*args)[source]¶ Bases:
Patro.GeometryEngine.Vector.Vector2DFloatBase
2D Vector
-
static
from_angle
(angle)[source]¶ Create the unitary vector (cos(angle), sin(angle)). angle is in degree.
-
static
from_ellipse
(radius_x, radius_y, angle)[source]¶ Create the vector (radius_x*cos(angle), radius_y*sin(angle)). angle is in degree.
-
static
-
class
Patro.GeometryEngine.Vector.
Vector2DBase
(*args)[source]¶ Bases:
Patro.GeometryEngine.Primitive.Primitive
,Patro.GeometryEngine.Primitive.Primitive2DMixin
-
__data_type__
= None¶
-
__hash__
= None¶
-
v
¶
-
x
¶
-
y
¶
-
-
class
Patro.GeometryEngine.Vector.
Vector2DFloatBase
(*args)[source]¶ Bases:
Patro.GeometryEngine.Vector.Vector2DBase
-
__data_type__
¶ alias of
builtins.float
-
anti_normal
¶ Return a new vector equal to self rotated of 90 degree in the clockwise direction
-
bounding_box
¶ Bounding box of the primitive.
Return None if primitive is infinite.
-
inverse_tan
¶ Return the inverse tangent
-
magnitude
¶ Return the magnitude of the vector
-
magnitude_square
¶ Return the square of the magnitude of the vector
-
normal
¶ Return a new vector equal to self rotated of 90 degree in the counter clockwise direction
-
orientation
¶ Return the orientation in degree
-
orientation_with
(direction)¶ Return the angle of self on direction
-
parity
¶ Return a new vector equal to self rotated of 180 degree
-
permute
¶ Return a new vector where x and y are permuted.
-
perp_dot
(other)¶ Return the cross product of self with other
-
rotate
(angle, counter_clockwise=True)[source]¶ Return a new vector equal to self rotated of angle degree in the counter clockwise direction
-
tan
¶ Return the tangent
-
-
class
Patro.GeometryEngine.Vector.
Vector2DInt
(*args)[source]¶ Bases:
Patro.GeometryEngine.Vector.Vector2DBase
-
__data_type__
¶ alias of
builtins.int
-
bounding_box
¶ Bounding box of the primitive.
Return None if primitive is infinite.
-