A Parametric Curve Utility in Python

To run certain kinds of simulations, we need to generate random points that are evenly distributed along a certain curve (say, a circle) or over a surface (like a cube). If you have a formula for the length of the curve or the surface area, you can work backwards to find a procedure for generating the random points. But there are many mathematical curves, like ellipses, whose perimeter cannot be expressed using a formula. Instead, it must be computed numerically, by picking a large number of points along the curve and adding up the distance between them. The same applies to the surface area of many surfaces in three dimensions.

I have recently published a param_tools, a small Python module that performs these numerical computations for a given curve or surface and generates random data in the desired region. The curve or surface can be given in either parametric coordinates or as a set of ordered points. And instead of generating random data, it can also map uniformly-spaced data or data from an arbitrary probability distribution to a specified curve.

This is the first standalone module I have posted to Github, so I welcome feedback on the implementation and documentation.

And here are some puppies who followed my students to school this week: