points.geometry

Contains functions for manipulating Euclidian vectors.

points.geometry.round_vectors(func)[source]

This decorator takes a function which handles vectors, and makes it round its values once complete.

points.geometry.allow_degrees(func)[source]

This decorator takes a function which takes an angle, and makes it able to take it in degrees as well as in radians. The angle argument should be the first positional argument.

points.geometry.translate_vectors(translation, *vectors)[source]

Translates some vectors in space. The vectors will be changed in place.

Parameters:
  • translation (tuple) – The translation values.
  • *vectors – The vectors to translate.
Raises:
  • TypeError – if non-vectors are given.
  • ValueError – if the vectors given don’t match the dimension of the translation.
points.geometry.rotate_2d_vectors(*args, trim=None, **kwargs)[source]

Rotates 2 dimensional vectors.

Parameters:
  • angle (float) – The angle in radians.
  • point (iter) – A point to rotate around. The origin is the default.
  • trim (int) – if given, the vector values will be rounded to this number of decimal places at the end.
  • degrees (bool) – if True`, the angle given will be interpreted as being in degrees, not radians.
  • *vectors – The vectors to rotate.
Raises:
  • TypeError – if non-vectors are given.
  • ValueError – if the vectors given don’t match the dimension of the rotation.
points.geometry.rotate_3d_vectors(*args, trim=None, **kwargs)[source]

Rotates 3 dimensional vectors.

Parameters:
  • angle (float) – The angle in radians.
  • dimension (int) – 0, 1, or 2, depending on which axis to rotate around.
  • trim (int) – if given, the vector values will be rounded to this number of decimal places at the end.
  • degrees (bool) – if True`, the angle given will be interpreted as being in degrees, not radians.
  • *vectors – The vectors to rotate.
Raises:
  • TypeError – if non-vectors are given.
  • ValueError – if the vectors given don’t match the dimension of the rotation.
points.geometry.align_vectors_to_plane(*args, trim=None, **kwargs)[source]

Rotates some vectors around an axis, until a given vector lies in the plane of that axis with a second coaxis.

Parameters:
  • axis (int) – The axis to rotate around.
  • coaxis (int) – The second axis of the plane to land on.
  • vector (Vector) – The vector to align to the plane.
  • *vectors – The other vectors along for the ride.