orthonormalize_axes

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

Corrects xaxis and yaxis to be unit vectors and orthonormal.

Parameters:
xaxis: [float, float, float] | :class:`compas.geometry.Vector`

The first axis.

yaxis: [float, float, float] | :class:`compas.geometry.Vector`

The second axis.

Returns:
[float, float, float]

The corrected x axis.

[float, float, float]

The corrected y axis.

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