Skip to main content
The 2024 Developer Survey results are live! See the results
Provided non-cheating code, when fixed point (fx) is used strictly
Source Link
MS-SPO
  • 13.9k
  • 2
  • 15
  • 46

2nd approach, non-cheating version

The "cheating" in the 2nd approach comes from predefining ALL 4 lines upper back ... lower foreground. When using the fixed point (fx) correctly, one of them needs to be calculated from the rest.

In belows code line lower back is calculated for the first object drawn, here membran. Once lower back is known as path lb it's simply used for the others, like in the 2nd approach above.

This way there is NO more cheating wrt (fx).

noncheating

\documentclass[10pt,border=3mm,tikz]{standalone}
\usetikzlibrary{intersections}

\begin{document}
 \begin{tikzpicture}[
    hlp/.style={teal,opacity=.5}, % reduce opacity to make less visible
    ae/.style={anchor = east},
    an/.style={anchor = north},
    mb/.style={line width=2pt},
 ]
 
    % ~~~ construction lines ~~~~~~~ 
    \draw[hlp,name path=hor] (-8, 0  )  node[ae]{horizon}    -- (8,0);
    \draw[hlp,name path=ub]  (-8,-2  )  node[ae]{upper back} -- (8,-2);
    \draw[hlp,name path=uf]  (-8,-3.5)  node[ae]{upper forgr}-- (8,-3.5);
    % ~~~ don't predefine lower back line ~~~~~~~~~~~~~~
%   \draw[hlp,name path=lb]  (-8,-6.5)  node[ae]{lower back} -- (8,-6.5);
    \draw[hlp,name path=lf]  (-8,-8.5)  node[ae]{lower forgr}-- (8,-8.5);
    
    % ~~~ fixpoint ~~~~~~~
    \coordinate (fx) at (3,0);
        
    % ~~~ membran ~~~~~~~~~~~
    \draw[hlp,name path=ln1] (fx) -- +(230:7);          % start direction
    \path[name intersections={of=ln1 and ub, by=P1}];
    \path[name intersections={of=ln1 and uf, by=P2}];
    \draw[hlp,name path=ln1a](P2) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1a and lf, by=P3}];
    \draw[hlp,dashed,name path=ln1c](P3) -- (fx);       % to show NO cheating   
    \draw[hlp,name path=ln1b](P1) -- +(0,-5);           % vert. down
    % ~~~ calculate, where lower back line should be ~~~~~~~~
    \path[name intersections={of=ln1b and ln1c, by=P4}];    % <= !
    \draw[opacity=0] (P4) -- +(-10,0) coordinate (P5);
    \draw[hlp,name path=lb,]  (P5)  node[ae]{lower back} --+(17,0);

    \draw[mb,fill=none] (P1) -- (P2) -- (P3) node[an]{membrane} -- (P4) -- cycle;


    % ~~~ frame ~~~~~~~~~~~
    \draw[hlp,name path=ln1] (fx) -- +(300:7);          % start direction
    \path[name intersections={of=ln1 and ub, by=F1}];
    \path[name intersections={of=ln1 and uf, by=F2}];
    \draw[hlp,name path=ln1a](F2) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1a and lf, by=F3}];
    \draw[hlp,dashed]        (F3) -- (fx);              % to show NO cheating   
    \draw[hlp,name path=ln1b](F1) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1b and lb, by=F4}];

    \draw[mb] (F1) -- (F2) -- (F3) node[an]{frame} -- (F4) -- cycle;


    % ~~~ biplane ~~~~~~~~~~~
    \draw[hlp,name path=ln1] (fx) -- +(215:10);         % start direction
    \path[name intersections={of=ln1 and ub, by=B1}];
    \path[name intersections={of=ln1 and uf, by=B2}];
    \draw[hlp,name path=ln1a](B2) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1a and lf, by=B3}];
    \draw[hlp,dashed]        (B3) -- (fx);              % to show NO cheating   
    \draw[hlp,name path=ln1b](B1) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1b and lb, by=B4}];

    \draw[mb] (B1) -- (B2) -- (B3) node[an]{biplane} -- (B4) -- cycle;
 \end{tikzpicture}
\end{document}

2nd approach, non-cheating version

The "cheating" in the 2nd approach comes from predefining ALL 4 lines upper back ... lower foreground. When using the fixed point (fx) correctly, one of them needs to be calculated from the rest.

