compute_com

giant.ray_tracer.utilities:

giant.ray_tracer.utilities.compute_com(tris)[source]

This function computes the center of mass assuming uniform density for a triangle tesselated surface.

The center of mass is found by finding the center of volume (since with uniform density this is equivalent to the center of mass). This is done by computing the volume of each tetrahedron formed by a face connected to the center of figure of the shape (note that therefore very irregular shapes cannot be analyzed by this function). These volumes are then used in the usual center of mass equation (multiply the volumes times the volume centroids, take the sum, and divide by the sum of the volumes).

Parameters:

tris (Triangle64 | Triangle32) – the triangular tessellated surface which we are to compute the uniform density center of mass for

Returns:

the center of mass of the surface as a length 3 numpy array expressed in the current frame

Return type:

ndarray