Draw arc using relative coordinates with tikz

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











up vote
2
down vote

favorite












My quetion may be dumb, but consider that I am very new with Tikz.



I am trying to draw a tower similar to Eifel using the following code



documentclassarticle
usepackagetikz
usetikzlibraryshapes.geometric
usetikzlibraryshapes.misc

begindocument

begintikzpicture[x=(1mm,0),y=(0,1mm)]
deftowerwd5 % tower width
deftowerht10 % tower height
deftowerar4*towerwd/10 % tower arc radius

deftower#1% #1=position
draw[thick]
%... tower arc
#1++(-towerar,0)
arc(180:0:towerar)--
(towerwd/2,0) to[out=120,in=270]
(0,towerht) to[out=270,in=60]
(-towerwd/2,0)--
cycle
;


tower(0,0) % this works!
tower(0,20) % this is messy!
endtikzpicture

enddocument


It works fine when I do tower(0,0), but becomes messy when I use any other coordinate. What am I doing wrong here?










share|improve this question



















  • 1




    Welcome to TeX.SX! Can you please expand the code snippet that you have posted to a full minimal working example. It is much easier to help you if we can start with some compilable code that illustrates your problem. A MWE should start with a documentclass command, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to guess what packages etc you are using before we can compile your code.
    – Andrew
    6 hours ago










  • Yes, sure! I will edit my question. Thank you, @Andrew
    – Brasil
    6 hours ago














up vote
2
down vote

favorite












My quetion may be dumb, but consider that I am very new with Tikz.



I am trying to draw a tower similar to Eifel using the following code



documentclassarticle
usepackagetikz
usetikzlibraryshapes.geometric
usetikzlibraryshapes.misc

begindocument

begintikzpicture[x=(1mm,0),y=(0,1mm)]
deftowerwd5 % tower width
deftowerht10 % tower height
deftowerar4*towerwd/10 % tower arc radius

deftower#1% #1=position
draw[thick]
%... tower arc
#1++(-towerar,0)
arc(180:0:towerar)--
(towerwd/2,0) to[out=120,in=270]
(0,towerht) to[out=270,in=60]
(-towerwd/2,0)--
cycle
;


tower(0,0) % this works!
tower(0,20) % this is messy!
endtikzpicture

enddocument


It works fine when I do tower(0,0), but becomes messy when I use any other coordinate. What am I doing wrong here?










share|improve this question



















  • 1




    Welcome to TeX.SX! Can you please expand the code snippet that you have posted to a full minimal working example. It is much easier to help you if we can start with some compilable code that illustrates your problem. A MWE should start with a documentclass command, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to guess what packages etc you are using before we can compile your code.
    – Andrew
    6 hours ago










  • Yes, sure! I will edit my question. Thank you, @Andrew
    – Brasil
    6 hours ago












up vote
2
down vote

favorite









up vote
2
down vote

favorite











My quetion may be dumb, but consider that I am very new with Tikz.



I am trying to draw a tower similar to Eifel using the following code



documentclassarticle
usepackagetikz
usetikzlibraryshapes.geometric
usetikzlibraryshapes.misc

begindocument

begintikzpicture[x=(1mm,0),y=(0,1mm)]
deftowerwd5 % tower width
deftowerht10 % tower height
deftowerar4*towerwd/10 % tower arc radius

deftower#1% #1=position
draw[thick]
%... tower arc
#1++(-towerar,0)
arc(180:0:towerar)--
(towerwd/2,0) to[out=120,in=270]
(0,towerht) to[out=270,in=60]
(-towerwd/2,0)--
cycle
;


tower(0,0) % this works!
tower(0,20) % this is messy!
endtikzpicture

enddocument


It works fine when I do tower(0,0), but becomes messy when I use any other coordinate. What am I doing wrong here?










share|improve this question















My quetion may be dumb, but consider that I am very new with Tikz.



I am trying to draw a tower similar to Eifel using the following code



documentclassarticle
usepackagetikz
usetikzlibraryshapes.geometric
usetikzlibraryshapes.misc

begindocument

begintikzpicture[x=(1mm,0),y=(0,1mm)]
deftowerwd5 % tower width
deftowerht10 % tower height
deftowerar4*towerwd/10 % tower arc radius

deftower#1% #1=position
draw[thick]
%... tower arc
#1++(-towerar,0)
arc(180:0:towerar)--
(towerwd/2,0) to[out=120,in=270]
(0,towerht) to[out=270,in=60]
(-towerwd/2,0)--
cycle
;


tower(0,0) % this works!
tower(0,20) % this is messy!
endtikzpicture

enddocument


It works fine when I do tower(0,0), but becomes messy when I use any other coordinate. What am I doing wrong here?







tikz-pgf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 6 hours ago

























asked 6 hours ago









Brasil

186112




186112







  • 1




    Welcome to TeX.SX! Can you please expand the code snippet that you have posted to a full minimal working example. It is much easier to help you if we can start with some compilable code that illustrates your problem. A MWE should start with a documentclass command, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to guess what packages etc you are using before we can compile your code.
    – Andrew
    6 hours ago










  • Yes, sure! I will edit my question. Thank you, @Andrew
    – Brasil
    6 hours ago












  • 1




    Welcome to TeX.SX! Can you please expand the code snippet that you have posted to a full minimal working example. It is much easier to help you if we can start with some compilable code that illustrates your problem. A MWE should start with a documentclass command, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to guess what packages etc you are using before we can compile your code.
    – Andrew
    6 hours ago










  • Yes, sure! I will edit my question. Thank you, @Andrew
    – Brasil
    6 hours ago







1




