diff --git a/CorpusCallosum/shape/subsegment_contour.py b/CorpusCallosum/shape/subsegment_contour.py index 2434081df..88326c0da 100644 --- a/CorpusCallosum/shape/subsegment_contour.py +++ b/CorpusCallosum/shape/subsegment_contour.py @@ -880,8 +880,8 @@ def transform_to_acpc_standard( norms_product = np.linalg.norm(ac_pc_vec) * np.linalg.norm(posterior_vector) theta = np.arccos(dot_product / norms_product) - # Determine the sign of the angle using cross product - cross_product = np.cross(ac_pc_vec, posterior_vector) + # Determine the sign of the angle using the signed z-component of the 2D cross product. + cross_product = ac_pc_vec[0] * posterior_vector[1] - ac_pc_vec[1] * posterior_vector[0] if cross_product < 0: theta = -theta diff --git a/CorpusCallosum/utils/mapping_helpers.py b/CorpusCallosum/utils/mapping_helpers.py index 666e5e08b..c043cc542 100644 --- a/CorpusCallosum/utils/mapping_helpers.py +++ b/CorpusCallosum/utils/mapping_helpers.py @@ -84,8 +84,8 @@ def correct_nodding(ac_pt: Vector2d, pc_pt: Vector2d) -> AffineMatrix3x3: norms_product = np.linalg.norm(ac_pc_vec) * np.linalg.norm(posterior_vector) theta = np.arccos(dot_product / norms_product) - # Determine the sign of the angle using cross product - cross_product = np.cross(ac_pc_vec, posterior_vector) + # Determine the sign of the angle using the signed z-component of the 2D cross product. + cross_product = ac_pc_vec[0] * posterior_vector[1] - ac_pc_vec[1] * posterior_vector[0] if cross_product < 0: theta = -theta