Skip to main content

nd_line

GitHub PyPI PyPI Downloads PyPI Downloads PyPI - Python Version

Interpolate points on an n-dimensional line by euclidean arc length.

Installation

pip install nd_line

Methods

  • ln.interp(dist): returns a point dist length along the arc of the line

  • ln.interp_rat(ratio): ratio should be a value between 0 and 1, returns a value ratio*length along the line

  • ln.splineify(samples): returns a new line sampled from a spline fit; samples is the number of points on the new line (defaults to the original count)

Attributes

  • ln.points: the points of the line
  • ln.length: the length of the line
  • ln.type: linear if not spline approximated, spline otherwise

Example

from nd_line.nd_line import nd_line
import numpy as np

ln = nd_line(np.array([[0, 0, 0], [1, 1, 1], [2, 2, 2]]))
interpolated_point = ln.interp(1.5)
line_length = ln.length
halfway_point = ln.interp_rat(0.5)

Notes

interp and interp_rat currently accept a single distance or ratio at a time. Batch interpolation of a list of distances is planned for a future version.

See the changelog for release history.

Metadata

Release files for nd-line 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nd-line 0.3.0
File Size Uploaded
nd_line-0.3.0.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nd-line 0.3.0
File Interpreter ABI Platform
nd_line-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.4 kB

Release files / nd_line-0.3.0.tar.gz

Download URL nd_line-0.3.0.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f011c7d16d37850f937028093e476d393244492f7f23fbf5ff455bedf3302937
BLAKE2b-256 checksum
How to use checksums
c8302172697e9cc682d6f0ee9910e1d64fb630d5cd1a54badf6c007bfbe8a21b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / nd_line-0.3.0-py3-none-any.whl

Download URL nd_line-0.3.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3960b9b01e0b4ec02e08c53efb39ed563f2a8b00620519f56e0294a2d32a778d
BLAKE2b-256 checksum
How to use checksums
f6601c1beab0b5c460613aab2d6c6a69e5bd47df1edbbef4110590b60f52b5ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page