“Straight” (tangent) connections to both ends of Bézier curve
up vote
2
down vote
favorite
I would like to draw a relatively thick Bézier curve that goes all the way to the edge of a rectangle. In the MWE below, the eventual clipping boundary is represented by the drawn rectangle.
I like the shape of the curve from (0,10) to (20,30), but I want that small remaining triangle to be filled in as well. I found the ([turn]...) syntax which works well for the end of the curve, but can't work for the start of the curve.
My kludgy solution is to draw the curve twice, once starting from the top and once starting from the bottom, but seems like there must be a better way.
In actual use, these curves aren't simply from points like in the MWE but are parameterized relative to other dimensions of the image, which is why I don't want to manually calculate the tangent line and hardcode the numbers in.
EDIT: I realize I may be asking for a particular solution to the problem instead of just the easiest. If there is a way to "straight" extend a path that doesn't involve ([turn]...) or tangents, I'm open to that solution as well. (Although the original question is interesting to me even so.)
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0, 10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30);
draw[green, opacity=0.25, line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0, 10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) -- ([turn]0:2);
draw[blue, opacity=0.25, line width=1.333cm, line cap=rect] (20, 30) .. controls ($(0, 10)!0.666!(20, 30) + (-1, 1)$) and ($(0, 10)!0.333!(20, 30) + (-1, 1)$) .. (0, 10) -- ([turn]0:2);
draw[red] (0, 10) -- ($(0, 10)!0.333!(20, 30) +(-1, 1)$) -- ($(0, 10)!0.666!(20, 30) + (-1, 1)$) -- (20, 30);
end{tikzpicture}
end{document}

EDIT 2: added arrows for clarity (sorry, I used Preview.app to add them, not TeX :P )
I would like the black line to extend far enough so it gets clipped "flat" by the rectangle and doesn't leave that small internal triangle.

tikz-pgf
add a comment |
up vote
2
down vote
favorite
I would like to draw a relatively thick Bézier curve that goes all the way to the edge of a rectangle. In the MWE below, the eventual clipping boundary is represented by the drawn rectangle.
I like the shape of the curve from (0,10) to (20,30), but I want that small remaining triangle to be filled in as well. I found the ([turn]...) syntax which works well for the end of the curve, but can't work for the start of the curve.
My kludgy solution is to draw the curve twice, once starting from the top and once starting from the bottom, but seems like there must be a better way.
In actual use, these curves aren't simply from points like in the MWE but are parameterized relative to other dimensions of the image, which is why I don't want to manually calculate the tangent line and hardcode the numbers in.
EDIT: I realize I may be asking for a particular solution to the problem instead of just the easiest. If there is a way to "straight" extend a path that doesn't involve ([turn]...) or tangents, I'm open to that solution as well. (Although the original question is interesting to me even so.)
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0, 10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30);
draw[green, opacity=0.25, line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0, 10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) -- ([turn]0:2);
draw[blue, opacity=0.25, line width=1.333cm, line cap=rect] (20, 30) .. controls ($(0, 10)!0.666!(20, 30) + (-1, 1)$) and ($(0, 10)!0.333!(20, 30) + (-1, 1)$) .. (0, 10) -- ([turn]0:2);
draw[red] (0, 10) -- ($(0, 10)!0.333!(20, 30) +(-1, 1)$) -- ($(0, 10)!0.666!(20, 30) + (-1, 1)$) -- (20, 30);
end{tikzpicture}
end{document}

EDIT 2: added arrows for clarity (sorry, I used Preview.app to add them, not TeX :P )
I would like the black line to extend far enough so it gets clipped "flat" by the rectangle and doesn't leave that small internal triangle.

tikz-pgf
A solution is possible using the approach in this post: tex.stackexchange.com/q/25928/19170. However, the bug found in this question appears to happen with[tangent=0, tangent=1], necessitating[tangent=0, tangent=0.99999]. As mentioned in the second link, adding one more "9" brings back the bug.
– Scott Colby
1 hour ago
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I would like to draw a relatively thick Bézier curve that goes all the way to the edge of a rectangle. In the MWE below, the eventual clipping boundary is represented by the drawn rectangle.
I like the shape of the curve from (0,10) to (20,30), but I want that small remaining triangle to be filled in as well. I found the ([turn]...) syntax which works well for the end of the curve, but can't work for the start of the curve.
My kludgy solution is to draw the curve twice, once starting from the top and once starting from the bottom, but seems like there must be a better way.
In actual use, these curves aren't simply from points like in the MWE but are parameterized relative to other dimensions of the image, which is why I don't want to manually calculate the tangent line and hardcode the numbers in.
EDIT: I realize I may be asking for a particular solution to the problem instead of just the easiest. If there is a way to "straight" extend a path that doesn't involve ([turn]...) or tangents, I'm open to that solution as well. (Although the original question is interesting to me even so.)
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0, 10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30);
draw[green, opacity=0.25, line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0, 10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) -- ([turn]0:2);
draw[blue, opacity=0.25, line width=1.333cm, line cap=rect] (20, 30) .. controls ($(0, 10)!0.666!(20, 30) + (-1, 1)$) and ($(0, 10)!0.333!(20, 30) + (-1, 1)$) .. (0, 10) -- ([turn]0:2);
draw[red] (0, 10) -- ($(0, 10)!0.333!(20, 30) +(-1, 1)$) -- ($(0, 10)!0.666!(20, 30) + (-1, 1)$) -- (20, 30);
end{tikzpicture}
end{document}

EDIT 2: added arrows for clarity (sorry, I used Preview.app to add them, not TeX :P )
I would like the black line to extend far enough so it gets clipped "flat" by the rectangle and doesn't leave that small internal triangle.

tikz-pgf
I would like to draw a relatively thick Bézier curve that goes all the way to the edge of a rectangle. In the MWE below, the eventual clipping boundary is represented by the drawn rectangle.
I like the shape of the curve from (0,10) to (20,30), but I want that small remaining triangle to be filled in as well. I found the ([turn]...) syntax which works well for the end of the curve, but can't work for the start of the curve.
My kludgy solution is to draw the curve twice, once starting from the top and once starting from the bottom, but seems like there must be a better way.
In actual use, these curves aren't simply from points like in the MWE but are parameterized relative to other dimensions of the image, which is why I don't want to manually calculate the tangent line and hardcode the numbers in.
EDIT: I realize I may be asking for a particular solution to the problem instead of just the easiest. If there is a way to "straight" extend a path that doesn't involve ([turn]...) or tangents, I'm open to that solution as well. (Although the original question is interesting to me even so.)
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0, 10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30);
draw[green, opacity=0.25, line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0, 10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) -- ([turn]0:2);
draw[blue, opacity=0.25, line width=1.333cm, line cap=rect] (20, 30) .. controls ($(0, 10)!0.666!(20, 30) + (-1, 1)$) and ($(0, 10)!0.333!(20, 30) + (-1, 1)$) .. (0, 10) -- ([turn]0:2);
draw[red] (0, 10) -- ($(0, 10)!0.333!(20, 30) +(-1, 1)$) -- ($(0, 10)!0.666!(20, 30) + (-1, 1)$) -- (20, 30);
end{tikzpicture}
end{document}

EDIT 2: added arrows for clarity (sorry, I used Preview.app to add them, not TeX :P )
I would like the black line to extend far enough so it gets clipped "flat" by the rectangle and doesn't leave that small internal triangle.

tikz-pgf
tikz-pgf
edited 1 hour ago
asked 1 hour ago
Scott Colby
1847
1847
A solution is possible using the approach in this post: tex.stackexchange.com/q/25928/19170. However, the bug found in this question appears to happen with[tangent=0, tangent=1], necessitating[tangent=0, tangent=0.99999]. As mentioned in the second link, adding one more "9" brings back the bug.
– Scott Colby
1 hour ago
add a comment |
A solution is possible using the approach in this post: tex.stackexchange.com/q/25928/19170. However, the bug found in this question appears to happen with[tangent=0, tangent=1], necessitating[tangent=0, tangent=0.99999]. As mentioned in the second link, adding one more "9" brings back the bug.
– Scott Colby
1 hour ago
A solution is possible using the approach in this post: tex.stackexchange.com/q/25928/19170. However, the bug found in this question appears to happen with
[tangent=0, tangent=1], necessitating [tangent=0, tangent=0.99999]. As mentioned in the second link, adding one more "9" brings back the bug.– Scott Colby
1 hour ago
A solution is possible using the approach in this post: tex.stackexchange.com/q/25928/19170. However, the bug found in this question appears to happen with
[tangent=0, tangent=1], necessitating [tangent=0, tangent=0.99999]. As mentioned in the second link, adding one more "9" brings back the bug.– Scott Colby
1 hour ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
I see. Better now? This adds some smooth cotinuation at both ends.
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0,
10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) coordinate[pos=-0.1] (aux1) coordinate[pos=0] (aux2)
coordinate[pos=1.1] (aux3) coordinate[pos=1] (aux4)
(aux1) -- (aux2) (aux3) -- (aux4);
end{tikzpicture}
end{document}

