Package lib :: Package geometry :: Module vectors
[hide private]
[frames] | no frames]

Module vectors

source code

Collection of functions for vector operations.

Functions [hide private]
 
random_unit_vector(vector)
Generate a random rotation axis.
source code
numpy float64 array
unit_vector_from_2point(point1, point2)
Generate the unit vector connecting point 1 to point 2.
source code
float
vector_angle(vector1, vector2, normal)
Calculate the directional angle between two N-dimensional vectors.
source code
Variables [hide private]
  __package__ = 'lib.geometry'

Imports: acos, cos, pi, sin, array, cross, dot, float64, norm, uniform


Function Details [hide private]

random_unit_vector(vector)

source code 

Generate a random rotation axis.

Uniform point sampling on a unit sphere is used to generate a random axis orientation.

Parameters:
  • vector (numpy 3D, rank-1 array) - The 3D rotation axis.

unit_vector_from_2point(point1, point2)

source code 

Generate the unit vector connecting point 1 to point 2.

Parameters:
  • point1 (list of float or numpy array) - The first point.
  • point2 (list of float or numpy array) - The second point.
Returns: numpy float64 array
The unit vector.

vector_angle(vector1, vector2, normal)

source code 

Calculate the directional angle between two N-dimensional vectors.

Parameters:
  • vector1 (numpy rank-1 array) - The first vector.
  • vector2 (numpy rank-1 array) - The second vector.
  • normal (numpy rank-1 array) - The vector defining the plane, to determine the sign.
Returns: float
The angle between -pi and pi.