如何在 tex 中 3d 绘制 ax + by + cz = d 方程?

如何在 tex 中 3d 绘制 ax + by + cz = d 方程?

如何从方程式绘制平面,而不是在 tikz-picture 环境中使用坐标在此处输入图片描述

答案1

考虑到没有 MWE 并且您喜欢绘图,我建议使用 Mathcha 绘制您的平面:https://www.mathcha.io/editor.....然后您可以选择颜色。

这是第一个黄色背景的版本。

在此处输入图片描述

\documentclass[a4paper,12pt]{article}
\usepackage{tikz}

\begin{document}


\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt        

\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,407); %set diagram left start at 0, and has height of 407

%Shape: Rectangle [id:dp742306348490199] 
\draw  [fill={rgb, 255:red, 250; green, 238; blue, 97 }  ,fill opacity=1 ] (47.5,15) -- (590,15) -- (590,339) -- (47.5,339) -- cycle ;
%Shape: Parallelogram [id:dp8072010023617164] 
\draw  [fill={rgb, 255:red, 124; green, 173; blue, 245 }  ,fill opacity=1 ][line width=1.5]  (210.17,139.8) -- (487.36,80.28) -- (413.43,262.92) -- (136.24,322.44) -- cycle ;
%Straight Lines [id:da7774964613614512] 
\draw [line width=1.5]    (391,133) -- (375.65,39.95) ;
\draw [shift={(375,36)}, rotate = 440.63] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (13.4,-6.43) -- (0,0) -- (13.4,6.44) -- (8.9,0) -- cycle    ;
%Shape: Right Angle [id:dp3123415621575929] 
\draw   (387.75,114.03) -- (370.01,117.07) -- (373.26,136.04) ;
%Shape: Circle [id:dp5852572099745432] 
\draw  [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ,fill opacity=1 ] (264,169.5) .. controls (264,166.46) and (266.46,164) .. (269.5,164) .. controls (272.54,164) and (275,166.46) .. (275,169.5) .. controls (275,172.54) and (272.54,175) .. (269.5,175) .. controls (266.46,175) and (264,172.54) .. (264,169.5) -- cycle ;
%Shape: Circle [id:dp5848136227295151] 
\draw  [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ,fill opacity=1 ] (341,200.5) .. controls (341,197.46) and (343.46,195) .. (346.5,195) .. controls (349.54,195) and (352,197.46) .. (352,200.5) .. controls (352,203.54) and (349.54,206) .. (346.5,206) .. controls (343.46,206) and (341,203.54) .. (341,200.5) -- cycle ;
%Shape: Circle [id:dp3946492404933928] 
\draw  [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ,fill opacity=1 ] (84,290.5) .. controls (84,287.46) and (86.46,285) .. (89.5,285) .. controls (92.54,285) and (95,287.46) .. (95,290.5) .. controls (95,293.54) and (92.54,296) .. (89.5,296) .. controls (86.46,296) and (84,293.54) .. (84,290.5) -- cycle ;
%Straight Lines [id:da672057961187674] 
\draw [line width=1.5]    (89.5,290.5) -- (262.16,176.21) ;
\draw [shift={(265.5,174)}, rotate = 506.5] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (13.4,-6.43) -- (0,0) -- (13.4,6.44) -- (8.9,0) -- cycle    ;
%Straight Lines [id:da5253307253971755] 
\draw [line width=1.5]    (89.5,290.5) -- (337.23,201.85) ;
\draw [shift={(341,200.5)}, rotate = 520.31] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (13.4,-6.43) -- (0,0) -- (13.4,6.44) -- (8.9,0) -- cycle    ;
%Straight Lines [id:da8442146528508907] 
\draw [line width=1.5]    (269.5,169.5) -- (337.22,192.7) ;
\draw [shift={(341,194)}, rotate = 198.91] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (13.4,-6.43) -- (0,0) -- (13.4,6.44) -- (8.9,0) -- cycle    ;

% Text Node
\draw (62,292.4) node [anchor=north west][inner sep=0.75pt]  [font=\large]  {$O$};
% Text Node
\draw (228.14,138.71) node [anchor=north west][inner sep=0.75pt]  [font=\large]  {$( x_{0} ,y_{0} ,z_{0})$};
% Text Node
\draw (355.5,191.4) node [anchor=north west][inner sep=0.75pt]  [font=\large]  {$(x,y,z)$};
% Text Node
\draw (366.14,20) node [anchor=north west][inner sep=0.75pt]  [font=\Large]  {$\mathbf{n}$};
% Text Node
\draw (142.14,210) node [anchor=north west][inner sep=0.75pt]  [font=\Large]  {$\mathbf{r}_{0}$};
% Text Node
\draw (236.14,240.71) node [anchor=north west][inner sep=0.75pt]  [font=\Large]  {$\mathbf{r}$};
% Text Node
\draw (318.14,155.71) node [anchor=north west][inner sep=0.75pt]  [font=\Large]  {$\mathbf{r} -\mathbf{r}_{0}$};


\end{tikzpicture}

\end{document}

..第二个版本没有黄色背景。

\documentclass[a4paper,12pt]{article}
\usepackage{tikz}

\begin{document}


\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt        

