Object-oriented tools to fit/plot conics and quadrics

Version 1.2.11 (495 KB) by Matt J
A tool set for fitting and/or plotting various conics and quadric surfaces, e.g., ellipses, cylinders, spheres, planes, cones, and lines.
1.9K Downloads
Updated 8 Feb 2024

View License

This FEX submission offers a tool set for fitting and plotting 2D conics (ellipses, circles, lines,...) as well as 3D quadric surfaces (ellipsoids, spheres, planes, cylinders, cones,...). Each type of fit is represented by an object within a class hierarchy. For each fit type, overloaded methods are provided for fitting the data, as well as post-plotting an overlay of the fit onto the raw data in a style similar to the Curve Fitting Toolbox. There are also methods for re-sampling the fit at a user-selected set of points.
Finally, the tools allow one to construct "ground truth" objects representing a conic/quadric with pre-selected parameters. This makes it possible to simply plot a desired ellipse or other supported shape regardless of whether it arises from a fitting process at all.
Currently, not all curve/surface types in the conic/quadric family are covered by this tool set, although I may add more over time. For now, I provide a subset of the ones that seem to be the most commonly encountered. Similarly, most fitting algorithms used by the tool set are very basic algebraic methods, although I may add more refined algorithms as the need and interest arise.
Various example uses of these tools are illustrated in the Examples tab.

Cite As

Matt J (2024). Object-oriented tools to fit/plot conics and quadrics (https://www.mathworks.com/matlabcentral/fileexchange/87584-object-oriented-tools-to-fit-plot-conics-and-quadrics), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2020a
Compatible with R2018a and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.2.11

Small bug fix in ellipticalFit.xysim() and ellipticalFIt.sample()

1.2.10

Further description updates

1.2.9

Small modifications to description page.

1.2.8

*Added some functionality to planarFit.project2D and planarFIt.unproject3D().
*Embellished example in "Fitting a 2D Shape to 3D Points", making it a 3D ellipse fit.

1.2.7

Minor edits to Examples.mlx

1.2.6

Added some tools and examples to help with fitting circles, ellipses, and other 2D shapes that are sampled in 3D. See the Examples.mlx section "Fitting a 2D Shape to 3D Points".

1.2.5

Bug fix in circularFit.sample().

1.2.4

Cosmetic update: default axis labels will now be provided on all plots.

1.2.3

Upload redo.

1.2.2

Updated Examples.mlx with examples for cones.

1.2.1

*Added rightcircularconeFit (beta version)
*Added showfit() method as a general interface for plotting the fit only (without the data points)
*Some documentation typos fixed.
*Other cosmetic fixes.

1.1.1

Cosmetic fix: quadricFit.plot() was unintentionally returning an output argument when nargout=0.

1.1.0

*Added groundtruth() methods.
*3D line plots now return line handles.
*3D ellipsoid and cylinder plots now return surf handles (implicit surface behavior was problematic).

1.0.5

Small text corrections

1.0.4

Mild tweaks and fixes

1.0.3

Small edits

1.0.2

Small edit

1.0.1

Small edit to Examples.mlx

1.0.0