我正在尝试绘制一个通过四个点的圆(球体),B, C, E, F
就像这张图片一样
我尝试过tikz-3dplot
我的代码
\documentclass[border=3mm,12pt]{standalone}
\usepackage{fouriernc}
\usepackage{tikz,tikz-3dplot}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usetikzlibrary{intersections,calc,backgrounds}
\begin{document}
\tdplotsetmaincoords{70}{110}
%\tdplotsetmaincoords{80}{100}
\begin{tikzpicture}[tdplot_main_coords,scale=1.5]
\pgfmathsetmacro\a{3}
\pgfmathsetmacro\b{4}
\pgfmathsetmacro\h{5}
% definitions
\path
coordinate(A) at (0,0,0)
coordinate (B) at (\a,0,0)
coordinate (C) at (0,\b,0)
coordinate (S) at (0,0,\h)
coordinate (E) at ({\a*\h^2/(\a*\a + \h*\h)},0,{(\a*\a*\h)/(\a*\a + \h*\h)})
coordinate (F) at (0,{(\b*\h*\h)/(\b*\b + \h*\h)},{(\b*\b*\h)/(\b*\b + \h*\h)});
\draw[dashed,thick]
(A) -- (B) (A) -- (C) (A) -- (E) (S)--(A) (F)--(A);
\draw[thick]
(S) -- (B) -- (C) -- cycle;
\draw[thick]
(F) -- (B) (C)--(E) (F)--(E);
\tkzMarkRightAngle(S,E,A);
\tkzMarkRightAngle(S,F,A);
\foreach \point/\position in {A/below,B/left,C/below,S/above,E/left,F/above}
{
\fill (\point) circle (.8pt);
\node[\position=3pt] at (\point) {$\point$};
}
\end{tikzpicture}
\end{document}
并得到
如何绘制一个通过四个点的圆(球体)B, C, E, F
?
答案1
圆由 3 个点确定。当然,球体至少需要 4 个边界点才能确定。但是,球体的投影(即圆)不一定会通过这些点的投影。(实际上,如果球体由这些点唯一确定,边界圆(即球体在屏幕坐标上的投影)将永远不会通过这些点的所有投影,因为要做到这一点,这些点需要位于一个平面上,但这样它们就不再唯一地确定圆了。)
这里展示了两种构造经过某些点的圆的方法:
- 虚线圆穿过
F
、E
和C
。它根据此要求固定。因此,它会B
略微偏离。 - 红色虚线圆穿过
BC
这些点的中点和。它与和的误差F
很小E
。
\documentclass[border=3mm,12pt]{standalone}
\usepackage{fouriernc}
\usepackage{tikz,tikz-3dplot}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usetikzlibrary{calc,through}
\tikzset{circle through 3 points/.style n args={3}{%
insert path={let \p1=($(#1)!0.5!(#2)$),
\p2=($(#1)!0.5!(#3)$),
\p3=($(#1)!0.5!(#2)!1!-90:(#2)$),
\p4=($(#1)!0.5!(#3)!1!90:(#3)$),
\p5=(intersection of \p1--\p3 and \p2--\p4)
in },
at={(\p5)},
circle through= {(#1)}
}}
\usetikzlibrary{intersections,calc,backgrounds}
\begin{document}
\tdplotsetmaincoords{70}{110}
%\tdplotsetmaincoords{80}{100}
\begin{tikzpicture}[tdplot_main_coords,scale=1.5]
\pgfmathsetmacro\a{3}
\pgfmathsetmacro\b{4}
\pgfmathsetmacro\h{5}
% definitions
\path
coordinate(A) at (0,0,0)
coordinate (B) at (\a,0,0)
coordinate (C) at (0,\b,0)
coordinate (S) at (0,0,\h)
coordinate (E) at ({\a*\h^2/(\a*\a + \h*\h)},0,{(\a*\a*\h)/(\a*\a + \h*\h)})
coordinate (F) at (0,{(\b*\h*\h)/(\b*\b + \h*\h)},{(\b*\b*\h)/(\b*\b + \h*\h)});
\draw[dashed,thick]
(A) -- (B) (A) -- (C) (A) -- (E) (S)--(A) (F)--(A);
\draw[thick]
(S) -- (B) -- (C) -- cycle;
\draw[thick]
(F) -- (B) (C)--(E) (F)--(E);
\tkzMarkRightAngle(S,E,A);
\tkzMarkRightAngle(S,F,A);
\foreach \point/\position in {A/below,B/left,C/below,S/above,E/left,F/above}
{
\fill (\point) circle (.8pt);
\node[\position=3pt] at (\point) {$\point$};
}
\node[circle through 3 points={F}{E}{C},draw=blue,dotted]{};
\draw[red,dashed]
let \p1=($(B)-(C)$), \n1={veclen(\x1,\y1)/2} in ($(B)!0.5!(C)$) circle (\n1);
\end{tikzpicture}
\end{document}
也可以构造球体。但是,如上所述,其边界可能不会经过任何点。
附录:在您的设置中,四个点不能确定一个唯一的球体,因为它们都位于一个平面上。使用 Mathematica,我能够将其表示F
为线性组合
F = x B + y C + z E
在哪里
因此,在这种设置下,不可能绘制出独特的球体。
答案2
非常感谢marmot纠正了这个圆圈BCEF
这里。
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc,3dtools}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,
3d/install view={phi=110,theta=70},
declare function={a=3;b=4;h=5;},c/.style={circle,fill,inner sep=1pt}]
\path
(0,0,0) coordinate (A)
(a,0,0) coordinate (B)
(0,b,0) coordinate (C)
(0,0,h) coordinate (S)
%(a/2,b/2,0) coordinate (M)
;
\path[3d/circumsphere center={A={(A)},B={(B)},C={(C)},D={(S)}}]
coordinate (I);
\pgfmathsetmacro{\myR}{sqrt(TD("(I)-(A)o(I)-(A)"))} ;
\draw[3d/screen coords] (I) circle[radius=\myR];
\path[3d/circumcircle center={A={(A)},B={(B)},C={(C)}}] coordinate (O);
\path pic{3d/circle on sphere={R=\myR,C={(I)}, P={(O)}}};
\path[3d/line through={(S) and (B) named lSB}];
\path[3d/line through={(S) and (C) named lSC}];
\path[3d/project={(A) on lSB}] coordinate (E);
\path[3d/project={(A) on lSC}] coordinate (F);
%\path[3d/circumcircle center={A={(E)},B={(B)},C={(C)}}] coordinate (M);
\path pic[draw=none]{3d circle through 3 points={%
A={(B)},B={(E)},C={(F)},center name=M}};
\pgfmathsetmacro{\myr}{tddistance("(B)","(M)")}%
\pgfmathsetmacro{\myMC}{TD("(C)-(M)")}
\pgfmathtruncatemacro{\itest}{screendepth(\myMC)<0?0:1}
\ifnum\itest=0
\begin{scope}
\clip[3d/screen coords] (I) circle[radius=\myR];
\path pic[3d/hidden]{3d circle through 3 points={%
A={(B)},B={(E)},C={(F)},center name=M}};
\end{scope}
\begin{scope}
\clip[3d/screen coords,even odd clip] (I) circle[radius=\myR]
[generous outside path];
\path pic[3d/visible]{3d circle through 3 points={%
A={(B)},B={(E)},C={(F)},center name=M}};
\end{scope}
\else
\tikzset{3d/define orthonormal dreibein={A={(B)},B={(C)},C={(F)}}}
\begin{scope}[x={(ex)},y={(ey)},z={(ez)},shift={(M)}]
\draw[3d/hidden] (B) arc[start angle=180,end angle=0,radius=\myr];
\draw[3d/visible] (B) arc[start angle=180,end angle=360,radius=\myr];
\end{scope}
\fi
\path foreach \p/\g in {A/90,B/-90,C/0,S/90,E/180,F/90,I/0,M/-90}
{(\p)node[c]{}+(\g:2.5mm) node{$\p$}};
\draw[3d/hidden] (S) -- (A) (S) --(B) (S) -- (C) (A) -- (B) -- (C) -- cycle (A) -- (E) (A) -- (F);
\end{tikzpicture}
\end{document}