1




Welcome to TeX.SX! Can you please expand the code snippet that you have posted to a full minimal working example. It is much easier to help you if we can start with some compilable code that illustrates your problem. A MWE should start with a documentclass command, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to guess what packages etc you are using before we can compile your code.
– Andrew
6 hours ago




Welcome to TeX.SX! Can you please expand the code snippet that you have posted to a full minimal working example. It is much easier to help you if we can start with some compilable code that illustrates your problem. A MWE should start with a documentclass command, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to guess what packages etc you are using before we can compile your code.
– Andrew
6 hours ago












Yes, sure! I will edit my question. Thank you, @Andrew
– Brasil
6 hours ago




Yes, sure! I will edit my question. Thank you, @Andrew
– Brasil
6 hours ago










1 Answer
1






active

oldest

votes

















up vote
4
down vote



accepted










It becomes messy because ++ does not add these coordinates, you might use calc for that if there was not a (IMHO) much more elegant way: pics.



documentclassarticle
usepackagetikz
usetikzlibraryshapes.geometric
usetikzlibraryshapes.misc

begindocument
tikzsetpics/.cd,
tower/.style=code=
draw[thick]
(-towerar,0)
arc(180:0:towerar)--
(towerwd/2,0) to[out=120,in=270]
(0,towerht) to[out=270,in=60]
(-towerwd/2,0)--
cycle
;


begintikzpicture[x=(1mm,0),y=(0,1mm)]
deftowerwd5 % tower width
deftowerht10 % tower height
deftowerar4*towerwd/10 % tower arc radius
path (0,0) pictower (0,20) pictower;
endtikzpicture

enddocument


enter image description here






share|improve this answer




















    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%2f459391%2fdraw-arc-using-relative-coordinates-with-tikz%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



    accepted










    It becomes messy because ++ does not add these coordinates, you might use calc for that if there was not a (IMHO) much more elegant way: pics.



    documentclassarticle
    usepackagetikz
    usetikzlibraryshapes.geometric
    usetikzlibraryshapes.misc

    begindocument
    tikzsetpics/.cd,
    tower/.style=code=
    draw[thick]
    (-towerar,0)
    arc(180:0:towerar)--
    (towerwd/2,0) to[out=120,in=270]
    (0,towerht) to[out=270,in=60]
    (-towerwd/2,0)--
    cycle
    ;


    begintikzpicture[x=(1mm,0),y=(0,1mm)]
    deftowerwd5 % tower width
    deftowerht10 % tower height
    deftowerar4*towerwd/10 % tower arc radius
    path (0,0) pictower (0,20) pictower;
    endtikzpicture

    enddocument


    enter image description here






    share|improve this answer
























      up vote
      4
      down vote



      accepted










      It becomes messy because ++ does not add these coordinates, you might use calc for that if there was not a (IMHO) much more elegant way: pics.



      documentclassarticle
      usepackagetikz
      usetikzlibraryshapes.geometric
      usetikzlibraryshapes.misc

      begindocument
      tikzsetpics/.cd,
      tower/.style=code=
      draw[thick]
      (-towerar,0)
      arc(180:0:towerar)--
      (towerwd/2,0) to[out=120,in=270]
      (0,towerht) to[out=270,in=60]
      (-towerwd/2,0)--
      cycle
      ;


      begintikzpicture[x=(1mm,0),y=(0,1mm)]
      deftowerwd5 % tower width
      deftowerht10 % tower height
      deftowerar4*towerwd/10 % tower arc radius
      path (0,0) pictower (0,20) pictower;
      endtikzpicture

      enddocument


      enter image description here






      share|improve this answer






















        up vote
        4
        down vote



        accepted







        up vote
        4
        down vote



        accepted






        It becomes messy because ++ does not add these coordinates, you might use calc for that if there was not a (IMHO) much more elegant way: pics.



        documentclassarticle
        usepackagetikz
        usetikzlibraryshapes.geometric
        usetikzlibraryshapes.misc

        begindocument
        tikzsetpics/.cd,
        tower/.style=code=
        draw[thick]
        (-towerar,0)
        arc(180:0:towerar)--
        (towerwd/2,0) to[out=120,in=270]
        (0,towerht) to[out=270,in=60]
        (-towerwd/2,0)--
        cycle
        ;


        begintikzpicture[x=(1mm,0),y=(0,1mm)]
        deftowerwd5 % tower width
        deftowerht10 % tower height
        deftowerar4*towerwd/10 % tower arc radius
        path (0,0) pictower (0,20) pictower;
        endtikzpicture

        enddocument


        enter image description here






        share|improve this answer












        It becomes messy because ++ does not add these coordinates, you might use calc for that if there was not a (IMHO) much more elegant way: pics.



        documentclassarticle
        usepackagetikz
        usetikzlibraryshapes.geometric
        usetikzlibraryshapes.misc

        begindocument
        tikzsetpics/.cd,
        tower/.style=code=
        draw[thick]
        (-towerar,0)
        arc(180:0:towerar)--
        (towerwd/2,0) to[out=120,in=270]
        (0,towerht) to[out=270,in=60]
        (-towerwd/2,0)--
        cycle
        ;


        begintikzpicture[x=(1mm,0),y=(0,1mm)]
        deftowerwd5 % tower width
        deftowerht10 % tower height
        deftowerar4*towerwd/10 % tower arc radius
        path (0,0) pictower (0,20) pictower;
        endtikzpicture

        enddocument


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 6 hours ago









        marmot

        73.7k479154




        73.7k479154



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f459391%2fdraw-arc-using-relative-coordinates-with-tikz%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?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay