5
$\begingroup$

If I have a parametric function in 2D e.g. v[t_]:={Cos[t],Sin[t]} how can I build a ribbon-like Region which is defined by "Extruding" this path a small distance d normal to the path on either side? In the case of a circular path one would get a thin ring like region, but the method to create the ribbon needs to deal with more complex paths e.g.

 v[t_] := {(1 + .2*Cos[3 t])*Cos[t], (1 + .2*Sin[3 t])*Sin[t]}

I can find ways to compute the normal fields along the curve but how can one find a way to make a region between the outer and inner curves

ParametricPlot[v[t], {t, 0, 2 \[Pi]}]

normalArrowsout = 
  Table[Arrow[
    TranslationTransform[{v[\[Theta]][[1]], v[\[Theta]][[2]]}] /@ {{0,
        0}, -0.1 Cross[
        Normalize[{v'[\[Theta]][[1]], 
          v'[\[Theta]][[2]]}]]}], {\[Theta], 0, 360 \[Degree], 
    4 \[Degree]}];

normalArrowsin = 
  Table[Arrow[
    TranslationTransform[{v[\[Theta]][[1]], v[\[Theta]][[2]]}] /@ {{0,
        0}, 
      0.1 Cross[
        Normalize[{v'[\[Theta]][[1]], 
          v'[\[Theta]][[2]]}]]}], {\[Theta], 0, 360 \[Degree], 
    4 \[Degree]}];

ParametricPlot[v[t], {t, 0, 2 \[Pi]}, Epilog -> normalArrowsout]
ParametricPlot[v[t], {t, 0, 2 \[Pi]}, Epilog -> normalArrowsin]

normalcoordsout = 
  Table[TranslationTransform[{v[\[Theta]][[1]], 
      v[\[Theta]][[2]]}] /@ {-0.1 Cross[
       Normalize[{v'[\[Theta]][[1]], v'[\[Theta]][[2]]}]]}, {\[Theta],
     0, 360 \[Degree], 4 \[Degree]}];

normalcoordssin = 
  Table[TranslationTransform[{v[\[Theta]][[1]], 
      v[\[Theta]][[2]]}] /@ {0.1 Cross[
       Normalize[{v'[\[Theta]][[1]], v'[\[Theta]][[2]]}]]}, {\[Theta],
     0, 360 \[Degree], 4 \[Degree]}];

ListLinePlot[{Flatten[normalcoordsout, 1], 
  Flatten[normalcoordssin, 1]}]
$\endgroup$
1
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – Michael E2
    Commented Jun 22, 2023 at 0:08

2 Answers 2

11
$\begingroup$
  • Method-1
Clear[reg];
reg = Polygon[
   Flatten[normalcoordsout, 1] -> Flatten[normalcoordssin, 1]];
reg // Area
RegionQ[reg]
Graphics[reg]

1.34202.

True

  • Method-2
Clear[reg];
reg=ListLinePlot[{Flatten[normalcoordsout, 1], 
   Flatten[normalcoordssin, 1]}] // BoundaryDiscretizeGraphics
reg//Area

1.34202

  • Method-3
Clear[v, plot, reg, dist];
v[t_] = {(1 + .2*Cos[3 t])*Cos[t], (1 + .2*Sin[3 t])*Sin[t]};
plot = ParametricPlot[v[t], {t, 0, 2 π}];
reg = DiscretizeGraphics[plot];
dist = RegionDistance[reg];
dreg = DiscretizeRegion[ImplicitRegion[dist@{x, y} <= .1, {x, y}]]
dreg // Area

1.34372.

enter image description here

  • Method-4
Clear[plot, reg, dist, contours];
v[t_] = {(1 + .2*Cos[3 t])*Cos[t], (1 + .2*Sin[3 t])*Sin[t]};
plot = ParametricPlot[v[t], {t, 0, 2 π}];
reg = DiscretizeGraphics[plot];
dist = RegionDistance[reg];
contours = 
 ContourPlot[dist@{x, y} == .1, {x, -2, 2}, {y, -2, 2}, 
  PlotPoints -> 50, MaxRecursion -> 4]
contours // BoundaryDiscretizeGraphics
  • Method-5
Clear[plot, reg, dist, domain];
v[t_] = {(1 + .2*Cos[3 t])*Cos[t], (1 + .2*Sin[3 t])*Sin[t]};
plot = ParametricPlot[v[t], {t, 0, 2 π}];
reg = DiscretizeGraphics[plot];
dist = RegionDistance[reg];
domain = 
  ContourPlot[dist@{x, y}, {x, -2, 2}, {y, -2, 2}, PlotPoints -> 50, 
   MaxRecursion -> 4, Contours -> {.1}, 
   ContourShading -> {Automatic, None}];
DiscretizeGraphics[domain]
% // Area
  • Method-6
Clear[plot, reg];
v[t_] = {(1 + .2*Cos[3 t])*Cos[t], (1 + .2*Sin[3 t])*Sin[t]};
plot = ParametricPlot[v[t], {t, 0, 2 π}];
reg = DiscretizeGraphics[plot];
RegionDilation[reg, .1] // RegionPlot
  • Method-7
v[t_] = {(1 + .2*Cos[3 t])*Cos[t], (1 + .2*Sin[3 t])*Sin[t]};
{τ, ν} = Last[FrenetSerretSystem[v[t], t]] // Simplify;
ParametricPlot[{1 - s, s} . {v[t] - .15 ν, v[t] + .15 ν}, {t, 
  0, 2 π}, {s, 0, 1}, MeshFunctions -> {#3 &}, Mesh -> 80, 
 Frame -> False, Axes -> False]

enter image description here

$\endgroup$
3
  • $\begingroup$ I am leaving this here to remind myself to upvote - I capped off the max today. Very nice both of them! $\endgroup$
    – bmf
    Commented Jan 11, 2023 at 14:15
  • $\begingroup$ @bmf Thanks! Happy New Year 2023! $\endgroup$
    – cvgmt
    Commented Jan 11, 2023 at 14:17
  • $\begingroup$ Best wishes for a happy 2023! $\endgroup$
    – bmf
    Commented Jan 11, 2023 at 14:17
1
$\begingroup$

This can be achieved very easily using "PlotStyle":

v[t_] := {(1 + .2*Cos[3 t])*Cos[t], (1 + .2*Sin[3 t])*Sin[t]};
ParametricPlot[v[t], {t, 0, 7}, PlotStyle -> {Green, Thickness[0.03]}]

enter image description here

Addendum

If you want to do the same with "Region", you may subtract from a region a scaled version. There are some obstacles: To be able the calculate with a region in reasonable time, you must discretize it. Further, the scale factor seems to be the inverse of what one would expect.

v[t_] := {(1 + .2*Cos[3 t])*Cos[t], (1 + .2*Sin[3 t])*Sin[t]};
pr = DiscretizeRegion@ ParametricRegion[r v[t], {{t, 0, 7}, {r, 0, 1}}];
pr1 = RegionResize[pr, 1.6];
diff = RegionDifference[pr, pr1];
RegionPlot[diff, PlotStyle -> {Green}, Mesh -> None]

enter image description here

$\endgroup$
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.