You could make this a style, of course.
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}[continuation/.style={insert path={coordinate[pos=-#1] (aux1) coordinate[pos=0] (aux2)
coordinate[pos=1+#1] (aux3) coordinate[pos=1] (aux4)
(aux1) -- (aux2) (aux3) -- (aux4)}}]
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0,
10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) [continuation=0.1];
end{tikzpicture}
end{document}
and also produce the mandatory animation
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
tikzset{continuation/.style={insert path={coordinate[pos=-#1] (aux1) coordinate[pos=0] (aux2)
coordinate[pos=1+#1] (aux3) coordinate[pos=1] (aux4)
(aux1) -- (aux2) (aux3) -- (aux4)}}}
foreach X in {0.01,0.02,...,0.25}
{begin{tikzpicture}
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0,
10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) [continuation=X];
end{tikzpicture}}
end{document}

The problem isn't with the the extra green and blue, but the tiny triangle of white that would be left over inside the rectangle if the green and blue paths weren't there.
– Scott Colby
1 hour ago
@ScottColby Still not sure if I understand the question but does that come closer to what you want?
– marmot
1 hour ago
Yes, it's so close, but if you draw the auxiliary lines with reduced opacity and a different color, you'll see that they're not quite tangent to the Bézier. Not that anyone would probably notice/care at any reasonable print size, so this is acceptable if we can't find another way, but it would be nice to get things lined up perfectly.
– Scott Colby
1 hour ago
@ScottColby I am aware of the tangent solution but I am also aware of this issue, so I am afraid that the tangent solution may be more shaky than what I have. (The true question is which of these methods yield the "true" tangent. I believe that the above is sufficiently close to the true solution in the sense that it is almost indistinguishable from it.)
– marmot
1 hour ago
That's a much better investigation of the problem than the question I linked in my comment above! I'll do some reading and come back here.
– Scott Colby
44 mins ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I see. Better now? This adds some smooth cotinuation at both ends.
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0,
10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) coordinate[pos=-0.1] (aux1) coordinate[pos=0] (aux2)
coordinate[pos=1.1] (aux3) coordinate[pos=1] (aux4)
(aux1) -- (aux2) (aux3) -- (aux4);
end{tikzpicture}
end{document}

You could make this a style, of course.
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}[continuation/.style={insert path={coordinate[pos=-#1] (aux1) coordinate[pos=0] (aux2)
coordinate[pos=1+#1] (aux3) coordinate[pos=1] (aux4)
(aux1) -- (aux2) (aux3) -- (aux4)}}]
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0,
10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) [continuation=0.1];
end{tikzpicture}
end{document}
and also produce the mandatory animation
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
tikzset{continuation/.style={insert path={coordinate[pos=-#1] (aux1) coordinate[pos=0] (aux2)
coordinate[pos=1+#1] (aux3) coordinate[pos=1] (aux4)
(aux1) -- (aux2) (aux3) -- (aux4)}}}
foreach X in {0.01,0.02,...,0.25}
{begin{tikzpicture}
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0,
10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) [continuation=X];
end{tikzpicture}}
end{document}

The problem isn't with the the extra green and blue, but the tiny triangle of white that would be left over inside the rectangle if the green and blue paths weren't there.
– Scott Colby
1 hour ago
@ScottColby Still not sure if I understand the question but does that come closer to what you want?
– marmot
1 hour ago
Yes, it's so close, but if you draw the auxiliary lines with reduced opacity and a different color, you'll see that they're not quite tangent to the Bézier. Not that anyone would probably notice/care at any reasonable print size, so this is acceptable if we can't find another way, but it would be nice to get things lined up perfectly.
– Scott Colby
1 hour ago
@ScottColby I am aware of the tangent solution but I am also aware of this issue, so I am afraid that the tangent solution may be more shaky than what I have. (The true question is which of these methods yield the "true" tangent. I believe that the above is sufficiently close to the true solution in the sense that it is almost indistinguishable from it.)
– marmot
1 hour ago
That's a much better investigation of the problem than the question I linked in my comment above! I'll do some reading and come back here.
– Scott Colby
44 mins ago
add a comment |
up vote
0
down vote
I see. Better now? This adds some smooth cotinuation at both ends.
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0,
10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) coordinate[pos=-0.1] (aux1) coordinate[pos=0] (aux2)
coordinate[pos=1.1] (aux3) coordinate[pos=1] (aux4)
(aux1) -- (aux2) (aux3) -- (aux4);
end{tikzpicture}
end{document}

You could make this a style, of course.
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}[continuation/.style={insert path={coordinate[pos=-#1] (aux1) coordinate[pos=0] (aux2)
coordinate[pos=1+#1] (aux3) coordinate[pos=1] (aux4)
(aux1) -- (aux2) (aux3) -- (aux4)}}]
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0,
10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) [continuation=0.1];
end{tikzpicture}
end{document}
and also produce the mandatory animation
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
tikzset{continuation/.style={insert path={coordinate[pos=-#1] (aux1) coordinate[pos=0] (aux2)
coordinate[pos=1+#1] (aux3) coordinate[pos=1] (aux4)
(aux1) -- (aux2) (aux3) -- (aux4)}}}
foreach X in {0.01,0.02,...,0.25}
{begin{tikzpicture}
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0,
10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) [continuation=X];
end{tikzpicture}}
end{document}

The problem isn't with the the extra green and blue, but the tiny triangle of white that would be left over inside the rectangle if the green and blue paths weren't there.
– Scott Colby
1 hour ago
@ScottColby Still not sure if I understand the question but does that come closer to what you want?
– marmot
1 hour ago
Yes, it's so close, but if you draw the auxiliary lines with reduced opacity and a different color, you'll see that they're not quite tangent to the Bézier. Not that anyone would probably notice/care at any reasonable print size, so this is acceptable if we can't find another way, but it would be nice to get things lined up perfectly.
– Scott Colby
1 hour ago
@ScottColby I am aware of the tangent solution but I am also aware of this issue, so I am afraid that the tangent solution may be more shaky than what I have. (The true question is which of these methods yield the "true" tangent. I believe that the above is sufficiently close to the true solution in the sense that it is almost indistinguishable from it.)
– marmot
1 hour ago
That's a much better investigation of the problem than the question I linked in my comment above! I'll do some reading and come back here.
– Scott Colby
44 mins ago
add a comment |
up vote
0
down vote
up vote
0
down vote
I see. Better now? This adds some smooth cotinuation at both ends.
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0,
10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) coordinate[pos=-0.1] (aux1) coordinate[pos=0] (aux2)
coordinate[pos=1.1] (aux3) coordinate[pos=1] (aux4)
(aux1) -- (aux2) (aux3) -- (aux4);
end{tikzpicture}
end{document}

You could make this a style, of course.
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}[continuation/.style={insert path={coordinate[pos=-#1] (aux1) coordinate[pos=0] (aux2)
coordinate[pos=1+#1] (aux3) coordinate[pos=1] (aux4)
(aux1) -- (aux2) (aux3) -- (aux4)}}]
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0,
10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) [continuation=0.1];
end{tikzpicture}
end{document}
and also produce the mandatory animation
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
tikzset{continuation/.style={insert path={coordinate[pos=-#1] (aux1) coordinate[pos=0] (aux2)
coordinate[pos=1+#1] (aux3) coordinate[pos=1] (aux4)
(aux1) -- (aux2) (aux3) -- (aux4)}}}
foreach X in {0.01,0.02,...,0.25}
{begin{tikzpicture}
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0,
10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) [continuation=X];
end{tikzpicture}}
end{document}

I see. Better now? This adds some smooth cotinuation at both ends.
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0,
10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) coordinate[pos=-0.1] (aux1) coordinate[pos=0] (aux2)
coordinate[pos=1.1] (aux3) coordinate[pos=1] (aux4)
(aux1) -- (aux2) (aux3) -- (aux4);
end{tikzpicture}
end{document}

You could make this a style, of course.
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}[continuation/.style={insert path={coordinate[pos=-#1] (aux1) coordinate[pos=0] (aux2)
coordinate[pos=1+#1] (aux3) coordinate[pos=1] (aux4)
(aux1) -- (aux2) (aux3) -- (aux4)}}]
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0,
10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) [continuation=0.1];
end{tikzpicture}
end{document}
and also produce the mandatory animation
documentclass[tikz, margin=1cm]{standalone}
usetikzlibrary{calc}
begin{document}
tikzset{continuation/.style={insert path={coordinate[pos=-#1] (aux1) coordinate[pos=0] (aux2)
coordinate[pos=1+#1] (aux3) coordinate[pos=1] (aux4)
(aux1) -- (aux2) (aux3) -- (aux4)}}}
foreach X in {0.01,0.02,...,0.25}
{begin{tikzpicture}
draw (0, 0) rectangle (30, 30);
draw[line width=1.333cm, line cap=rect] (0, 10) .. controls ($(0, 10)!0.333!(20, 30) + (-1, 1)$) and ($(0,
10)!0.666!(20, 30) + (-1, 1)$) .. (20, 30) [continuation=X];
end{tikzpicture}}
end{document}

edited 1 hour ago
answered 1 hour ago
marmot
78.8k487166
78.8k487166
The problem isn't with the the extra green and blue, but the tiny triangle of white that would be left over inside the rectangle if the green and blue paths weren't there.
– Scott Colby
1 hour ago
@ScottColby Still not sure if I understand the question but does that come closer to what you want?
– marmot
1 hour ago
Yes, it's so close, but if you draw the auxiliary lines with reduced opacity and a different color, you'll see that they're not quite tangent to the Bézier. Not that anyone would probably notice/care at any reasonable print size, so this is acceptable if we can't find another way, but it would be nice to get things lined up perfectly.
– Scott Colby
1 hour ago
@ScottColby I am aware of the tangent solution but I am also aware of this issue, so I am afraid that the tangent solution may be more shaky than what I have. (The true question is which of these methods yield the "true" tangent. I believe that the above is sufficiently close to the true solution in the sense that it is almost indistinguishable from it.)
– marmot
1 hour ago
That's a much better investigation of the problem than the question I linked in my comment above! I'll do some reading and come back here.
– Scott Colby
44 mins ago
add a comment |
The problem isn't with the the extra green and blue, but the tiny triangle of white that would be left over inside the rectangle if the green and blue paths weren't there.
– Scott Colby
1 hour ago
@ScottColby Still not sure if I understand the question but does that come closer to what you want?
– marmot
1 hour ago
Yes, it's so close, but if you draw the auxiliary lines with reduced opacity and a different color, you'll see that they're not quite tangent to the Bézier. Not that anyone would probably notice/care at any reasonable print size, so this is acceptable if we can't find another way, but it would be nice to get things lined up perfectly.
– Scott Colby
1 hour ago
@ScottColby I am aware of the tangent solution but I am also aware of this issue, so I am afraid that the tangent solution may be more shaky than what I have. (The true question is which of these methods yield the "true" tangent. I believe that the above is sufficiently close to the true solution in the sense that it is almost indistinguishable from it.)
– marmot
1 hour ago
That's a much better investigation of the problem than the question I linked in my comment above! I'll do some reading and come back here.
– Scott Colby
44 mins ago
The problem isn't with the the extra green and blue, but the tiny triangle of white that would be left over inside the rectangle if the green and blue paths weren't there.
– Scott Colby
1 hour ago
The problem isn't with the the extra green and blue, but the tiny triangle of white that would be left over inside the rectangle if the green and blue paths weren't there.
– Scott Colby
1 hour ago
@ScottColby Still not sure if I understand the question but does that come closer to what you want?
– marmot
1 hour ago
@ScottColby Still not sure if I understand the question but does that come closer to what you want?
– marmot
1 hour ago
Yes, it's so close, but if you draw the auxiliary lines with reduced opacity and a different color, you'll see that they're not quite tangent to the Bézier. Not that anyone would probably notice/care at any reasonable print size, so this is acceptable if we can't find another way, but it would be nice to get things lined up perfectly.
– Scott Colby
1 hour ago
Yes, it's so close, but if you draw the auxiliary lines with reduced opacity and a different color, you'll see that they're not quite tangent to the Bézier. Not that anyone would probably notice/care at any reasonable print size, so this is acceptable if we can't find another way, but it would be nice to get things lined up perfectly.
– Scott Colby
1 hour ago
@ScottColby I am aware of the tangent solution but I am also aware of this issue, so I am afraid that the tangent solution may be more shaky than what I have. (The true question is which of these methods yield the "true" tangent. I believe that the above is sufficiently close to the true solution in the sense that it is almost indistinguishable from it.)
– marmot
1 hour ago
@ScottColby I am aware of the tangent solution but I am also aware of this issue, so I am afraid that the tangent solution may be more shaky than what I have. (The true question is which of these methods yield the "true" tangent. I believe that the above is sufficiently close to the true solution in the sense that it is almost indistinguishable from it.)
– marmot
1 hour ago
That's a much better investigation of the problem than the question I linked in my comment above! I'll do some reading and come back here.
– Scott Colby
44 mins ago
That's a much better investigation of the problem than the question I linked in my comment above! I'll do some reading and come back here.
– Scott Colby
44 mins ago
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462277%2fstraight-tangent-connections-to-both-ends-of-b%25c3%25a9zier-curve%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
A solution is possible using the approach in this post: tex.stackexchange.com/q/25928/19170. However, the bug found in this question appears to happen with
[tangent=0, tangent=1], necessitating[tangent=0, tangent=0.99999]. As mentioned in the second link, adding one more "9" brings back the bug.– Scott Colby
1 hour ago