In belows code line lower back is calculated for the first object drawn, here membran. Once lower back is known as path lb it's simply used for the others, like in the 2nd approach above.

This way there is NO more cheating wrt (fx).

noncheating

\documentclass[10pt,border=3mm,tikz]{standalone}
\usetikzlibrary{intersections}

\begin{document}
 \begin{tikzpicture}[
    hlp/.style={teal,opacity=.5}, % reduce opacity to make less visible
    ae/.style={anchor = east},
    an/.style={anchor = north},
    mb/.style={line width=2pt},
 ]
 
    % ~~~ construction lines ~~~~~~~ 
    \draw[hlp,name path=hor] (-8, 0  )  node[ae]{horizon}    -- (8,0);
    \draw[hlp,name path=ub]  (-8,-2  )  node[ae]{upper back} -- (8,-2);
    \draw[hlp,name path=uf]  (-8,-3.5)  node[ae]{upper forgr}-- (8,-3.5);
    % ~~~ don't predefine lower back line ~~~~~~~~~~~~~~
%   \draw[hlp,name path=lb]  (-8,-6.5)  node[ae]{lower back} -- (8,-6.5);
    \draw[hlp,name path=lf]  (-8,-8.5)  node[ae]{lower forgr}-- (8,-8.5);
    
    % ~~~ fixpoint ~~~~~~~
    \coordinate (fx) at (3,0);
        
    % ~~~ membran ~~~~~~~~~~~
    \draw[hlp,name path=ln1] (fx) -- +(230:7);          % start direction
    \path[name intersections={of=ln1 and ub, by=P1}];
    \path[name intersections={of=ln1 and uf, by=P2}];
    \draw[hlp,name path=ln1a](P2) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1a and lf, by=P3}];
    \draw[hlp,dashed,name path=ln1c](P3) -- (fx);       % to show NO cheating   
    \draw[hlp,name path=ln1b](P1) -- +(0,-5);           % vert. down
    % ~~~ calculate, where lower back line should be ~~~~~~~~
    \path[name intersections={of=ln1b and ln1c, by=P4}];    % <= !
    \draw[opacity=0] (P4) -- +(-10,0) coordinate (P5);
    \draw[hlp,name path=lb,]  (P5)  node[ae]{lower back} --+(17,0);

    \draw[mb,fill=none] (P1) -- (P2) -- (P3) node[an]{membrane} -- (P4) -- cycle;


    % ~~~ frame ~~~~~~~~~~~
    \draw[hlp,name path=ln1] (fx) -- +(300:7);          % start direction
    \path[name intersections={of=ln1 and ub, by=F1}];
    \path[name intersections={of=ln1 and uf, by=F2}];
    \draw[hlp,name path=ln1a](F2) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1a and lf, by=F3}];
    \draw[hlp,dashed]        (F3) -- (fx);              % to show NO cheating   
    \draw[hlp,name path=ln1b](F1) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1b and lb, by=F4}];

    \draw[mb] (F1) -- (F2) -- (F3) node[an]{frame} -- (F4) -- cycle;


    % ~~~ biplane ~~~~~~~~~~~
    \draw[hlp,name path=ln1] (fx) -- +(215:10);         % start direction
    \path[name intersections={of=ln1 and ub, by=B1}];
    \path[name intersections={of=ln1 and uf, by=B2}];
    \draw[hlp,name path=ln1a](B2) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1a and lf, by=B3}];
    \draw[hlp,dashed]        (B3) -- (fx);              % to show NO cheating   
    \draw[hlp,name path=ln1b](B1) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1b and lb, by=B4}];

    \draw[mb] (B1) -- (B2) -- (B3) node[an]{biplane} -- (B4) -- cycle;
 \end{tikzpicture}
\end{document}
Source Link
MS-SPO
  • 13.9k
  • 2
  • 15
  • 46

The main task is to come up with a set of reasonable coordinates to define the various exploded elements.

There are several ways to do it. I'll mention 2.

1st approach

Use your drawing, read suitable coordinates from it, draw the various elements.

sketch

2nd approach

