habitat.utils.geometry_utils module

Functions

def 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.
def angle_between_quaternions(q1: quaternion.quaternion, q2: quaternion.quaternion) -> float
Returns the angle (in radians) between two quaternions. This angle will always be positive.
def is_point_in_triangle(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
def quaternion_from_coeff(coeffs: typing.List[float]) -> quaternion.quaternion
Creates a quaternions from coeffs in [x, y, z, w] format
def quaternion_from_two_vectors(v0: numpy.ndarray, v1: numpy.ndarray) -> quaternion.quaternion
Computes the quaternion representation of v1 using v0 as the origin.
def quaternion_rotate_vector(quat: quaternion.quaternion, v: numpy.ndarray) -> numpy.ndarray
def quaternion_to_list(q: quaternion.quaternion)
def random_triangle_point(v0: numpy.ndarray, v1: numpy.ndarray, v2: numpy.ndarray) -> numpy.ndarray
Sample a random point from a triangle given its vertices.

Data

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.