orthonormalize_axes

compas.geometry.orthonormalize_axes(xaxis, yaxis)[source]

Corrects xaxis and yaxis to be unit vectors and orthonormal.

Parameters
  • xaxis (Vector or list of float)

  • yaxis (Vector or list of float)

Returns

tuple ((xaxis, yaxis)) – The corrected axes.

Raises

ValueError – If xaxis and yaxis cannot span a plane.:

Examples

>>> from compas.geometry import allclose
>>> xaxis = [1, 4, 5]
>>> yaxis = [1, 0, -2]
>>> xaxis, yaxis = orthonormalize_axes(xaxis, yaxis)
>>> allclose(xaxis, [0.1543, 0.6172, 0.7715], tol=0.001)
True
>>> allclose(yaxis, [0.6929, 0.4891, -0.5298], tol=0.001)
True