Table Of Contents

Related Topics

Vector

class to handle Vector operation.

For example, if you want to get length of a vector:

>>> from kivy.vector import Vector
>>> v = Vector(1, 5)
>>> print v.length()
class kivy.vector.Vector(*largs)

Bases: list

Represents a 2D vector.

angle(a)

Computes the angle between a and b

distance(to)

Returns the distance between two points.

distance2(to)

Returns the distance between two points squared.

dot(a)

Computes the dot product of a and b

static in_bbox(point, a, b)

Return a true if point is in bbox defined by a and b

length()

Returns the length of a vector

length2()

Returns the length of a vector squared.

static line_intersection(v1, v2, v3, v4)

Finds the intersection point between the lines (1)v1->v2 and (2)v3->v4 and returns it as a vector object

For math see: http://en.wikipedia.org/wiki/Line-line_intersection

normalize()

Returns a new vector that has the same direction as vec, but has a length of one.

rotate(angle)

Rotate the vector