This answer is based on a different line of reasoning than my previous answer.
plot = ParametricPlot3D[{6 Cos[t], 6 Sin[t], t}, {t, -2 Pi,
4 Pi}, PlotTheme -> "Detailed",
PlotStyle -> {Red, Thickness[Large]}, Boxed -> False,
PlotPoints -> 150];
After inspecting FullForm @ plot
, one can extract a Line
with Cases[FullForm @ plot, _Line, Infinity]
and transform it to a Cylinder
(Tube
would be more straightforward, but it's not a Region
):
Show[plot /. Line[z_] :> Cylinder[Partition[z, 2, 1], 0.5], PlotRange -> All]
Looks good, so
reg = Cases[FullForm @ plot, _Line, Infinity] /.
Line[z_] :> Cylinder[Partition[z, 2, 1], 0.5] // First
and then
points = RandomPoint[reg, 1000];
to give
Show[plot, ListPointPlot3D @ points]
line = Cases[FullForm @ plot, _Line, Infinity][[1]];
dist = RegionDistance[line, #] & /@ points; // AbsoluteTiming
{63.0501, Null}
Histogram @ dist
The distance from the curve has a peculiar distribution, though.
Previous answer
Employing RandomPoint @ Ball
:
Clear[plot, data, line, dist]
f[t_] := {6 Cos[t], 6 Sin[t], t}
c = ParametricPlot3D[f[t], {t, -2 Pi, 4 Pi},
PlotTheme -> "Detailed", PlotStyle -> {Red, Thickness[Large]},
Boxed -> False, PlotPoints -> 150];
plot = ListPointPlot3D @ (data =
Table[RandomPoint @ Ball[f[t], 0.5], {t, -2 Pi, 4 Pi, 0.01}]);
Show[c, plot]
Checking the distance distribution:
line = Cases[FullForm @ c, _Line, Infinity][[1]];
dist = RegionDistance[line, #] & /@ data; // AbsoluteTiming
{120.033, Null}
Length @ dist
1885
Histogram @ dist