MCPcopy Create free account
hub / github.com/InternRobotics/EmbodiedScan / align_vector_to_another

Function align_vector_to_another

embodiedscan/utils/line_mesh.py:24–32  ·  view source on GitHub ↗

Aligns vector a to vector b with axis angle rotation.

(a=np.array([0, 0, 1]), b=np.array([1, 0, 0]))

Source from the content-addressed store, hash-verified

22
23
24def align_vector_to_another(a=np.array([0, 0, 1]), b=np.array([1, 0, 0])):
25 """Aligns vector a to vector b with axis angle rotation."""
26 if np.array_equal(a, b):
27 return None, None
28 axis_ = np.cross(a, b)
29 axis_ = axis_ / np.linalg.norm(axis_)
30 angle = np.arccos(np.dot(a, b))
31
32 return axis_, angle
33
34
35def normalized(a, axis=-1, order=2):

Callers 1

create_line_meshMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected