This is the latest (main) BeagleBoard documentation. If you are looking for stable releases, use the drop-down menu on the bottom-left and select the desired version.

Function rc_algebra_fit_ellipsoid

Function Documentation

int rc_algebra_fit_ellipsoid(rc_matrix_t points, rc_vector_t *center, rc_vector_t *lengths)

Fits an ellipsoid to a set of points in 3D space.

The principle axes of the fitted ellipsoid align with the global coordinate system. Therefore there are 6 degrees of freedom defining the ellipsoid: the x,y,z coordinates of the centroid and the lengths from the centroid to the surface in each of the 3 directions.

rc_matrix_t ‘points’ is a tall matrix with 3 columns and at least 6 rows. Each row must contain the x,y&z components of each individual point to be fit. If only 6 rows are provided, the resulting ellipsoid will be an exact fit. Otherwise the result is a least-squares fit to the over-defined dataset.

The final x,y,z position of the centroid will be placed in vector ‘center’ and the lengths or radius from the centroid to the surface along each axis will be placed in the vector ‘lengths’

  • points[in] datapoints to fit

  • center[out] center of ellipse

  • lengths[out] lengths along principle axis


Returns 0 on success or -1 on failure.