# Fitting a ellipsoid into a group of spheres (In 2D: fitting an ellipse into set of points)

Hi everyone,

I am new in using maxscript language and this is my post to this forum. I have the following task to solve, which involves a little bit of maths:

Given a group that consists of a set of spheres
\$Group01 = (\$Sphere01, ..., \$Sphere)

How can I find the best fit ellipsoid/voxel (3D ellipse) that maximally covered all spheres. The final aim is to draw the ellipsoid/voxel on top of the group with see through materials.

Looking it in 2D, the problem can be posed as fitting an ellipse into a set of points. In 2D, we need to compute major and minor axes, center, and orientation.

I would greatly appreciate for any assistance.

Thank you.

## Comment viewing options

### Hi all, I have found

Hi all,

I have found algorithm to compute the ellipsoid given a set of 3D points. But I still couldn't draw ellipsoid shape in 3ds max 9. Any help would be appreciated.

Thank you.

### Problem solved using ellipse

Problem solved using ellipse + lathe effect