RNADiscrepancy.geometry
Module Contents
Functions
Computes the cross product of 3 points It corresponds to the direction (upward or downward) of the cross product of the two coplanar vectors defined by the two pairs of points (p1, p2), (p1, p3) The sign of the acute angle is the sign of the expression https://en.wikipedia.org/wiki/Cross_product#Computational_geometry |
|
Given a rotation matrix return its angle of rotation uses the fact that trace(rotation_matrix) = 1 + 2cos(theta) |
|
Given two points will return the rotation matrix R such that p2 @ R.T is aligned with p1 |
|
Given two sets of points and for each an “origin” computes the best rotation to go from set B -> A |
|
Least-squares rigid-body fit transform of two numpy array The center of mass of the nucleotide is at (0, 0, 0) returns rotation : matrix B2A : B moved to over A mean_A, mean_B, sum_square_error, RMSD |
|
Given two sets of points and for each an “origin” computes the best rotation + translation to go from set B -> A A = B @ R.T + t Follows Kabsch algorithm |
|
Return a direction +-1 of a triangle in the xy plane (ignores 3th dimension) by comparing to p1, p3, p2 it allows to check if two triangles are in the same orientation or not Relies on the computation (p3 - p1) X ( p2 - p1) = sign https://math.stackexchange.com/questions/4560043/orientation-of-a-triangles-vertices-in-3d-space-clockwise-or-counter-clockwise |
API
- RNADiscrepancy.geometry.cross3_2d(p1: Sequence[float], p2: Sequence[float], p3: Sequence[float]) float
Computes the cross product of 3 points It corresponds to the direction (upward or downward) of the cross product of the two coplanar vectors defined by the two pairs of points (p1, p2), (p1, p3) The sign of the acute angle is the sign of the expression https://en.wikipedia.org/wiki/Cross_product#Computational_geometry
- Args:
p1 (float, flaot) : 2D point p2 (float, flaot) : 2D point p3 (float, flaot) : 2D point
- Returns:
signed angle
- RNADiscrepancy.geometry.RMSD(A, B) float
- RNADiscrepancy.geometry.angle_rotation(rotation_matrix) float
Given a rotation matrix return its angle of rotation uses the fact that trace(rotation_matrix) = 1 + 2cos(theta)
- Args:
rotation_matrix (matrix n x 3): rotation matrix
- Returns:
The angle in radian
- RNADiscrepancy.geometry.rotation_align_2D_points(p1: Sequence[float], p2: Sequence[float]) numpy.typing.NDArray[[float]]
Given two points will return the rotation matrix R such that p2 @ R.T is aligned with p1
- RNADiscrepancy.geometry.best_rotation(A: numpy.typing.NDArray[[float]], center_A: numpy.typing.NDArray[float], B: numpy.typing.NDArray[[float]], center_B: numpy.typing.NDArray[float]) [numpy.typing.NDArray[[float]], numpy.typing.NDArray[float], numpy.typing.NDArray[float], float, float]
Given two sets of points and for each an “origin” computes the best rotation to go from set B -> A
- Args:
A (Matrix n X 3) : set of points A center_A (Vector 1 x 3) : center point of A B (Matrix n X 3) : set of points B center_B (Vector 1 x 3) : center point of B
- Returns:
Rotation B->A Rotation object B on A center_A center_B sum squared errors RMSD
- RNADiscrepancy.geometry.best_mean_centered_rotation(A: numpy.typing.NDArray[[float]], B: numpy.typing.NDArray[[float]]) numpy.typing.NDArray[[float]]
Least-squares rigid-body fit transform of two numpy array The center of mass of the nucleotide is at (0, 0, 0) returns rotation : matrix B2A : B moved to over A mean_A, mean_B, sum_square_error, RMSD
- RNADiscrepancy.geometry.best_rotation_translation(A: numpy.typing.NDArray[[float]], B: numpy.typing.NDArray[[float]]) [numpy.typing.NDArray[[float]], numpy.typing.NDArray[[float]], float, float, float]
Given two sets of points and for each an “origin” computes the best rotation + translation to go from set B -> A A = B @ R.T + t Follows Kabsch algorithm
- Args:
A (Matrix n X 3) : set of points A B (Matrix n X 3) : set of points B
- Returns:
Rotation R translation t B2A sum squared errors RMSD
- RNADiscrepancy.geometry.triangle_xy_sign(p1: numpy.typing.NDArray[float], p2: numpy.typing.NDArray[float], p3: numpy.typing.NDArray[float]) int
Return a direction +-1 of a triangle in the xy plane (ignores 3th dimension) by comparing to p1, p3, p2 it allows to check if two triangles are in the same orientation or not Relies on the computation (p3 - p1) X ( p2 - p1) = sign https://math.stackexchange.com/questions/4560043/orientation-of-a-triangles-vertices-in-3d-space-clockwise-or-counter-clockwise
- Args:
p1 (npt.NDArray[float]) : position in space of point1 p2 (npt.NDArray[float]) : position in space of point2 p3 (npt.NDArray[float]) : position in space of point3
- Return:
A value +-1 of the normal