How to return and access tikz coordinate and real variable from a drawing macro

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
5
down vote

favorite












This MWE draws multiple bicycle chain-link profiles but does not yet have an automated procedure to attach the links end-to-end into a chain segment. Each link is composed of two rollers, which I'll call the first and second. The origin of a link's local x-y coordinate frame is centered on the first roller and its x-axis points toward the second roller. The origin of the next link's reference frame (at the center of its first roller) will be attached to the center of the current link's second roller. The current version of the drawlink macro takes in the absolute x and y coordinates of the link's first roller (origin of its reference frame) as the first two arguments and the absolute rotation of this frame as the third argument. With these three quantities, a link can be drawn in any position and orientation relative to the global frame.



To simplify assembling a chain segment from links, I want to modify the drawlink macro to take in the absolute position of the previous link's second roller and its absolute angle, take in the angle of the current link relative to the previous link, and return the absolute position of the current link's second roller and its absolute angle.



Thus I am looking for a procedure to return the absolute position of the current link's second roller and its absolute angle from the drawlink macro and pass these quantities back into the next call to the drawlink macro, along with the offset angle. Then the drawchain macro will have only to provide relative angles between links and the drawlink macro will handle the rest.



%&latex
documentclassarticle
usepackagetikz
usepackagepgfmath
usetikzlibrarycalc
usetikzlibrarymath
usepackagexstring