\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%Shape: Parallelogram [id:dp8072010023617164] 
\draw  [fill={rgb, 255:red, 124; green, 173; blue, 245 }  ,fill opacity=1 ][line width=1.5]  (210.17,139.8) -- (487.36,80.28) -- (413.43,262.92) -- (136.24,322.44) -- cycle ;
%Straight Lines [id:da7774964613614512] 
\draw [line width=1.5]    (391,133) -- (375.65,39.95) ;
\draw [shift={(375,36)}, rotate = 440.63] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (13.4,-6.43) -- (0,0) -- (13.4,6.44) -- (8.9,0) -- cycle    ;
%Shape: Right Angle [id:dp3123415621575929] 
\draw   (387.75,114.03) -- (370.01,117.07) -- (373.26,136.04) ;
%Shape: Circle [id:dp5852572099745432] 
\draw  [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ,fill opacity=1 ] (264,169.5) .. controls (264,166.46) and (266.46,164) .. (269.5,164) .. controls (272.54,164) and (275,166.46) .. (275,169.5) .. controls (275,172.54) and (272.54,175) .. (269.5,175) .. controls (266.46,175) and (264,172.54) .. (264,169.5) -- cycle ;
%Shape: Circle [id:dp5848136227295151] 
\draw  [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ,fill opacity=1 ] (341,200.5) .. controls (341,197.46) and (343.46,195) .. (346.5,195) .. controls (349.54,195) and (352,197.46) .. (352,200.5) .. controls (352,203.54) and (349.54,206) .. (346.5,206) .. controls (343.46,206) and (341,203.54) .. (341,200.5) -- cycle ;
%Shape: Circle [id:dp3946492404933928] 
\draw  [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ,fill opacity=1 ] (84,290.5) .. controls (84,287.46) and (86.46,285) .. (89.5,285) .. controls (92.54,285) and (95,287.46) .. (95,290.5) .. controls (95,293.54) and (92.54,296) .. (89.5,296) .. controls (86.46,296) and (84,293.54) .. (84,290.5) -- cycle ;
%Straight Lines [id:da672057961187674] 
\draw [line width=1.5]    (89.5,290.5) -- (262.16,176.21) ;
\draw [shift={(265.5,174)}, rotate = 506.5] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (13.4,-6.43) -- (0,0) -- (13.4,6.44) -- (8.9,0) -- cycle    ;
%Straight Lines [id:da5253307253971755] 
\draw [line width=1.5]    (89.5,290.5) -- (337.23,201.85) ;
\draw [shift={(341,200.5)}, rotate = 520.31] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (13.4,-6.43) -- (0,0) -- (13.4,6.44) -- (8.9,0) -- cycle    ;
%Straight Lines [id:da8442146528508907] 
\draw [line width=1.5]    (269.5,169.5) -- (337.22,192.7) ;
\draw [shift={(341,194)}, rotate = 198.91] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (13.4,-6.43) -- (0,0) -- (13.4,6.44) -- (8.9,0) -- cycle    ;

% Text Node
\draw (62,292.4) node [anchor=north west][inner sep=0.75pt]  [font=\large]  {$O$};
% Text Node
\draw (228.14,138.71) node [anchor=north west][inner sep=0.75pt]  [font=\large]  {$( x_{0} ,y_{0} ,z_{0})$};
% Text Node
\draw (355.5,191.4) node [anchor=north west][inner sep=0.75pt]  [font=\large]  {$(x,y,z)$};
% Text Node
\draw (366.14,20) node [anchor=north west][inner sep=0.75pt]  [font=\Large]  {$\mathbf{n}$};
% Text Node
\draw (142.14,210) node [anchor=north west][inner sep=0.75pt]  [font=\Large]  {$\mathbf{r}_{0}$};
% Text Node
\draw (236.14,240.71) node [anchor=north west][inner sep=0.75pt]  [font=\Large]  {$\mathbf{r}$};
% Text Node
\draw (318.14,155.71) node [anchor=north west][inner sep=0.75pt]  [font=\Large]  {$\mathbf{r} -\mathbf{r}_{0}$};


\end{tikzpicture}

\end{document}

在此处输入图片描述

答案2

使用 pstricks 模块pst-solides3d,可以以比较简单的方式根据笛卡尔方程的系数绘制平面。

举例来说,下面是绘制方程 x – y + 2z – 1 = 0 的平面的代码(还有坐标轴以及平面与坐标轴的交点):

\documentclass[svgnames, border=6pt ]{standalone}
\usepackage{pst-solides3d}

\begin{document}

\begin{pspicture*}(-10,-8)(10,8)
\psset{unit=0.5cm}
\psSolid[object=plan,
definition=equation,
args={[1 -1 2 -1]},
fillcolor=Lavender,
base=-2.2 2.2 -3.2 3.2,]
\psset{object=line}
\psSolid[args=1 0 0 3.95 0 0]
\psSolid[args=0 2 0 0 3.45 0]
\psSolid[args=0 -3 0 0 -1 0]
\psSolid[args=0 0 0.5 0 0 3.45]
\psset{arrows=->, arrowinset=0.12, linewidth=0.4pt, linestyle=dashed}
\axesIIID(-3,-2.8,-3.5)(4,3.5,3.5)
\psset{object=point, linecolor=Lavender!85!Navy}
\psSolid[args=1 0 0]
\psSolid[args=0 -1 0 ]
\psSolid[args=0 0 0.5]
\end{pspicture*}

\end{document} 

在此处输入图片描述

相关内容