# How to cut a thick curve in half lengthwise?

Is there any easy way to cut a thick curve in half lengthwise? Example: suppose I have the cardioid shown in the figure below, is there a way to delete either the inner or the outer portion of the curve along the dashed line? Thanks for reading!! Edit: code used to generate plot.

g = ParametricPlot[{(1 + Cos[t]) Cos[t], (1 + Cos[t]) Sin[t]}, {t, 0,
2 Pi}, PlotRange -> {{-0.5, 2.2}, {-1.5, 1.5}},
PlotStyle -> {Thickness[0.06]}];

h = ParametricPlot[{(1 + Cos[t]) Cos[t], (1 + Cos[t]) Sin[t]}, {t, 0,
2 Pi}, PlotRange -> {{-0.5, 2.2}, {-1.5, 1.5}},
PlotStyle -> {Thickness[0.0035], White, Dashed}];

Show[g, h]

• If you don't need the inside to be transparent, what I do is to draw the curve again filled with white, leaving only the outer half showing.
– user484
Dec 23 '14 at 14:45
• Thanks, but how does that help, Rahul? Mathematica always centers the second curve along the middle (the dashed line in my pic) of the orginal curve, so your solution would only leave two blue curves separated by the width of the white curve. Whereas what I want is a single curve on one side of the dashed line. In other words: if you imagine the thick blue cardioid curve to be a road, I only want the left or the right lane. Dec 23 '14 at 16:04
• This has been asked before, but I can't find the original. Anyone? Dec 23 '14 at 16:56
• In the answers to 28202, the normal to the curve was extended on both side. Adapt to extend on one side only. Post your answer here if you figure it out (unless the community thinks it's duplicate). If you can't figure it out, let us know. Some go-getter will no doubt figure it out in the meantime. Dec 23 '14 at 17:29
• @Kim By "filled with white" I meant colouring the interior of the cardioid with white, not the perimeter. In the road metaphor this covers the inside lane as well as the traffic island in the middle. I believe that's what the first part of Algohi's answer does.
– user484
Dec 23 '14 at 19:09

Since you said "Or", I will do the inner one. you can do it like this:

p1 = ParametricPlot[
r {(1 + Cos[t]) Cos[t], (1 + Cos[t]) Sin[t]}, {t, 0, 2 Pi}, {r, 0,
1}, PlotRange -> All, Frame -> False,
PlotStyle -> {White, Opacity}];
Show[g, h, p1] For the outer one "Also can be used in general for inner and outer" you can use:

p1 = ParametricPlot[{1 - r + r (1 + Cos[t]) Cos[t],
r (1 + Cos[t]) Sin[t]}, {t, 0, 2 Pi}, {r, 1, 2}, PlotRange -> All,
Frame -> False, PlotStyle -> {White, Opacity}];
Show[g, h, p1] If you really need a Graphics object that represents a "sliced" version of the boundary curve (instead of just hiding one half of the line as in Algohi's solution which I also upvoted because it's easier), then you can achieve that as follows:

g = ParametricPlot[{(1 + Cos[t]) Cos[t], (1 + Cos[t]) Sin[t]}, {t, 0,
2 Pi}, PlotRange -> {{-0.5, 2.2}, {-1.5, 1.5}},
PlotStyle -> {Thickness[0.06]}];

h = ParametricPlot[{(1 + Cos[t]) Cos[t], (1 + Cos[t]) Sin[t]}, {t, 0,
2 Pi}, PlotRange -> {{-0.5, 2.2}, {-1.5, 1.5}},
PlotStyle -> {Thickness[0.0035], White, Dashed}];

pts = Polygon[First[Cases[g, Line[x_] :> x, Infinity]]];

rdf = SignedRegionDistance[pts];

rp = With[{thickness = .1},
RegionPlot[
0 < rdf[{x, y}] < thickness, {x, -.7, 2.5}, {y, -1.6, 1.6},
PlotStyle -> Darker[Blue], BoundaryStyle -> None,
PlotPoints -> 50]
];

Show[rp, h, Background -> Lighter[Orange]] After reproducing the definitions of g and h from the question, I extract the boundary points of the parametric curve from g and use them to define a geometric Region by turning them into a Polygon for which we can then compute the signed distance in the function rdf. The function SignedRegionDistance yields 0 when you're on the line defined by the original plot g and h, and has a positive value outside that region. This can be used to impose a desired thickness in the RegionPlot that I store in the result rp, which then consists of a polygon that describes the desired shape with the desired thickness, but is outlined only in the outward direction.

To show that the graphics object is indeed the desired longitudinal slice, I superimpose it on the dashed parametric curve h with an added background that proves that nothing was hidden by overlying opaque regions.

The quality of the polygon can be changed by adjusting the PlotPoints option in RegionPlot. If necessary, you can also extract the polygon from the RegionPlot by doing First@Normal@rp.