Relative Content

Tag Archive for pythongeometrydistance

Python function to calculate distance between faces of two cylinders

I have a 3D array representing one object that is roughly a cylinder, and a 3D array representing another. I require the average distance between the faces of the adjacent cylinders. Anyone have any idea on how to do this? I was thinking of something like fitting the face of one cylinder to a plane, finding the normal and then projecting each point on that face along that normal and finding the distance to the opposing face, and averaging over all of those. It’s kinda clunky though, anyone have a better more elegant solution? Would be nice if it was somewhat robust to small shape irregularities as well