Skip to main content

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

Project description

nd_line

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): generates a new line from a spline approximation, occurs in place, use samples to specify how many points will be sampled from the splines to generate the new line

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

Currently points must be sampled one at a time, future version will allow interpolation of a list of distances along the line

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

nd_line-0.2.0.tar.gz (272.5 kB view hashes)

Uploaded Source

Built Distribution

nd_line-0.2.0-py3-none-any.whl (3.8 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