defdrawlink(#1,#2,#3,#4)%
%#1 = x-position of first roller center.
%#2 = y-position of first roller center.
%#3 = link rotation angle.
%#4 = link gray saturation: 0 to 100
beginscope
tikzmath%Some math to define and position the link components
lp = 0.5in;
re = 0.3299*lp;
rc = 0.4284*lp;
Th = 41.25;
Thc = 90 - Th;
Tp = Thc + #3;
Tn = Thc - #3;
xs = #1 + cos(Tp)*re;
ys = #2 + sin(Tp)*re;

fill[gray!#4] (xs,ys)
arc(Tp:360-Tn):re)
arc(180-Tn:Tp:rc)
arc(-180+Tp:180-Tn:re)
arc(-Tn:-180+Tp:rc)
-- cycle;
endscope


begindocument

begintikzpicture[x=1mm, y=1mm, scale=0.25]
pgfdeclarelayertop
pgfsetlayersmain,top

pgfonlayermain
foreach i in 1,...,5
drawlink(i in,0,0,50)

endpgfonlayer

pgfonlayertop
foreach i in 0.5,1.5,...,5.5
drawlink(i in,0,0,100)

endpgfonlayer

endtikzpicture
enddocument


enter image description here









share

















  • 1




    Commenting to connect this to tex.stackexchange.com/q/33703/86 which may be of some help.
    – Loop Space
    1 hour ago














up vote
5
down vote

favorite












This MWE draws multiple bicycle chain-link profiles but does not yet have an automated procedure to attach the links end-to-end into a chain segment. Each link is composed of two rollers, which I'll call the first and second. The origin of a link's local x-y coordinate frame is centered on the first roller and its x-axis points toward the second roller. The origin of the next link's reference frame (at the center of its first roller) will be attached to the center of the current link's second roller. The current version of the drawlink macro takes in the absolute x and y coordinates of the link's first roller (origin of its reference frame) as the first two arguments and the absolute rotation of this frame as the third argument. With these three quantities, a link can be drawn in any position and orientation relative to the global frame.



To simplify assembling a chain segment from links, I want to modify the drawlink macro to take in the absolute position of the previous link's second roller and its absolute angle, take in the angle of the current link relative to the previous link, and return the absolute position of the current link's second roller and its absolute angle.



Thus I am looking for a procedure to return the absolute position of the current link's second roller and its absolute angle from the drawlink macro and pass these quantities back into the next call to the drawlink macro, along with the offset angle. Then the drawchain macro will have only to provide relative angles between links and the drawlink macro will handle the rest.



%&latex
documentclassarticle
usepackagetikz
usepackagepgfmath
usetikzlibrarycalc
usetikzlibrarymath
usepackagexstring

defdrawlink(#1,#2,#3,#4)%
%#1 = x-position of first roller center.
%#2 = y-position of first roller center.
%#3 = link rotation angle.
%#4 = link gray saturation: 0 to 100
beginscope
tikzmath%Some math to define and position the link components
lp = 0.5in;
re = 0.3299*lp;
rc = 0.4284*lp;
Th = 41.25;
Thc = 90 - Th;
Tp = Thc + #3;
Tn = Thc - #3;
xs = #1 + cos(Tp)*re;
ys = #2 + sin(Tp)*re;

fill[gray!#4] (xs,ys)
arc(Tp:360-Tn):re)
arc(180-Tn:Tp:rc)
arc(-180+Tp:180-Tn:re)
arc(-Tn:-180+Tp:rc)
-- cycle;
endscope


begindocument

begintikzpicture[x=1mm, y=1mm, scale=0.25]
pgfdeclarelayertop
pgfsetlayersmain,top

pgfonlayermain
foreach i in 1,...,5
drawlink(i in,0,0,50)

endpgfonlayer

pgfonlayertop
foreach i in 0.5,1.5,...,5.5
drawlink(i in,0,0,100)

endpgfonlayer

endtikzpicture
enddocument


enter image description here









share

















  • 1




    Commenting to connect this to tex.stackexchange.com/q/33703/86 which may be of some help.
    – Loop Space
    1 hour ago












up vote
5
down vote

favorite









up vote
5
down vote

favorite











This MWE draws multiple bicycle chain-link profiles but does not yet have an automated procedure to attach the links end-to-end into a chain segment. Each link is composed of two rollers, which I'll call the first and second. The origin of a link's local x-y coordinate frame is centered on the first roller and its x-axis points toward the second roller. The origin of the next link's reference frame (at the center of its first roller) will be attached to the center of the current link's second roller. The current version of the drawlink macro takes in the absolute x and y coordinates of the link's first roller (origin of its reference frame) as the first two arguments and the absolute rotation of this frame as the third argument. With these three quantities, a link can be drawn in any position and orientation relative to the global frame.



To simplify assembling a chain segment from links, I want to modify the drawlink macro to take in the absolute position of the previous link's second roller and its absolute angle, take in the angle of the current link relative to the previous link, and return the absolute position of the current link's second roller and its absolute angle.



Thus I am looking for a procedure to return the absolute position of the current link's second roller and its absolute angle from the drawlink macro and pass these quantities back into the next call to the drawlink macro, along with the offset angle. Then the drawchain macro will have only to provide relative angles between links and the drawlink macro will handle the rest.



%&latex
documentclassarticle
usepackagetikz
usepackagepgfmath
usetikzlibrarycalc
usetikzlibrarymath
usepackagexstring

defdrawlink(#1,#2,#3,#4)%
%#1 = x-position of first roller center.
%#2 = y-position of first roller center.
%#3 = link rotation angle.
%#4 = link gray saturation: 0 to 100
beginscope
tikzmath%Some math to define and position the link components
lp = 0.5in;
re = 0.3299*lp;
rc = 0.4284*lp;
Th = 41.25;
Thc = 90 - Th;
Tp = Thc + #3;
Tn = Thc - #3;
xs = #1 + cos(Tp)*re;
ys = #2 + sin(Tp)*re;

fill[gray!#4] (xs,ys)
arc(Tp:360-Tn):re)
arc(180-Tn:Tp:rc)
arc(-180+Tp:180-Tn:re)
arc(-Tn:-180+Tp:rc)
-- cycle;
endscope


begindocument

begintikzpicture[x=1mm, y=1mm, scale=0.25]
pgfdeclarelayertop
pgfsetlayersmain,top

pgfonlayermain
foreach i in 1,...,5
drawlink(i in,0,0,50)

endpgfonlayer

pgfonlayertop
foreach i in 0.5,1.5,...,5.5
drawlink(i in,0,0,100)

endpgfonlayer

endtikzpicture
enddocument


enter image description here









share













This MWE draws multiple bicycle chain-link profiles but does not yet have an automated procedure to attach the links end-to-end into a chain segment. Each link is composed of two rollers, which I'll call the first and second. The origin of a link's local x-y coordinate frame is centered on the first roller and its x-axis points toward the second roller. The origin of the next link's reference frame (at the center of its first roller) will be attached to the center of the current link's second roller. The current version of the drawlink macro takes in the absolute x and y coordinates of the link's first roller (origin of its reference frame) as the first two arguments and the absolute rotation of this frame as the third argument. With these three quantities, a link can be drawn in any position and orientation relative to the global frame.



To simplify assembling a chain segment from links, I want to modify the drawlink macro to take in the absolute position of the previous link's second roller and its absolute angle, take in the angle of the current link relative to the previous link, and return the absolute position of the current link's second roller and its absolute angle.



Thus I am looking for a procedure to return the absolute position of the current link's second roller and its absolute angle from the drawlink macro and pass these quantities back into the next call to the drawlink macro, along with the offset angle. Then the drawchain macro will have only to provide relative angles between links and the drawlink macro will handle the rest.



%&latex
documentclassarticle
usepackagetikz
usepackagepgfmath
usetikzlibrarycalc
usetikzlibrarymath
usepackagexstring

defdrawlink(#1,#2,#3,#4)%
%#1 = x-position of first roller center.
%#2 = y-position of first roller center.
%#3 = link rotation angle.
%#4 = link gray saturation: 0 to 100
beginscope
tikzmath%Some math to define and position the link components
lp = 0.5in;
re = 0.3299*lp;
rc = 0.4284*lp;
Th = 41.25;
Thc = 90 - Th;
Tp = Thc + #3;
Tn = Thc - #3;
xs = #1 + cos(Tp)*re;
ys = #2 + sin(Tp)*re;

fill[gray!#4] (xs,ys)
arc(Tp:360-Tn):re)
arc(180-Tn:Tp:rc)
arc(-180+Tp:180-Tn:re)
arc(-Tn:-180+Tp:rc)
-- cycle;
endscope


begindocument

begintikzpicture[x=1mm, y=1mm, scale=0.25]
pgfdeclarelayertop
pgfsetlayersmain,top

pgfonlayermain
foreach i in 1,...,5
drawlink(i in,0,0,50)

endpgfonlayer

pgfonlayertop
foreach i in 0.5,1.5,...,5.5
drawlink(i in,0,0,100)

endpgfonlayer

endtikzpicture
enddocument


enter image description here







tikz-pgf





share












share










share



share










asked 2 hours ago









Roger Wehage

805




805







  • 1




    Commenting to connect this to tex.stackexchange.com/q/33703/86 which may be of some help.
    – Loop Space
    1 hour ago












  • 1




    Commenting to connect this to tex.stackexchange.com/q/33703/86 which may be of some help.
    – Loop Space
    1 hour ago







1




1




Commenting to connect this to tex.stackexchange.com/q/33703/86 which may be of some help.
– Loop Space
1 hour ago




Commenting to connect this to tex.stackexchange.com/q/33703/86 which may be of some help.
– Loop Space
1 hour ago










1 Answer
1






active

oldest

votes

















up vote
4
down vote













I would not do it like this. Rather, I'd use a pic which I put multiple times along a path using decorations. Note that I did not tune your code, rather focus on the methods "putting sth in a pic" and "repeating it in a decoration". However, I really like your clever idea of using layers here!



documentclass[tikz,border=3.14mm]standalone
usetikzlibrarycalc
usetikzlibrarymath
usetikzlibrarydecorations.markings
tikzsetpics/.cd,
link/.style=code=beginscope
tikzmath%Some math to define and position the link components
lp = 0.5in;
re = 0.3299*lp;
rc = 0.4284*lp;
Th = 41.25;
Thc = 90 - Th;
Tp = Thc;
Tn = Thc;

fill[gray!#1] (0,0)%(xs,ys)
arc(Tp:360-Tn):re)
arc(180-Tn:Tp:rc)
arc(-180+Tp:180-Tn:re)
arc(-Tn:-180+Tp:rc)
-- cycle;
endscope

begindocument

begintikzpicture
pgfdeclarelayertop
pgfsetlayersmain,top
pgfonlayermain
path[decorate,decoration=markings,
mark=between positions 0 and 1 step 2.9in
with pic[scale=0.1]link=30;
] (0,0) -- (9in,0);
endpgfonlayer

pgfonlayertop
path[decorate,decoration=markings,
mark=between positions 0 and 1 step 2.9in
with pic[scale=0.1]link=80;
] (1.45in,0) -- (9in,0);
endpgfonlayer

endtikzpicture
enddocument


enter image description here






share|improve this answer




















  • +1 for using pics. Given the mention of angles in the question I think that the point is that the OP wants to draw these links around curves such as, for example, those in tex.stackexchange.com/questions/457784/…. (There seems to be a theme to the OP's posts, and I don't just mean that marmot is the first to answer them:)
    – Andrew
    1 hour ago











  • @Andrew Yes, drawing such a chain along a curve will be slightly more tricky and require something beyond decorations, namely intersections... This can all be done, but I do not see the need to use tikzmath, nor self-written parsers. Of course, I'd love to be proven wrong and learn something new...
    – marmot
    1 hour ago










  • @marmot The chain-wrap C-program with lots of comments is more than 1000 lines, because rotating sprockets and chain segments to align link bushings with tooth pockets requires a lot of geometry and trig operations. And this is just to get initial conditions for a full-fledged dynamic bicycle model.
    – Roger Wehage
    12 mins ago










  • @RogerWehage Well, I might be too optimistic, but I guess one can make it much shorter.
    – marmot
    8 mins ago










Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f458114%2fhow-to-return-and-access-tikz-coordinate-and-real-variable-from-a-drawing-macro%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
4
down vote













I would not do it like this. Rather, I'd use a pic which I put multiple times along a path using decorations. Note that I did not tune your code, rather focus on the methods "putting sth in a pic" and "repeating it in a decoration". However, I really like your clever idea of using layers here!



documentclass[tikz,border=3.14mm]standalone
usetikzlibrarycalc
usetikzlibrarymath
usetikzlibrarydecorations.markings
tikzsetpics/.cd,
link/.style=code=beginscope
tikzmath%Some math to define and position the link components
lp = 0.5in;
re = 0.3299*lp;
rc = 0.4284*lp;
Th = 41.25;
Thc = 90 - Th;
Tp = Thc;
Tn = Thc;

fill[gray!#1] (0,0)%(xs,ys)
arc(Tp:360-Tn):re)
arc(180-Tn:Tp:rc)
arc(-180+Tp:180-Tn:re)
arc(-Tn:-180+Tp:rc)
-- cycle;
endscope

begindocument

begintikzpicture
pgfdeclarelayertop
pgfsetlayersmain,top
pgfonlayermain
path[decorate,decoration=markings,
mark=between positions 0 and 1 step 2.9in
with pic[scale=0.1]link=30;
] (0,0) -- (9in,0);
endpgfonlayer

pgfonlayertop
path[decorate,decoration=markings,
mark=between positions 0 and 1 step 2.9in
with pic[scale=0.1]link=80;
] (1.45in,0) -- (9in,0);
endpgfonlayer

endtikzpicture
enddocument


enter image description here






share|improve this answer




















  • +1 for using pics. Given the mention of angles in the question I think that the point is that the OP wants to draw these links around curves such as, for example, those in tex.stackexchange.com/questions/457784/…. (There seems to be a theme to the OP's posts, and I don't just mean that marmot is the first to answer them:)
    – Andrew
    1 hour ago











  • @Andrew Yes, drawing such a chain along a curve will be slightly more tricky and require something beyond decorations, namely intersections... This can all be done, but I do not see the need to use tikzmath, nor self-written parsers. Of course, I'd love to be proven wrong and learn something new...
    – marmot
    1 hour ago










  • @marmot The chain-wrap C-program with lots of comments is more than 1000 lines, because rotating sprockets and chain segments to align link bushings with tooth pockets requires a lot of geometry and trig operations. And this is just to get initial conditions for a full-fledged dynamic bicycle model.
    – Roger Wehage
    12 mins ago










  • @RogerWehage Well, I might be too optimistic, but I guess one can make it much shorter.
    – marmot
    8 mins ago














up vote
4
down vote













I would not do it like this. Rather, I'd use a pic which I put multiple times along a path using decorations. Note that I did not tune your code, rather focus on the methods "putting sth in a pic" and "repeating it in a decoration". However, I really like your clever idea of using layers here!



documentclass[tikz,border=3.14mm]standalone
usetikzlibrarycalc
usetikzlibrarymath
usetikzlibrarydecorations.markings
tikzsetpics/.cd,
link/.style=code=beginscope
tikzmath%Some math to define and position the link components
lp = 0.5in;
re = 0.3299*lp;
rc = 0.4284*lp;
Th = 41.25;
Thc = 90 - Th;
Tp = Thc;
Tn = Thc;

fill[gray!#1] (0,0)%(xs,ys)
arc(Tp:360-Tn):re)
arc(180-Tn:Tp:rc)
arc(-180+Tp:180-Tn:re)
arc(-Tn:-180+Tp:rc)
-- cycle;
endscope

begindocument

begintikzpicture
pgfdeclarelayertop
pgfsetlayersmain,top
pgfonlayermain
path[decorate,decoration=markings,
mark=between positions 0 and 1 step 2.9in
with pic[scale=0.1]link=30;
] (0,0) -- (9in,0);
endpgfonlayer

pgfonlayertop
path[decorate,decoration=markings,
mark=between positions 0 and 1 step 2.9in
with pic[scale=0.1]link=80;
] (1.45in,0) -- (9in,0);
endpgfonlayer

endtikzpicture
enddocument


enter image description here






share|improve this answer




















  • +1 for using pics. Given the mention of angles in the question I think that the point is that the OP wants to draw these links around curves such as, for example, those in tex.stackexchange.com/questions/457784/…. (There seems to be a theme to the OP's posts, and I don't just mean that marmot is the first to answer them:)
    – Andrew
    1 hour ago











  • @Andrew Yes, drawing such a chain along a curve will be slightly more tricky and require something beyond decorations, namely intersections... This can all be done, but I do not see the need to use tikzmath, nor self-written parsers. Of course, I'd love to be proven wrong and learn something new...
    – marmot
    1 hour ago










  • @marmot The chain-wrap C-program with lots of comments is more than 1000 lines, because rotating sprockets and chain segments to align link bushings with tooth pockets requires a lot of geometry and trig operations. And this is just to get initial conditions for a full-fledged dynamic bicycle model.
    – Roger Wehage
    12 mins ago










  • @RogerWehage Well, I might be too optimistic, but I guess one can make it much shorter.
    – marmot
    8 mins ago












up vote
4
down vote










up vote
4
down vote









I would not do it like this. Rather, I'd use a pic which I put multiple times along a path using decorations. Note that I did not tune your code, rather focus on the methods "putting sth in a pic" and "repeating it in a decoration". However, I really like your clever idea of using layers here!



documentclass[tikz,border=3.14mm]standalone
usetikzlibrarycalc
usetikzlibrarymath
usetikzlibrarydecorations.markings
tikzsetpics/.cd,
link/.style=code=beginscope
tikzmath%Some math to define and position the link components
lp = 0.5in;
re = 0.3299*lp;
rc = 0.4284*lp;
Th = 41.25;
Thc = 90 - Th;
Tp = Thc;
Tn = Thc;

fill[gray!#1] (0,0)%(xs,ys)
arc(Tp:360-Tn):re)
arc(180-Tn:Tp:rc)
arc(-180+Tp:180-Tn:re)
arc(-Tn:-180+Tp:rc)
-- cycle;
endscope

begindocument

begintikzpicture
pgfdeclarelayertop
pgfsetlayersmain,top
pgfonlayermain
path[decorate,decoration=markings,
mark=between positions 0 and 1 step 2.9in
with pic[scale=0.1]link=30;
] (0,0) -- (9in,0);
endpgfonlayer

pgfonlayertop
path[decorate,decoration=markings,
mark=between positions 0 and 1 step 2.9in
with pic[scale=0.1]link=80;
] (1.45in,0) -- (9in,0);
endpgfonlayer

endtikzpicture
enddocument


enter image description here






share|improve this answer












I would not do it like this. Rather, I'd use a pic which I put multiple times along a path using decorations. Note that I did not tune your code, rather focus on the methods "putting sth in a pic" and "repeating it in a decoration". However, I really like your clever idea of using layers here!



documentclass[tikz,border=3.14mm]standalone
usetikzlibrarycalc
usetikzlibrarymath
usetikzlibrarydecorations.markings
tikzsetpics/.cd,
link/.style=code=beginscope
tikzmath%Some math to define and position the link components
lp = 0.5in;
re = 0.3299*lp;
rc = 0.4284*lp;
Th = 41.25;
Thc = 90 - Th;
Tp = Thc;
Tn = Thc;

fill[gray!#1] (0,0)%(xs,ys)
arc(Tp:360-Tn):re)
arc(180-Tn:Tp:rc)
arc(-180+Tp:180-Tn:re)
arc(-Tn:-180+Tp:rc)
-- cycle;
endscope

begindocument

begintikzpicture
pgfdeclarelayertop
pgfsetlayersmain,top
pgfonlayermain
path[decorate,decoration=markings,
mark=between positions 0 and 1 step 2.9in
with pic[scale=0.1]link=30;
] (0,0) -- (9in,0);
endpgfonlayer

pgfonlayertop
path[decorate,decoration=markings,
mark=between positions 0 and 1 step 2.9in
with pic[scale=0.1]link=80;
] (1.45in,0) -- (9in,0);
endpgfonlayer

endtikzpicture
enddocument


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered 1 hour ago









marmot

71k476151




71k476151











  • +1 for using pics. Given the mention of angles in the question I think that the point is that the OP wants to draw these links around curves such as, for example, those in tex.stackexchange.com/questions/457784/…. (There seems to be a theme to the OP's posts, and I don't just mean that marmot is the first to answer them:)
    – Andrew
    1 hour ago











  • @Andrew Yes, drawing such a chain along a curve will be slightly more tricky and require something beyond decorations, namely intersections... This can all be done, but I do not see the need to use tikzmath, nor self-written parsers. Of course, I'd love to be proven wrong and learn something new...
    – marmot
    1 hour ago










  • @marmot The chain-wrap C-program with lots of comments is more than 1000 lines, because rotating sprockets and chain segments to align link bushings with tooth pockets requires a lot of geometry and trig operations. And this is just to get initial conditions for a full-fledged dynamic bicycle model.
    – Roger Wehage
    12 mins ago










  • @RogerWehage Well, I might be too optimistic, but I guess one can make it much shorter.
    – marmot
    8 mins ago
















  • +1 for using pics. Given the mention of angles in the question I think that the point is that the OP wants to draw these links around curves such as, for example, those in tex.stackexchange.com/questions/457784/…. (There seems to be a theme to the OP's posts, and I don't just mean that marmot is the first to answer them:)
    – Andrew
    1 hour ago











  • @Andrew Yes, drawing such a chain along a curve will be slightly more tricky and require something beyond decorations, namely intersections... This can all be done, but I do not see the need to use tikzmath, nor self-written parsers. Of course, I'd love to be proven wrong and learn something new...
    – marmot
    1 hour ago










  • @marmot The chain-wrap C-program with lots of comments is more than 1000 lines, because rotating sprockets and chain segments to align link bushings with tooth pockets requires a lot of geometry and trig operations. And this is just to get initial conditions for a full-fledged dynamic bicycle model.
    – Roger Wehage
    12 mins ago










  • @RogerWehage Well, I might be too optimistic, but I guess one can make it much shorter.
    – marmot
    8 mins ago















+1 for using pics. Given the mention of angles in the question I think that the point is that the OP wants to draw these links around curves such as, for example, those in tex.stackexchange.com/questions/457784/…. (There seems to be a theme to the OP's posts, and I don't just mean that marmot is the first to answer them:)
– Andrew
1 hour ago





+1 for using pics. Given the mention of angles in the question I think that the point is that the OP wants to draw these links around curves such as, for example, those in tex.stackexchange.com/questions/457784/…. (There seems to be a theme to the OP's posts, and I don't just mean that marmot is the first to answer them:)
– Andrew
1 hour ago













@Andrew Yes, drawing such a chain along a curve will be slightly more tricky and require something beyond decorations, namely intersections... This can all be done, but I do not see the need to use tikzmath, nor self-written parsers. Of course, I'd love to be proven wrong and learn something new...
– marmot
1 hour ago




@Andrew Yes, drawing such a chain along a curve will be slightly more tricky and require something beyond decorations, namely intersections... This can all be done, but I do not see the need to use tikzmath, nor self-written parsers. Of course, I'd love to be proven wrong and learn something new...
– marmot
1 hour ago












@marmot The chain-wrap C-program with lots of comments is more than 1000 lines, because rotating sprockets and chain segments to align link bushings with tooth pockets requires a lot of geometry and trig operations. And this is just to get initial conditions for a full-fledged dynamic bicycle model.
– Roger Wehage
12 mins ago




@marmot The chain-wrap C-program with lots of comments is more than 1000 lines, because rotating sprockets and chain segments to align link bushings with tooth pockets requires a lot of geometry and trig operations. And this is just to get initial conditions for a full-fledged dynamic bicycle model.
– Roger Wehage
12 mins ago












@RogerWehage Well, I might be too optimistic, but I guess one can make it much shorter.
– marmot
8 mins ago




@RogerWehage Well, I might be too optimistic, but I guess one can make it much shorter.
– marmot
8 mins ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f458114%2fhow-to-return-and-access-tikz-coordinate-and-real-variable-from-a-drawing-macro%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?