Pyramide en TikZ

Bonjour,

je galère pour réaliser la figure 3D suivante en Tikz:
je voudrais dessiner un repère (0xyz) avec l'axe (Ox) vers l'utilisateur, la pyramide OBCD avec
B(1,0,0), C(0,1,0), D(0,0,1)
et ensuite dessiner en jaune l'intersection de cette pyramide avec le plan d'équation y=0,75.

Si quelqu'un sait comment faire ça...
Merci d'avance.

Réponses

  • Bonjour,

    Tu peux la réaliser sur geogebra puis exporte le code en Latex.
  • En suivant le conseil de Echecs+maths

    \documentclass[10pt]{article}
    \usepackage{pgf,tikz}
    \usepackage{mathrsfs}
    \usetikzlibrary{arrows}
    \pagestyle{empty}
    \begin{document}
    \definecolor{ffffqq}{rgb}{1.,1.,0.}
    \definecolor{ududff}{rgb}{0.30196078431372547,0.30196078431372547,1.}
    \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
    \clip(-0.8776011361598561,-0.8483654130134433) rectangle (1.6932114712962034,1.1566873776609077);
    \fill[line width=2.pt,color=ffffqq,fill=ffffqq,fill opacity=0.5] (0.5859989172193003,-0.12567719883812367) -- (0.75,0.) -- (0.75,0.25) -- cycle;
    \draw [line width=2.pt] (0.,1.)-- (1.,0.);
    \draw [line width=2.pt] (1.,0.)-- (-0.6560043311227987,-0.5027087953524949);
    \draw [line width=2.pt] (-0.6560043311227987,-0.5027087953524949)-- (0.,0.);
    \draw [line width=2.pt] (0.,0.)-- (0.,1.);
    \draw [line width=2.pt] (0.,1.)-- (-0.6560043311227987,-0.5027087953524949);
    \draw [line width=2.pt,color=ffffqq] (0.5859989172193003,-0.12567719883812367)-- (0.75,0.);
    \draw [line width=2.pt,color=ffffqq] (0.75,0.)-- (0.75,0.25);
    \draw [line width=2.pt,color=ffffqq] (0.75,0.25)-- (0.5859989172193003,-0.12567719883812367);
    \draw [line width=2.pt] (0.,0.)-- (1.,0.);
    \begin{scriptsize}
    \draw [fill=ududff] (1.,0.) circle (2.5pt);
    \draw (1.0324040052951742,0.08174372577567433) node {$C$};
    \draw [fill=ududff] (0.,1.) circle (2.5pt);
    \draw (0.032140649225122706,1.082007081845723) node {$D$};
    \draw [fill=ududff] (0.,0.) circle (2.5pt);
    \draw (0.032140649225122706,0.08174372577567433) node {$O$};
    \draw [fill=ududff] (-0.6560043311227987,-0.5027087953524949) circle (2.5pt);
    \draw (-0.7689752513377691,-0.44780746273199845) node {$B$};
    \draw [fill=ffffqq] (0.75,0.25) circle (2.5pt);
    \draw (0.7834696859112246,0.3352041236938767) node {$M$};
    \draw [fill=ffffqq] (0.75,0.) circle (2.5pt);
    \draw (0.7834696859112246,0.08174372577567433) node {$N$};
    \draw [fill=ffffqq] (0.5859989172193003,-0.12567719883812367) circle (2.0pt);
    \draw (0.5933743874725723,-0.1898209862795425) node {$P$};
    \end{scriptsize}
    \end{tikzpicture}
    \end{document}

    e.v.
    Personne n'a raison contre un enfant qui pleure.


  • On peut aussi s'y prendre comme ceci :
    \documentclass[12pt,tikz]{standalone}
    \usetikzlibrary{3d,calc}
    \begin{document}
    \begin{tikzpicture}
      [
        face/.style={draw=black,fill=blue!50,fill opacity=.7},
        plan/.style={fill=green!60,fill opacity=.7},
        triangle/.style={fill=yellow,fill opacity=.8},
      ]
      \coordinate (o) at (0,0,0) ;
      \coordinate (b) at (1,0,0) ;
      \coordinate (c) at (0,1,0) ;
      \coordinate (d) at (0,0,1) ;
    
      \def\yy{.75}    % hauteur de la coupure
      \def\x{.5}      % rectangle vert
      \def\y{-\x+.25} % autre dimension
      \begin{scope}[canvas is xz plane at y=\yy]
        \path [plan] (\x,\y) -| (\y,\x) -- cycle;
      \end{scope}
      \begin{scope}
        \clip (d) -- (b) -- (c) -- cycle;
        \path [face] (o) -- (b) -- (d) -- cycle;
        \path [face] (o) -- (d) -- (c) -- cycle;
        \path [face] (o) -- (b) -- (c) -- cycle;
      \end{scope}
      \path [face] (d) -- (b) -- (c) -- cycle;
    
      \begin{scope}[canvas is xz plane at y=\yy]
        \path [plan] (\x,\y) |- (\y,\x) -- cycle;
        \pgfmathsetmacro{\p}{1-\yy}
        \path [triangle] (0,0) -- (\p,0) -- (0,\p) -- cycle ;
      \end{scope}
      
    \end{tikzpicture}
    \end{document}
    

    S'il faut changer l'angle de vue, on peut utiliser tikz-3dplot (je peux aider, au besoin.)75324
  • Wahoo, merci à tous pour les solutions.

    Marsup, on peut ajouter (c'est-à-dire dessiner) les axes pour obtenir l'axe (Ox) vers le lecteur?
Connectez-vous ou Inscrivez-vous pour répondre.