# habitat.utils.geometry_utils module

## Functions

ref_agent_state: typing.Union[typing.List, typing.Tuple], target_agent_state: typing.Union[typing.List, typing.Tuple]) -> typing.Tuple[quaternion.quaternion, numpy.ndarray]
Computes the target agent_state’s rotation and position representation with respect to the coordinate system defined by reference agent’s rotation and position. All rotations must be in [x, y, z, w] format.
q1: quaternion.quaternion, q2: quaternion.quaternion) -> float
Returns the angle (in radians) between two quaternions. This angle will always be positive.
p: numpy.ndarray, v0: numpy.ndarray, v1: numpy.ndarray, v2: numpy.ndarray) -> bool
Return True if the point, p, is in the triangle defined by vertices v0,v1,v2. Algorithm: https://gdbooks.gitbooks.io/3dcollisions/content/Chapter4/point_in_triangle.html
coeffs: typing.List[float]) -> quaternion.quaternion
Creates a quaternions from coeffs in [x, y, z, w] format
v0: numpy.ndarray, v1: numpy.ndarray) -> quaternion.quaternion
Computes the quaternion representation of v1 using v0 as the origin.
quat: quaternion.quaternion, v: numpy.ndarray) -> numpy.ndarray
q: quaternion.quaternion)
v0: numpy.ndarray, v1: numpy.ndarray, v2: numpy.ndarray) -> numpy.ndarray
Sample a random point from a triangle given its vertices.

EPSILON = 1e-08

## Function documentation

### def habitat.utils.geometry_utils.agent_state_target2ref(ref_agent_state: typing.Union[typing.List, typing.Tuple], target_agent_state: typing.Union[typing.List, typing.Tuple]) -> typing.Tuple[quaternion.quaternion, numpy.ndarray]

Computes the target agent_state’s rotation and position representation with respect to the coordinate system defined by reference agent’s rotation and position. All rotations must be in [x, y, z, w] format.

Parameters
ref_agent_state reference agent_state in the format of [rotation, position]. The rotation and position are from a common/global coordinate systems. They define a local coordinate system.
target_agent_state target agent_state in the format of [rotation, position]. The rotation and position are from a common/global coordinate systems. and need to be transformed to the local coordinate system defined by ref_agent_state.