Porzione di sfera con Tikz

  • Creatore
    Topic
  • #67956
    Andrea
    Partecipante
      Up
      0
      Down
      ::


      Salve a tutti,
      sto cercando di disegnare una porzione di calotta sferica con tikz. Il codice che ho realizzato sin qui è il seguente
      `
      \begin{tikzpicture}[%
      scale=2,
      >=latex,
      every pin edge/.style={solid,help lines,},
      proiez/.style={dotted},
      archi/.style={thin,->},
      vett/.style={thick,->},
      assi/.style={thin,->}
      ]

      \draw[help lines,step=.5] (-5,-5) grid (5,5);

      %Sfera
      \draw[name path=arco] (4,0) arc (0:-180:4 and 1);
      \draw[dashed] (4,0) arc (0:180:4 and 1);
      \draw (4,0) arc (0:180:4);

      %AREA
      %Base
      {[pin distance=.6cm,]
      \path[fill=black!20] (-.4,-.25)–++(.5,0)–++(+.5,+.5)–++(-.5,0)–cycle;
      \draw (-.4,-.25)–++(.5,0)– ++(+.5,+.5);
      \draw[dashed](-.4,-.25)++(.5,0)++(+.5,+.5)–++(-.5,0)node(p3)[coordinate]{}–++(-.5,-.5);
      \draw (-.4,-.25)–node[coordinate,pin=below:$deA$](dA){}++(.5,0);
      }
      %Tri
      \draw (-.4,-.25)node(p0)[coordinate]{}++(.5,0)–++(150:.5) node[coordinate](p1){}–(p0);
      \draw (-.4,-.25)++(.5,0)++(+.5,+.5)–++(150:.5) node[coordinate](p2){}–(p3);
      \draw (p1)–node[coordinate,pin=above left:$deA_n$](dAn){}(p2);

      %Assi
      \draw[assi] (-0.1,0) — (5,0);
      \draw[assi] (0,-.1) — (0,5);

      %Raggio
      \path[name path=raggio] (0,0)–(-135:3);
      \draw[name intersections={of=arco and raggio, by={R}},vett] (0,0)– (R) node[below=.2 of R]{$R$};

      %Proiezioni
      \path[name path=rP] (0,0)–+(60:4);
      \path[name path=yP] (-30:1.5)–+(0,4);
      %Raggio P
      \draw[name intersections={of=rP and yP, by={[pin=below left:$P$]P}},vett] (0,0)–(P);
      \path[name path=xP] (0,0)–(-30:2);
      \draw[name intersections={of=yP and xP, by={Pn}},proiez] (0,0)–(Pn)–(P);
      %Vett normale
      \draw[vett] (P)–+(60:.5) node(n)[label=$n$,coordinate]{};

      %Angoli
      \draw[archi] (-.5,0) arc (-180:-30:.5);
      \node at (.2,-.6) {$\theta$};
      \draw[archi] (0,1.5) arc (90:60:1.5);
      \node at (.5,1.55) {$\beta$};

      %Area P
      {[rotate=45,]
      \draw (P)++(-.2,-.2) arc (180:0:.2 and -.04) arc (-90:90:.04 and .2) arc (0:180:.2 and -.04) arc (90:270:-.04 and .2);
      }

      \end{tikzpicture}
      `
      (è solo una bozza, quindi il “matematichese” è solo provvisorio 🙂 )

      La mia domanda è: come posso migliorare la resa della pozione di area sferica attorno al punto P?

      Le librerie che carico (per la maggior parte non necessarie…)
      `
      % PGF style template to be used in the ktikz program
      \documentclass{article}
      \usepackage{amsmath}
      %\usepackage[symbols]{circuitikz}
      \usepackage{pgfplots}
      \usepackage{tikz,fp}

      %Librerie TikZ
      \usetikzlibrary{intersections,% for intersections
      arrows,% for the special arrow
      backgrounds,% for backgroud
      fit, % to compute the sizes of these rectangles
      positioning, % for placing nodes relative to other nodes.
      petri,% for Petr's net
      calc, %
      through, %
      mindmap,% for maps
      calendar,% for calendars
      shapes.geometric, % for other shapes
      shapes.misc, % for other shapes
      chains, % for chains
      scopes, % for replaces scope with {}
      circuits.ee.IEC,
      decorations,
      decorations.pathmorphing,% for “snaking line”
      decorations.markings,
      decorations.pathreplacing,%
      fixedpointarithmetic
      }
      %\usepackage{color}
      \usepackage[active,pdftex,tightpage]{preview}
      \PreviewEnvironment[]{tikzpicture}
      \PreviewEnvironment[]{pgfpicture}
      \begin{document}
      <>
      \end{document}

      `

      Grazie in anticipo.

      PS: se avete altri suggerimenti sono, come sempre, bene accetti.

    Visualizzazione 1 filone di risposte
    • Autore
      Risposte
      • #67957
        Up
        0
        Down
        ::

        Iovem” post=66988Salve a tutti,
        sto cercando di disegnare una porzione di calotta sferica con tikz. Il codice che ho realizzato sin qui è il seguente
        `
        \begin{tikzpicture}[%
        scale=2,
        >=latex,
        every pin edge/.style={solid,help lines,},
        proiez/.style={dotted},
        archi/.style={thin,->},
        vett/.style={thick,->},
        assi/.style={thin,->}
        ]

        \draw[help lines,step=.5] (-5,-5) grid (5,5);

        %Sfera
        \draw[name path=arco] (4,0) arc (0:-180:4 and 1);
        \draw[dashed] (4,0) arc (0:180:4 and 1);
        \draw (4,0) arc (0:180:4);

        %AREA
        %Base
        {[pin distance=.6cm,]
        \path[fill=black!20] (-.4,-.25)–++(.5,0)–++(+.5,+.5)–++(-.5,0)–cycle;
        \draw (-.4,-.25)–++(.5,0)– ++(+.5,+.5);
        \draw[dashed](-.4,-.25)++(.5,0)++(+.5,+.5)–++(-.5,0)node(p3)[coordinate]{}–++(-.5,-.5);
        \draw (-.4,-.25)–node[coordinate,pin=below:$deA$](dA){}++(.5,0);
        }
        %Tri
        \draw (-.4,-.25)node(p0)[coordinate]{}++(.5,0)–++(150:.5) node[coordinate](p1){}–(p0);
        \draw (-.4,-.25)++(.5,0)++(+.5,+.5)–++(150:.5) node[coordinate](p2){}–(p3);
        \draw (p1)–node[coordinate,pin=above left:$deA_n$](dAn){}(p2);

        %Assi
        \draw[assi] (-0.1,0) — (5,0);
        \draw[assi] (0,-.1) — (0,5);

        %Raggio
        \path[name path=raggio] (0,0)–(-135:3);
        \draw[name intersections={of=arco and raggio, by={R}},vett] (0,0)– (R) node[below=.2 of R]{$R$};

        %Proiezioni
        \path[name path=rP] (0,0)–+(60:4);
        \path[name path=yP] (-30:1.5)–+(0,4);
        %Raggio P
        \draw[name intersections={of=rP and yP, by={[pin=below left:$P$]P}},vett] (0,0)–(P);
        \path[name path=xP] (0,0)–(-30:2);
        \draw[name intersections={of=yP and xP, by={Pn}},proiez] (0,0)–(Pn)–(P);
        %Vett normale
        \draw[vett] (P)–+(60:.5) node(n)[label=$n$,coordinate]{};

        %Angoli
        \draw[archi] (-.5,0) arc (-180:-30:.5);
        \node at (.2,-.6) {$\theta$};
        \draw[archi] (0,1.5) arc (90:60:1.5);
        \node at (.5,1.55) {$\beta$};

        %Area P
        {[rotate=45,]
        \draw (P)++(-.2,-.2) arc (180:0:.2 and -.04) arc (-90:90:.04 and .2) arc (0:180:.2 and -.04) arc (90:270:-.04 and .2);
        }

        \end{tikzpicture}
        `
        (è solo una bozza, quindi il “matematichese” è solo provvisorio 🙂 )

        La mia domanda è: come posso migliorare la resa della pozione di area sferica attorno al punto P?

        Le librerie che carico (per la maggior parte non necessarie…)
        `
        % PGF style template to be used in the ktikz program
        \documentclass{article}
        \usepackage{amsmath}
        %\usepackage[symbols]{circuitikz}
        \usepackage{pgfplots}
        \usepackage{tikz,fp}

        %Librerie TikZ
        \usetikzlibrary{intersections,% for intersections
        arrows,% for the special arrow
        backgrounds,% for backgroud
        fit, % to compute the sizes of these rectangles
        positioning, % for placing nodes relative to other nodes.
        petri,% for Petr's net
        calc, %
        through, %
        mindmap,% for maps
        calendar,% for calendars
        shapes.geometric, % for other shapes
        shapes.misc, % for other shapes
        chains, % for chains
        scopes, % for replaces scope with {}
        circuits.ee.IEC,
        decorations,
        decorations.pathmorphing,% for “snaking line”
        decorations.markings,
        decorations.pathreplacing,%
        fixedpointarithmetic
        }
        %\usepackage{color}
        \usepackage[active,pdftex,tightpage]{preview}
        \PreviewEnvironment[]{tikzpicture}
        \PreviewEnvironment[]{pgfpicture}
        \begin{document}
        <>
        \end{document}

        `

        Grazie in anticipo.

        PS: se avete altri suggerimenti sono, come sempre, bene accetti.

        Ciao,

        su texample ci sono degli esempi che potresti trovare interessanti: esempio 1, esempio 2 e esempio 3 .

        Ciao
        Claudio

      • #67958
        Andrea
        Partecipante
          Up
          0
          Down
          ::


          Grazie mille! Niente a che vedere con la mia grezza soluzione…

          Ciao

      Visualizzazione 1 filone di risposte
      • Devi essere connesso per rispondere a questo topic.

      Go to top