# function construction – How to add noise to these random straight lines in 3D?

Here’s a code that draws a pack of random straight lines in 3D:

``````Corde(s_, x0_, y0_, z0_, u_, phi_) := {
x0 + s Sqrt(1 - u^2) Cos(phi),
y0 + s Sqrt(1 - u^2) Sin(phi),
z0 + s u
}

x0(n_) := RandomReal({-10, 10});
y0(n_) := RandomReal({-10, 10});
z0(n_) := RandomReal({-10, 10});
u0(n_) := RandomReal({-1, 1});
phi0(n_) := RandomReal({0, 2 Pi});

Cordes(s_) := Table(
Corde(s, x0(n), y0(n), z0(n), u0(n), phi0(n)), {n, 1, 10})

Enchevetrement =
ParametricPlot3D(Evaluate@Cordes(s), {s, -20, 20}, PlotPoints -> 2);

Show(Enchevetrement,
PlotRange -> {{-10, 10}, {-10, 10}, {-10, 10}},
Axes -> True,
Ticks -> None,
AxesStyle -> Opacity(0.25),
AxesOrigin -> {0, 0, 0},
SphericalRegion -> True,
Method -> {"RotationControl" -> "Globe"},
ImageSize -> {700, 700}
)
``````

Preview:

I would like to make them looking like some kind of natural random walks by adding noise to the lines. The result should be smooth looking (no discontinuities, the curves should stay smooth). The randomness resolution should be an option to increase the paths complexity.

In other words: each straight line should get some random wavy noise.

Take note that I’m using Mathematica 7.0, and I can’t upgrade the machine to a newer version of Mathematica. So the code modifications should stay close to the original code, with just a few new simple functions. Nothing fancy.