10.1.4.6. Vector

class Musica.Geometry.Vector.HomogeneousVector2D(*args)[source]

Bases: Musica.Geometry.Vector.VectorAbc

2D Homogeneous Coordinate Vector

__data_type__

alias of float

__len__()[source]
_check_arguments(args)[source]
to_vector()[source]
w
class Musica.Geometry.Vector.NormalisedVector2D(array)[source]

Bases: Musica.Geometry.Vector.VectorAbc

2D Normalised Vector

__mul__(scale)[source]

Return a new vector equal to the self scaled by scale

class Musica.Geometry.Vector.Vector2D(*args)[source]

Bases: Musica.Geometry.Vector.VectorFloatMixin, Musica.Geometry.Vector.VectorArithmeticMixin, Musica.Geometry.Vector.Vector2DBase

2D Vector

Example of usage:

Vector(1, 3)
Vector((1, 3))
Vector([1, 3])
Vector(iterable)
Vector(vector)
classmethod from_angle(angle)[source]

Create the unitary vector (cos(angle), sin(angle)). The angle is in degree.

classmethod middle(p0, p1)[source]

Return the middle point.

rint()[source]
to_normalised()[source]

Return a normalised vector

class Musica.Geometry.Vector.Vector2DBase(*args)[source]

Bases: Musica.Geometry.Vector.VectorAbc

Example of usage:

Vector(1, 3)
Vector((1, 3))
Vector([1, 3])
Vector(iterable)
Vector(vector)
__len__()[source]
_check_arguments(args)[source]
transform(transformation)[source]
class Musica.Geometry.Vector.Vector2DInt(*args)[source]

Bases: Musica.Geometry.Vector.VectorIntMixin, Musica.Geometry.Vector.VectorArithmeticMixin, Musica.Geometry.Vector.Vector2DBase

Example of usage:

Vector(1, 3)
Vector((1, 3))
Vector([1, 3])
Vector(iterable)
Vector(vector)
class Musica.Geometry.Vector.VectorAbc(array_size, v_size)[source]

Bases: Musica.Geometry.Primitive.Primitive2D

__eq__(v1, v2)[source]

self == other

__getitem__(a_slice)[source]
__iter__()[source]
__len__()[source]
__nonzero__()[source]
__setitem__(index, value)[source]
clone()[source]

Return a copy of self

to_int_list()[source]
to_numpy()[source]
transform(transformation)[source]
__data_type__ = None
__hash__ = None
array
v
x
y
class Musica.Geometry.Vector.VectorArithmeticMixin[source]

Bases: object

__abs__()[source]

Return a new vector equal to abs of self

__add__(other)[source]

Return a new vector equal to the addition of self and other

__iadd__(other)[source]

Add other to self

__imul__(scale)[source]

Scale self by scale

__isub__(other)[source]

Return a new vector equal to the subtraction of self and other

__mul__(scale)[source]

Return a new vector equal to the self scaled by scale

__neg__()[source]

Return a new vector equal to the negation of self

__pos__()[source]

Return a new vector equal to self

__sub__(other)[source]

Return a new vector

anti_normal()[source]

Return a new vector equal to self rotated of 90 degree in the clockwise direction

cross(other)[source]

Return the cross product of self with other

dot(other)[source]

Return the dot product of self with other

magnitude_square()[source]

Return the square of the magnitude of the vector

normal()[source]

Return a new vector equal to self rotated of 90 degree in the counter clockwise direction

parity()[source]

Return a new vector equal to self rotated of 180 degree

class Musica.Geometry.Vector.VectorFloatMixin[source]

Bases: object

__data_type__

alias of float

__itruediv__(scale)[source]

Scale self by 1/scale

__truediv__(scale)[source]

Return a new vector equal to the self dvivided by scale

almost_equal(v1, v2, rtol=1e-05, atol=1e-08, equal_nan=False)[source]

self ~= other

bounding_box()[source]
cos_with(direction)[source]

Return the cosinus of self with direction

deviation_with(direction)[source]

Return the deviation of self with other

inverse_tan()[source]

Return the inverse tangent

is_orthogonal(other)[source]

Self is orthogonal with other

is_parallel(other)[source]

Self is parallel with other

magnitude()[source]

Return the magnitude of the vector

normalise()[source]

Normalise the vector

orientation()[source]

Return the orientation in degree

orientation_with(direction)[source]

Return the angle of self on direction

projection_on(direction)[source]

Return the projection of self on direction

rotate(angle, counter_clockwise=True)[source]

Return a new vector equal to self rotated of angle degree in the counter clockwise direction

sin_with(direction)[source]

Return the sinus of self with other

tan()[source]

Return the tangent

class Musica.Geometry.Vector.VectorIntMixin[source]

Bases: object

__data_type__

alias of int

bounding_box()[source]