Linie ein Stück verlängern

Tabellen und Grafiken erstellen und anordnen


Norbert32
Forum-Anfänger
Forum-Anfänger
Beiträge: 13
Registriert: Do 8. Sep 2016, 15:06
Wohnort: Potsdam

Linie ein Stück verlängern

Beitrag von Norbert32 »

Hallo, hallo...

Ich hab mal wieder eine (kleine ??) Frage.

In folgendem Code soll die Linie, die von Z2 ausgeht ein kleines Stück über den Schnittpunkt hinausgehen. Wie kann das gehen?

Für Hilfe bin ich wieder dankbar!!
\documentclass[a4paper, 11pt]{scrartcl}	
\usepackage{amsmath, amssymb, amsfonts, amsthm}
\usepackage{tikz}
\usetikzlibrary{intersections,angles,quotes,calc,through}


\begin{document}

\begin{tikzpicture}
% Grundfläche
\coordinate (G1) at (0,0);		% links vorne
\coordinate (G2) at (10,0);		% rechts vorne
\coordinate (G3) at (15,5);		% rechts hinten
\coordinate (G4) at (5,5);		% links hinten

% senkrechte Fläche
\coordinate (E1) at (4,4);		% links mitte
\coordinate (E2) at (14,4);		% rechts unten
\coordinate (E3) at (14,7);		% rechtsoben oben
\coordinate (E4) at (4,7);		% links oben

%Hilfspunkt hinten rechts
\coordinate (X1) at (intersection of E2--E3 and G3--G4);

% Fusspunkte A,B,C
\coordinate (FPA) at (7,4);			
\coordinate	(FPB) at (9.8,4);
\coordinate (FPC) at (8.5,4);
% das Dreick in der Mitte
\coordinate[label=0:$A$] (A) at ($(FPA)!1.5cm!90:(E2)$);
\coordinate[label=70:$B$] (B) at ($(FPB)!1.8cm!90:(E2)$);
\coordinate[label=90:$C$] (C) at ($(FPC)!2.5cm!90:(E2)$);



% Z und Z'
\coordinate[label=-90:$Z'$] (Z') at (9.5,5);
\coordinate[label=0:$Z1$] (Z1) at (9.5,9);
\coordinate[label=0:$Z2$] (Z2) at ($(Z1) - (0,1)$);
\coordinate (W1) at (4.5,0);		%kann man W1 berechnen als Parallele zu G2-G3?