Let's pretend some perspective and construct some points from intersections with lines. For a given object, e.g. the membran:

  • start from a fixpoint
  • P1: intersect with upper back (line)
  • P2: intersect with upper forgr
  • P3: vertical down from P2, intersct with lower forgr
  • P4: vertical down from P1, intersct with lower back
  • work from there, e.g. draw a cyclic line between these 4 points

As you can see by the dashed line, this approach cheats somewhat with the concept of fixed point perspectice. But the result may be good enough.

    % ~~~ membran ~~~~~~~~~~~
    \draw[hlp,name path=ln1] (fx) -- +(230:7);          % start direction
    \path[name intersections={of=ln1 and ub, by=P1}];
    \path[name intersections={of=ln1 and uf, by=P2}];
    \draw[hlp,name path=ln1a](P2) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1a and lf, by=P3}];
    \draw[hlp,dashed]        (P3) -- (fx);              % to show cheating  
    \draw[hlp,name path=ln1b](P1) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1b and lb, by=P4}];

    \draw[mb,fill=black] (P1) -- (P2) -- (P3) node[an]{membrane} -- (P4) -- cycle;

result

Finally make the teal help lines invisible by setting opacity=0 when you're done.

The fixed point (fx) may be somewhere inside the crossection of your upper sketch (2D), i.e. it must be finished before the upper back line.

\documentclass[10pt,border=3mm,tikz]{standalone}
\usetikzlibrary{intersections}

\begin{document}
 \begin{tikzpicture}[
    hlp/.style={teal,opacity=.5}, % reduce opacity to make less visible
    ae/.style={anchor = east},
    an/.style={anchor = north},
    mb/.style={line width=2pt},
 ]
 
    % ~~~ construction lines ~~~~~~~ 
    \draw[hlp,name path=hor] (-8, 0  )  node[ae]{horizon}    -- (8,0);
    \draw[hlp,name path=ub]  (-8,-2  )  node[ae]{upper back} -- (8,-2);
    \draw[hlp,name path=uf]  (-8,-4  )  node[ae]{upper forgr}-- (8,-4);
    \draw[hlp,name path=lb]  (-8,-6.5)  node[ae]{lower back} -- (8,-6.5);
    \draw[hlp,name path=lf]  (-8,-8.5)  node[ae]{lower forgr}-- (8,-8.5);
    
    % ~~~ fixpoint ~~~~~~~
    \coordinate (fx) at (3,0);
        
    % ~~~ membran ~~~~~~~~~~~
    \draw[hlp,name path=ln1] (fx) -- +(230:7);          % start direction
    \path[name intersections={of=ln1 and ub, by=P1}];
    \path[name intersections={of=ln1 and uf, by=P2}];
    \draw[hlp,name path=ln1a](P2) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1a and lf, by=P3}];
    \draw[hlp,dashed]        (P3) -- (fx);              % to show cheating  
    \draw[hlp,name path=ln1b](P1) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1b and lb, by=P4}];

    \draw[mb,fill=black] (P1) -- (P2) -- (P3) node[an]{membrane} -- (P4) -- cycle;


    % ~~~ frame ~~~~~~~~~~~
    \draw[hlp,name path=ln1] (fx) -- +(300:7);          % start direction
    \path[name intersections={of=ln1 and ub, by=F1}];
    \path[name intersections={of=ln1 and uf, by=F2}];
    \draw[hlp,name path=ln1a](F2) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1a and lf, by=F3}];
    \draw[hlp,dashed]        (F3) -- (fx);              % to show cheating  
    \draw[hlp,name path=ln1b](F1) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1b and lb, by=F4}];

    \draw[mb] (F1) -- (F2) -- (F3) node[an]{frame} -- (F4) -- cycle;


    % ~~~ biplane ~~~~~~~~~~~
    \draw[hlp,name path=ln1] (fx) -- +(215:10);         % start direction
    \path[name intersections={of=ln1 and ub, by=B1}];
    \path[name intersections={of=ln1 and uf, by=B2}];
    \draw[hlp,name path=ln1a](B2) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1a and lf, by=B3}];
    \draw[hlp,dashed]        (B3) -- (fx);              % to show cheating  
    \draw[hlp,name path=ln1b](B1) -- +(0,-5);           % vert. down
    \path[name intersections={of=ln1b and lb, by=B4}];

    \draw[mb] (B1) -- (B2) -- (B3) node[an]{biplane} -- (B4) -- cycle;
 \end{tikzpicture}
\end{document}