Skip to main content

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

Project description

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.

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.

$ 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py-cylinder-fitting-1.0.0.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

py_cylinder_fitting-1.0.0-py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page