Metadata-Version: 2.1
Name: py-cylinder-fitting
Version: 1.0.0
Summary: This package allows to compute the best fit cylinder given points in three-dimensional space.
Author-email: Cristiano Pizzamiglio <cristianopizzamiglio@gmail.com>
License: 
        
        BSD 2-Clause License
        
        Copyright (c) 2022, Cristiano Pizzamiglio
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Project-URL: Homepage, https://github.com/CristianoPizzamiglio/py-cylinder-fitting
Keywords: cylinder,best-fit
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/x-rst
License-File: LICENSE

Introduction
------------

This package allows to compute the best fit cylinder given points in three-dimensional space.

Object-oriented implementation of the `cylinder_fitting` repo by xingjiepan_ with input validation and type hints.

Algorithm by `David Eberly <https://www.geometrictools.com/Documentation/LeastSquaresFitting.pdf>`_.

As stated by David Eberly, the main assumption is that the underlying data is
modelled by a cylinder and that errors have caused the points not to be exactly on
the cylinder.

Installation
------------

The package can be installed with pip.

.. code-block:: bash

   $ pip install py-cylinder-fitting
   
Example Usage
-------------
>>> from py_cylinder_fitting import BestFitCylinder
>>> from skspatial.objects import Points

>>> points = [[2, 0, 0], [0, 2, 0], [0, -2, 0], [2, 0, 4], [0, 2, 4], [0, -2, 4]]

>>> best_fit_cylinder = BestFitCylinder(Points(points))

>>> best_fit_cylinder.point
[0., 0., 0.]

>>> best_fit_cylinder.vector
[0.  0.  4.]

>>> best_fit_cylinder.radius
2.0

Acknowledgment
--------------
This package is based on the cylinder_fitting repo by xingjiepan_ and the scikit-spatial_ library by Andrew Hynes.

.. _xingjiepan: https://github.com/xingjiepan/cylinder_fitting
.. _scikit-spatial: https://github.com/ajhynes7/scikit-spatial
