I have vertices array which contains the positions for a cylinder mesh.
How do I calculate the cylinder width and radius from this vertices?
I have vertices array which contains the positions for a cylinder mesh.
How do I calculate the cylinder width and radius from this vertices?
Is the mesh already standing upright? If so you can find the height/diameter with length( max - min ) of the verts. Otherwise I suppose you could do PCA to find a basis to aligned the cylinder along the cartesian axes, and do the same length( max - min ) where max and min are calculated along the basis axes.
The vectors shown are the eigenvectors of the covariance matrix scaled by the square root of the corresponding eigenvalue, and shifted so their tails are at the mean.