% Schnittpunkt Z - Z' mit oberer Linie
\coordinate (XZ) at (intersection of Z'--Z1 and E3--E4);

% Hilfspunkte
\coordinate (AX1') at (intersection of Z1--A and E3--E4);
\coordinate (AX2') at (intersection of Z2--A and E3--E4);

\coordinate (A'1) at (intersection of Z1--A and Z'--FPA);
\coordinate (A'2) at (intersection of Z2--A and Z'--FPA);
\coordinate (AY') at (intersection of Z'--FPA and E1--G1);


\tikzstyle{every to}=[draw,dashed]
\draw (E1) -- (G1) -- (G2) -- (G3) -- (G3) -- (X1);
\draw[thick] (A) -- (B) -- (C) -- cycle;
\draw (E1) -- (E2) -- (E3) -- (E4) -- cycle;
\draw[dashed] (X1) -- (G4) -- (E1);
\draw (A) -- (FPA);
\draw (B) -- (FPB);
\draw (C) -- (FPC);
\draw[dashed] (Z') -- (XZ);
\draw (XZ) -- (Z1);
\draw (W1) -- (FPC);
\draw[dashed] (FPC) -- (Z');

\draw (A) -- (A'2);
\draw (Z2) -- (AX2');
\draw[dashed] (AX2') -- (A);

\draw[dashed] (Z') -- (FPA);
\draw (FPA) -- (AY');

\draw[fill=gray!30,opacity=0.2] (A)--(B)--(C)-- cycle;
\end{tikzpicture}

\end{document}
Vielen Dank, Norbert

Noch so einer

Beitrag von Noch so einer »

Über welchen Schnittpunkt? Meinst Du so:
\documentclass[a4paper, 11pt]{scrartcl}
\usepackage{amsmath, amssymb, amsfonts, amsthm}
\usepackage{tikz}
\usetikzlibrary{intersections,angles,quotes,calc,through}


\begin{document}

\begin{tikzpicture}
% Grundfläche
\coordinate (G1) at (0,0); % links vorne
\coordinate (G2) at (10,0); % rechts vorne
\coordinate (G3) at (15,5); % rechts hinten
\coordinate (G4) at (5,5); % links hinten

% senkrechte Fläche
\coordinate (E1) at (4,4); % links mitte
\coordinate (E2) at (14,4); % rechts unten
\coordinate (E3) at (14,7); % rechtsoben oben
\coordinate (E4) at (4,7); % links oben

%Hilfspunkt hinten rechts
\coordinate (X1) at (intersection of E2--E3 and G3--G4);

% Fusspunkte A,B,C
\coordinate (FPA) at (7,4);
\coordinate (FPB) at (9.8,4);
\coordinate (FPC) at (8.5,4);
% das Dreick in der Mitte
\coordinate[label=0:$A$] (A) at ($(FPA)!1.5cm!90:(E2)$);
\coordinate[label=70:$B$] (B) at ($(FPB)!1.8cm!90:(E2)$);
\coordinate[label=90:$C$] (C) at ($(FPC)!2.5cm!90:(E2)$);



% Z und Z'
\coordinate[label=-90:$Z'$] (Z') at (9.5,5);
\coordinate[label=0:$Z1$] (Z1) at (9.5,9);
\coordinate[label=0:$Z2$] (Z2) at ($(Z1) - (0,1)$);
\coordinate (W1) at (4.5,0); %kann man W1 berechnen als Parallele zu G2-G3?

% Schnittpunkt Z - Z' mit oberer Linie
\coordinate (XZ) at (intersection of Z'--Z1 and E3--E4);

% Hilfspunkte
\coordinate (AX1') at (intersection of Z1--A and E3--E4);
\coordinate (AX2') at (intersection of Z2--A and E3--E4);

\coordinate (A'1) at (intersection of Z1--A and Z'--FPA);
\coordinate (A'2) at (intersection of Z2--A and Z'--FPA);
\coordinate (AY') at (intersection of Z'--FPA and E1--G1);


\tikzstyle{every to}=[draw,dashed]
\draw (E1) -- (G1) -- (G2) -- (G3) -- (G3) -- (X1);
\draw[thick] (A) -- (B) -- (C) -- cycle;
\draw (E1) -- (E2) -- (E3) -- (E4) -- cycle;
\draw[dashed] (X1) -- (G4) -- (E1);
\draw (A) -- (FPA);
\draw (B) -- (FPB);
\draw (C) -- (FPC);
\draw[dashed] (Z') -- (XZ);
\draw (XZ) -- (Z1);
\draw (W1) -- (FPC);
\draw[dashed] (FPC) -- (Z');

\draw (A) -- (A'2);
\draw ($(Z2)+(1,1)$) -- (AX2');
\draw[dashed] (AX2') -- (A);

\draw[dashed] (Z') -- (FPA);
\draw (FPA) -- (AY');

\draw[fill=gray!30,opacity=0.2] (A)--(B)--(C)-- cycle;
\end{tikzpicture}

\end{document}
Wenn nicht, die Addition kannst Du natürlich auch mit anderen Werten und bei anderen Knoten anwenden. Näheres findest Du in der [d]pgf[/d]-Anleitung.

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag von esdd »

Linien verkürzen kann man mit den Optionen shorten > bzw. shorten <. Wählt man dabe negative Längen werden die Linien verlängert statt verkürzt.

Beispiel:
\documentclass{standalone}
\usepackage{tikz}
\tikzset{
    punkt/.style={circle,fill=gray,inner sep=2pt}
}

\begin{document}
\begin{tikzpicture}
  \draw[help lines](0,0)grid(4,3);
  \path
    (1,1) coordinate(A) node[punkt,label=below:A]{}
    (3,2) coordinate(B) node[punkt,label=below:B]{}
  ;
  \draw[
    shorten < = -5mm, % über die Startkoordinate hinaus verlängern
    shorten > = 5mm % vor der Endkoordinate verkürzen
  ](A)--(B);
\end{tikzpicture}
\end{document} 
Eine weitere Möglichkeit bietet die von Dir sowieso genutzte calc Bibliothek:
\documentclass{standalone} 
\usepackage{tikz} 
\usetikzlibrary{calc}

\tikzset{ 
     punkt/.style={circle,fill=gray,inner sep=2pt} 
} 

\begin{document} 
\begin{tikzpicture} 
   \draw[help lines](0,0)grid(4,3); 
   \path 
     (1,1) coordinate(A) node[punkt,label=below:A]{} 
     (3,2) coordinate(B) node[punkt,label=below:B]{} 
   ; 
   \draw($(B)!1.2!(A)$)--($(A)!1.2!(B)$); 
\end{tikzpicture} 
\end{document}

Antworten