# How to define a cloud of points relative to a vector path?

I've been researching and playing with examples of particle clouds in a graphics visualization. Most use shape geometries to define a field of particles, or parameters for distributing them randomly throughout the field of view. What I would like to do is create a particle cloud in which each particle has a relative proximity to an invisible vector path. For example, if I defined a lightly curved vector path, all the particles might float randomly within a consistent radius along that invisible vector path and then maybe taper toward the ends to form a hotdog-shaped cloud of particles. I asked this question on StackOverflow and have gotten some help but no clear solution; I then realized my question was primarily a mathematical challenge and may find it's better home here. Kind thanks for your consideration!

First, you need to have a parameterization for your curved path. What I mean is, you need to have a function $p(t)$ with $t\in[0,1]$ that gives the point on the curve as you sweep the parameter from $0$ to $1$. If you are using a polynomial spline, then you already have a natural parameterization.
Next, you need to define a radius function $r(t)$. This is going to be some constant value for $t$ not near the endpoints (say, from $t=0.1$ to $t=0.9$), and you want it to go to zero at the endpoints (say, linearly).
One way to generate $n$ particle locations now is to choose $n$ random values in $[0,1]$ corresponding to the parameter $t$. For each such $t$ value, you know the point on the curve where it should be near, and also the radius using the $r(t)$ function. Now all you have to do is, for each random $t$ value, generate a random point in the sphere centered at $p(t)$ with radius $r(t)$.
Generating a random point in a sphere is hard, so you might as well just use an axis-aligned cube. This scheme is probably good enough for visuals, and you can tweak it more later if you want. To avoid unsightly clusters, you can restrict for each random $t$ value the point to be in the plane perpendicular to your curve. Figuring out that plane is easy if your parameterization also spits out the tangent vector (which splines do, or you can use finite differences).
Suppose your curved path has parametric equation $\mathbf{C}(t)$, with $0 \le t \le 1$. It might be a Bézier curve, for example, or some other curve. Also, suppose that for any given $t$, you can construct a "frame" at the corresponding point $\mathbf{C}(t)$ on the curve. When I say "frame", I just mean a set of three mutually orthogonal unit vectors. There are many ways to construct this frame; the simplest consists of the curve tangent, normal, and binormal at the given point. Call the three unit vectors $\mathbf{U}(t)$, $\mathbf{V}(t)$, $\mathbf{W}(t)$. Assume $\mathbf{U}(t)$ and $\mathbf{V}(t)$ are perpendicular to the curve, and $\mathbf{W}(t)$ is tangent to the curve
Suppose we want our cloud of points to lie within some given distance $r$ of the curve -- in other words, our point cloud is a "sausage" shape with a diameter of $2r$. Assume we have a function $\phi: [0,1] \to [0,1]$ that returns random numbers in the range $[0,1]$. Then the function $$\mathbf{P}(t,u,v) = \mathbf{C}(t) + r\phi(u)\cos(2\pi v)\mathbf{U}(t) + r\phi(u)\sin(2\pi v)\mathbf{V}(t)$$ will generate points in the "sausage" as $t,u,v$ range over $[0,1]$.