bluemira.codes.cgal_ext.collision_detection =========================================== .. py:module:: bluemira.codes.cgal_ext.collision_detection .. autoapi-nested-parse:: Contains functions to efficiently convert to CGAL geometry and perform meshed-based collision detections. Functions --------- .. autoapisummary:: bluemira.codes.cgal_ext.collision_detection._scale_points_from_centroid bluemira.codes.cgal_ext.collision_detection.tri_mesh_to_cgal_mesh bluemira.codes.cgal_ext.collision_detection.do_polys_collide Module Contents --------------- .. py:function:: _scale_points_from_centroid(points, scale_factor) Scale a set of points from their centroid by a given scale factor. :param points: An array of shape (n, 3) representing the x, y, z coordinates of the points. :type points: np.ndarray :param scale_factor: The scale factor by which to scale the points. :type scale_factor: float :returns: **scaled_points** -- An array of shape (n, 3) representing the scaled x, y, z coordinates of the points. :rtype: np.ndarray .. py:function:: tri_mesh_to_cgal_mesh(points: numpy.ndarray, tris: numpy.ndarray, scale: float = 1) Convert a triangle mesh to a CGAL Polyhedron_3 object. This function is used to create a CGAL mesh from a set of points and triangles. It scales the points from their centroid by a given scale factor. :param points: An array of shape (n, 3) representing the x, y, z coordinates of the points. :param tris: An array of shape (m, 3) representing the indices of the points that form the triangles. :param scale: The scale factor by which to scale the points from their centroid. :returns: A CGAL Polyhedron_3 object representing the mesh. :rtype: Polyhedron_3 :raises ImportError: If CGAL is not available, an ImportError is raised. .. py:function:: do_polys_collide(mesh_a: CGAL.CGAL_Polyhedron_3.Polyhedron_3, mesh_b: CGAL.CGAL_Polyhedron_3.Polyhedron_3) -> bool Check if two CGAL Polyhedron_3 objects collide. :param mesh_a: The first CGAL Polyhedron_3 object. :param mesh_b: The second CGAL Polyhedron_3 object. :returns: True if the two meshes collide, False otherwise. :rtype: bool