klampt.math.vectorops module¶

Allows treating tuples/lists as vectors

klampt.math.vectorops.add(*items)[source]

klampt.math.vectorops.cross(a, b)[source]

Cross product between a 3-vector or a 2-vector

klampt.math.vectorops.distance(a, b)[source]
klampt.math.vectorops.distanceSquared(a, b)[source]
klampt.math.vectorops.div(a, b)[source]

Elementwise division with another vector, or with a scalar.

klampt.math.vectorops.dot(a, b)[source]

Dot product.

klampt.math.vectorops.interpolate(a, b, u)[source]

Linear interpolation between a and b

klampt.math.vectorops.madd(a, b, c)[source]

Return a+c*b where a and b are vectors.

klampt.math.vectorops.maximum(a, b)[source]

Elementwise max

klampt.math.vectorops.minimum(a, b)[source]

Elementwise min

klampt.math.vectorops.mul(a, b)[source]

Multiply a vector either elementwise with another vector, or with a scalar.

klampt.math.vectorops.norm(a)[source]

L2 norm

klampt.math.vectorops.normSquared(a)[source]

Returns the norm of a, squared.

klampt.math.vectorops.norm_L1(a)[source]

L1 norm

klampt.math.vectorops.norm_L2(a)

L2 norm

klampt.math.vectorops.norm_Linf(a)[source]

L-infinity norm

klampt.math.vectorops.sub(a, b)[source]

Subtract a vector b from a, or subtract a scalar

klampt.math.vectorops.unit(a, epsilon=1e-05)[source]

Returns the unit vector in the direction a. If the norm of a is less than epsilon, a is left unchanged.