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.tolerance import TOL
>>> xaxis = [1, 4, 5]
>>> yaxis = [1, 0, -2]
>>> xaxis, yaxis = orthonormalize_axes(xaxis, yaxis)
>>> TOL.is_allclose(xaxis, [0.1543, 0.6172, 0.7715], atol=0.001)
True
>>> TOL.is_allclose(yaxis, [0.6929, 0.4891, -0.5298], atol=0.001)
True