我已经按以下方式指定了一个椭圆和三个点:
\def\aa{2.5}
\def\bb{2}
\draw[thick] (0,0) ellipse [x radius=\aa,y radius=\bb];
\pgfmathsetmacro{\focus}{sqrt(\aa*\aa-\bb*\bb)}
\path coordinate (c) at (0,0)
coordinate (d) at (-\focus,0)
coordinate (r) at ($(0,0)+(36:{\aa} and {\bb})$);
\fill (c) circle (2pt)
(d) circle (2pt)
(r) circle (2pt);
现在我需要
- 过 (r) 的椭圆的切向量;
- 与该切线平行的通过 (c) 的线;
- 这最后一条线与连接 (r) 和 (d) 的线相交处的坐标。
我似乎找不到可以解决问题 1 的解决方案,从而无法解决问题 2 和 3。请问有什么建议吗?
答案1
以下是使用以下方法实现此目的的方法如何在 TikZ 中绘制路径上任意点的切线
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, decorations.markings, intersections}
\begin{document}
\begin{tikzpicture}[
tangent/.style={
decoration={
markings,% switch on markings
mark=
at position #1
with
{
\coordinate (tangent point-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,0pt);
\coordinate (tangent unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (1,0pt);
\coordinate (tangent orthogonal unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,1);
}
},
postaction=decorate
},
use tangent/.style={
shift=(tangent point-#1),
x=(tangent unit vector-#1),
y=(tangent orthogonal unit vector-#1)
},
use tangent/.default=1
]
\def\aa{3.5}
\def\bb{2}
\pgfmathsetmacro{\focus}{sqrt(\aa*\aa-\bb*\bb)}
\draw[thick, tangent=0.07] (0,0) ellipse [x radius=\aa,y radius=\bb];
\path coordinate (c) at (0,0)
coordinate (d) at (-\focus,0);
\fill (c) circle (2pt)
(d) circle (2pt);
\fill (tangent point-1) circle [radius=2pt];
\draw [red, name path=rd] (tangent point-1) -- (d);
\draw [use tangent] (2,0) -- (-2,0);
\draw [use tangent, red, name path=parallel] (c) ++(2,0) -- +(-4,0);
\fill [red, name intersections={of={rd and parallel}}] (intersection-1) circle [radius=2pt];
\end{tikzpicture}
\end{document}
答案2
和Asymptote
版本,ellipse.asy
以及通过 svg 翻译成 tikz
size(300);
void Dot(... pair[] p){ // function takes a variable number of arguments
for(int i=0;i<p.length;++i){
fill(shift(p[i])*scale(0.06)*unitcircle,black);
fill(shift(p[i])*scale(0.04)*unitcircle,white);
}
}
real a=2.5, b=2, focus=sqrt(a*a-b*b);
pair c=(0,0), d=(-focus,0);
path el=ellipse(c,a,b);
path tline=rotate(36)*(c--(2a,0));
real tr=intersect(el,tline)[0];
pair r=point(el,tr);
pair tan_dir=dir(el,tr);
path tan_line=scale(b)*(-tan_dir--tan_dir);
pair w=intersectionpoint(d--r,shift(c)*tan_line);
pen linePen=darkblue+1.2pt;
pen elPen=red+1.5pt;
draw(el,elPen); draw(d--r,linePen);
draw(shift(r)*tan_line,linePen);
draw(shift(c)*tan_line,linePen);
Dot(c,d,r,w);
label("$C$",c,NE);label("$D$",d,NW);
label("$R$",r,NE);label("$W$",w,S);
运行asy ellipse.asy
以获取ellipse.eps
或asy -f pdf ellipse.asy
获取ellipse.pdf
。或者将其放在文档asy
中的环境中LaTeX
(参见texdoc asymptote
)。
编辑:添加了一些评论。
一个用户定义的函数来绘制一串点,稍后用作Dot(c,d,r,w);
:
void Dot(... pair[] p){ // function takes a variable number of arguments
for(int i=0;i<p.length;++i){
fill(shift(p[i])*scale(0.06)*unitcircle,black);
fill(shift(p[i])*scale(0.04)*unitcircle,white);
}
}
该函数Dot
是用... pair[] p
构造定义的,这意味着它能够接受可变数量的参数,所有参数都将放置在一对数组(二维坐标)中p[]
。
real a=2.5, b=2, focus=sqrt(a*a-b*b);
定义维度。
pair c=(0,0), d=(-focus,0);
通过坐标 定义点c
和。d
x,y
path el=ellipse(c,a,b);
定义一条稍后要使用的曲线(椭圆轮廓);
path tline=rotate(36)*(c--(2a,0));
将直线定义为旋转 36 度的水平线c--(2a,0)
real tr=intersect(el,tline)[0];
定义所谓的交叉时间,t
即路径的参数,它对应于与椭圆轮廓el
的交点。tline
el
pair r=point(el,tr);
定义交点本身。
pair tan_dir=dir(el,tr);
r
定义点(时间)处的切线方向tr
。
path tan_line=scale(b)*(-tan_dir--tan_dir);
定义一条通过原点与切线平行的线。
pair w=intersectionpoint(d--r,shift(c)*tan_line);
定义感兴趣的交点,位于该线d--r
与通过原点(点c
)的切线平行的线之间。
pen linePen=darkblue+1.2pt;
pen elPen=red+1.5pt;
定义用于线条和椭圆的笔(颜色和宽度)
draw(el,elPen); draw(d--r,linePen);
画椭圆和直线d--r
draw(shift(r)*tan_line,linePen);
draw(shift(c)*tan_line,linePen);
使用定义的函数通过点r
和绘制两条平行线。 c
Dot
Dot(c,d,r,w);
在所有四个点上画出奇特的点c,d,r,w
。
label("$C$",c,NE);label("$D$",d,NW);
label("$R$",r,NE);label("$W$",w,S);
最后,在指定位置(例如)(La)TeX
绘制标签,格式化为字符串(例如),按照指定的方向(ed表示该点的西北方向)。"$C$"
,c
NE
编辑2:添加了 tikz 翻译
感谢Harish Kumar
[此处][2]的回答,我刚刚inkscape2tikz
从[来源][3]安装了它,运行之后,asy -f svg ellipse.asy
svg2tikz ellipse.svg > ellipse.tex
它是一个LaTeX
包含解决方案的文档tikz
,是从ellipse.asy
上面显示的代码翻译而来的:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\begin{document}
\definecolor{cff0000}{RGB}{255,0,0}
\definecolor{c000040}{RGB}{0,0,64}
\definecolor{cffffff}{RGB}{255,255,255}
\begin{tikzpicture}[y=0.80pt,x=0.80pt,yscale=-1, inner sep=0pt, outer sep=0pt]
\begin{scope}[cm={{0.996,0.0,0.0,0.996,(0.0,0.0)}}]
\begin{scope}[cm={{1.0,0.0,0.0,1.0,(207.183,174.51)}}]
\path[draw=cff0000,line join=round,line cap=round,miter limit=10.04,line
width=1.200pt] (75.2812,0.0000) .. controls (75.2812,-33.2613) and
(41.5767,-60.2250) .. (0.0000,-60.2250) .. controls (-41.5767,-60.2250) and
(-75.2812,-33.2613) .. (-75.2812,-0.0000) .. controls (-75.2812,33.2613) and
(-41.5767,60.2250) .. (0.0000,60.2250) .. controls (41.5767,60.2250) and
(75.2812,33.2613) .. (75.2812,0.0000) -- cycle;
\end{scope}
\begin{scope}[cm={{1.0,0.0,0.0,1.0,(207.183,174.51)}}]
\path[draw=c000040,line join=round,line cap=round,miter limit=10.04,line
width=0.960pt] (-45.1687,-0.0000) -- (55.7293,-40.4897);
\end{scope}
\begin{scope}[cm={{1.0,0.0,0.0,1.0,(207.183,174.51)}}]
\path[draw=c000040,line join=round,line cap=round,miter limit=10.04,line
width=0.960pt] (100.9330,-0.6942) -- (10.5257,-80.2853);
\end{scope}
\begin{scope}[cm={{1.0,0.0,0.0,1.0,(207.183,174.51)}}]
\path[draw=c000040,line join=round,line cap=round,miter limit=10.04,line
width=0.960pt] (45.2036,39.7955) -- (-45.2036,-39.7955);
\end{scope}
\begin{scope}[cm={{1.0,0.0,0.0,1.0,(207.183,174.51)}}]
\path[fill=black] (1.8068,0.0000) .. controls (1.8068,-0.9978) and
(0.9978,-1.8068) .. (0.0000,-1.8068) .. controls (-0.9978,-1.8068) and
(-1.8068,-0.9978) .. (-1.8068,-0.0000) .. controls (-1.8068,0.9978) and
(-0.9978,1.8068) .. (0.0000,1.8068) .. controls (0.9978,1.8068) and
(1.8068,0.9978) .. (1.8068,0.0000) -- cycle;
\end{scope}
\begin{scope}[cm={{1.0,0.0,0.0,1.0,(207.183,174.51)}}]
\path[fill=cffffff] (1.2045,0.0000) .. controls (1.2045,-0.6652) and
(0.6652,-1.2045) .. (0.0000,-1.2045) .. controls (-0.6652,-1.2045) and
(-1.2045,-0.6652) .. (-1.2045,-0.0000) .. controls (-1.2045,0.6652) and
(-0.6652,1.2045) .. (0.0000,1.2045) .. controls (0.6652,1.2045) and
(1.2045,0.6652) .. (1.2045,0.0000) -- cycle;
\end{scope}
\begin{scope}[cm={{1.0,0.0,0.0,1.0,(207.183,174.51)}}]
\path[fill=black] (-43.3620,-0.0000) .. controls (-43.3620,-0.9978) and
(-44.1709,-1.8068) .. (-45.1687,-1.8068) .. controls (-46.1666,-1.8068) and
(-46.9755,-0.9978) .. (-46.9755,-0.0000) .. controls (-46.9755,0.9978) and
(-46.1666,1.8068) .. (-45.1687,1.8068) .. controls (-44.1709,1.8068) and
(-43.3620,0.9978) .. (-43.3620,-0.0000) -- cycle;
\end{scope}
\begin{scope}[cm={{1.0,0.0,0.0,1.0,(207.183,174.51)}}]
\path[fill=cffffff] (-43.9642,-0.0000) .. controls (-43.9642,-0.6652) and
(-44.5035,-1.2045) .. (-45.1687,-1.2045) .. controls (-45.8340,-1.2045) and
(-46.3732,-0.6652) .. (-46.3732,-0.0000) .. controls (-46.3732,0.6652) and
(-45.8340,1.2045) .. (-45.1687,1.2045) .. controls (-44.5035,1.2045) and
(-43.9642,0.6652) .. (-43.9642,-0.0000) -- cycle;
\end{scope}
\begin{scope}[cm={{1.0,0.0,0.0,1.0,(207.183,174.51)}}]
\path[fill=black] (57.5361,-40.4897) .. controls (57.5361,-41.4876) and
(56.7272,-42.2965) .. (55.7293,-42.2965) .. controls (54.7315,-42.2965) and
(53.9226,-41.4876) .. (53.9226,-40.4897) .. controls (53.9226,-39.4919) and
(54.7315,-38.6830) .. (55.7293,-38.6830) .. controls (56.7272,-38.6830) and
(57.5361,-39.4919) .. (57.5361,-40.4897) -- cycle;
\end{scope}
\begin{scope}[cm={{1.0,0.0,0.0,1.0,(207.183,174.51)}}]
\path[fill=cffffff] (56.9338,-40.4897) .. controls (56.9338,-41.1550) and
(56.3946,-41.6942) .. (55.7293,-41.6942) .. controls (55.0641,-41.6942) and
(54.5248,-41.1550) .. (54.5248,-40.4897) .. controls (54.5248,-39.8245) and
(55.0641,-39.2852) .. (55.7293,-39.2852) .. controls (56.3946,-39.2852) and
(56.9338,-39.8245) .. (56.9338,-40.4897) -- cycle;
\end{scope}
\begin{scope}[cm={{1.0,0.0,0.0,1.0,(207.183,174.51)}}]
\path[fill=black] (-12.3358,-12.4506) .. controls (-12.3358,-13.4484) and
(-13.1447,-14.2573) .. (-14.1426,-14.2573) .. controls (-15.1404,-14.2573) and
(-15.9493,-13.4484) .. (-15.9493,-12.4506) .. controls (-15.9493,-11.4528) and
(-15.1404,-10.6438) .. (-14.1426,-10.6438) .. controls (-13.1447,-10.6438) and
(-12.3358,-11.4528) .. (-12.3358,-12.4506) -- cycle;
\end{scope}
\begin{scope}[cm={{1.0,0.0,0.0,1.0,(207.183,174.51)}}]
\path[fill=cffffff] (-12.9381,-12.4506) .. controls (-12.9381,-13.1158) and
(-13.4774,-13.6551) .. (-14.1426,-13.6551) .. controls (-14.8078,-13.6551) and
(-15.3471,-13.1158) .. (-15.3471,-12.4506) .. controls (-15.3471,-11.7854) and
(-14.8078,-11.2461) .. (-14.1426,-11.2461) .. controls (-13.4774,-11.2461) and
(-12.9381,-11.7854) .. (-12.9381,-12.4506) -- cycle;
\end{scope}
\begin{scope}[shift={(209.733,171.904)}]
\path (8.9640,-8.3400) .. controls (8.9640,-8.4480) and (8.8800,-8.4480) ..
(8.8560,-8.4480) .. controls (8.8320,-8.4480) and (8.7840,-8.4480) ..
(8.6880,-8.3280) -- (7.8600,-7.3200) .. controls (7.4400,-8.0400) and
(6.7800,-8.4480) .. (5.8800,-8.4480) .. controls (3.2880,-8.4480) and
(0.6000,-5.8200) .. (0.6000,-3.0000) .. controls (0.6000,-0.9960) and
(2.0040,0.2520) .. (3.7560,0.2520) .. controls (4.7160,0.2520) and
(5.5560,-0.1560) .. (6.2520,-0.7440) .. controls (7.2960,-1.6200) and
(7.6080,-2.7840) .. (7.6080,-2.8800) .. controls (7.6080,-2.9880) and
(7.5120,-2.9880) .. (7.4760,-2.9880) .. controls (7.3680,-2.9880) and
(7.3560,-2.9160) .. (7.3320,-2.8680) .. controls (6.7800,-0.9960) and
(5.1600,-0.0960) .. (3.9600,-0.0960) .. controls (2.6880,-0.0960) and
(1.5840,-0.9120) .. (1.5840,-2.6160) .. controls (1.5840,-3.0000) and
(1.7040,-5.0880) .. (3.0600,-6.6600) .. controls (3.7200,-7.4280) and
(4.8480,-8.1000) .. (5.9880,-8.1000) .. controls (7.3080,-8.1000) and
(7.8960,-7.0080) .. (7.8960,-5.7840) .. controls (7.8960,-5.4720) and
(7.8600,-5.2080) .. (7.8600,-5.1600) .. controls (7.8600,-5.0520) and
(7.9800,-5.0520) .. (8.0160,-5.0520) .. controls (8.1480,-5.0520) and
(8.1600,-5.0640) .. (8.2080,-5.2800) -- (8.9640,-8.3400) -- cycle;
\end{scope}
\begin{scope}[shift={(149.391,171.904)}]
\path (1.8840,-0.8880) .. controls (1.7760,-0.4680) and (1.7520,-0.3480) ..
(0.9120,-0.3480) .. controls (0.6840,-0.3480) and (0.5640,-0.3480) ..
(0.5640,-0.1320) .. controls (0.5640,0.0000) and (0.6360,0.0000) ..
(0.8760,0.0000) -- (4.6800,0.0000) .. controls (7.1040,0.0000) and
(9.4680,-2.5080) .. (9.4680,-5.1840) .. controls (9.4680,-6.9120) and
(8.4360,-8.1960) .. (6.7200,-8.1960) -- (2.8680,-8.1960) .. controls
(2.6400,-8.1960) and (2.5320,-8.1960) .. (2.5320,-7.9680) .. controls
(2.5320,-7.8480) and (2.6400,-7.8480) .. (2.8200,-7.8480) .. controls
(3.5520,-7.8480) and (3.5520,-7.7520) .. (3.5520,-7.6200) .. controls
(3.5520,-7.5960) and (3.5520,-7.5240) .. (3.5040,-7.3440) -- (1.8840,-0.8880)
-- cycle(4.4160,-7.3800) .. controls (4.5240,-7.8240) and (4.5720,-7.8480) ..
(5.0400,-7.8480) -- (6.3600,-7.8480) .. controls (7.4880,-7.8480) and
(8.5200,-7.2360) .. (8.5200,-5.5800) .. controls (8.5200,-4.9800) and
(8.2800,-2.8920) .. (7.1160,-1.5720) .. controls (6.7800,-1.1760) and
(5.8680,-0.3480) .. (4.4880,-0.3480) -- (3.1200,-0.3480) .. controls
(2.9520,-0.3480) and (2.9280,-0.3480) .. (2.8560,-0.3600) .. controls
(2.7240,-0.3720) and (2.7120,-0.3960) .. (2.7120,-0.4920) .. controls
(2.7120,-0.5760) and (2.7360,-0.6480) .. (2.7600,-0.7560) -- (4.4160,-7.3800)
-- cycle;
\end{scope}
\begin{scope}[shift={(265.462,131.415)}]
\path (4.4160,-7.3800) .. controls (4.5240,-7.8240) and (4.5720,-7.8480) ..
(5.0400,-7.8480) -- (5.9040,-7.8480) .. controls (6.9360,-7.8480) and
(7.7040,-7.5360) .. (7.7040,-6.6000) .. controls (7.7040,-5.9880) and
(7.3920,-4.2240) .. (4.9800,-4.2240) -- (3.6240,-4.2240) -- (4.4160,-7.3800)
-- cycle(6.0840,-4.0800) .. controls (7.5720,-4.4040) and (8.7360,-5.3640) ..
(8.7360,-6.3960) .. controls (8.7360,-7.3320) and (7.7880,-8.1960) ..
(6.1200,-8.1960) -- (2.8680,-8.1960) .. controls (2.6280,-8.1960) and
(2.5200,-8.1960) .. (2.5200,-7.9680) .. controls (2.5200,-7.8480) and
(2.6040,-7.8480) .. (2.8320,-7.8480) .. controls (3.5520,-7.8480) and
(3.5520,-7.7520) .. (3.5520,-7.6200) .. controls (3.5520,-7.5960) and
(3.5520,-7.5240) .. (3.5040,-7.3440) -- (1.8840,-0.8880) .. controls
(1.7760,-0.4680) and (1.7520,-0.3480) .. (0.9240,-0.3480) .. controls
(0.6480,-0.3480) and (0.5640,-0.3480) .. (0.5640,-0.1200) .. controls
(0.5640,0.0000) and (0.6960,0.0000) .. (0.7320,0.0000) .. controls
(0.9480,0.0000) and (1.2000,-0.0240) .. (1.4280,-0.0240) -- (2.8440,-0.0240)
.. controls (3.0600,-0.0240) and (3.3120,0.0000) .. (3.5280,0.0000) ..
controls (3.6240,0.0000) and (3.7560,0.0000) .. (3.7560,-0.2280) .. controls
(3.7560,-0.3480) and (3.6480,-0.3480) .. (3.4680,-0.3480) .. controls
(2.7360,-0.3480) and (2.7360,-0.4440) .. (2.7360,-0.5640) .. controls
(2.7360,-0.5760) and (2.7360,-0.6600) .. (2.7600,-0.7560) -- (3.5640,-3.9840)
-- (5.0040,-3.9840) .. controls (6.1440,-3.9840) and (6.3600,-3.2640) ..
(6.3600,-2.8680) .. controls (6.3600,-2.6880) and (6.2400,-2.2200) ..
(6.1560,-1.9080) .. controls (6.0240,-1.3560) and (5.9880,-1.2240) ..
(5.9880,-0.9960) .. controls (5.9880,-0.1440) and (6.6840,0.2520) ..
(7.4880,0.2520) .. controls (8.4600,0.2520) and (8.8800,-0.9360) ..
(8.8800,-1.1040) .. controls (8.8800,-1.1880) and (8.8200,-1.2240) ..
(8.7480,-1.2240) .. controls (8.6520,-1.2240) and (8.6280,-1.1520) ..
(8.6040,-1.0560) .. controls (8.3160,-0.2040) and (7.8240,0.0120) ..
(7.5240,0.0120) .. controls (7.2240,0.0120) and (7.0320,-0.1200) ..
(7.0320,-0.6600) .. controls (7.0320,-0.9480) and (7.1760,-2.0400) ..
(7.1880,-2.1000) .. controls (7.2480,-2.5440) and (7.2480,-2.5920) ..
(7.2480,-2.6880) .. controls (7.2480,-3.5640) and (6.5400,-3.9360) ..
(6.0840,-4.0800) -- cycle;
\end{scope}
\begin{scope}[shift={(186.682,173.799)}]
\path (10.8360,-6.8640) .. controls (11.1120,-7.3320) and (11.3760,-7.7760) ..
(12.0960,-7.8480) .. controls (12.2040,-7.8600) and (12.3120,-7.8720) ..
(12.3120,-8.0640) .. controls (12.3120,-8.1960) and (12.2040,-8.1960) ..
(12.1680,-8.1960) .. controls (12.1440,-8.1960) and (12.0600,-8.1720) ..
(11.2680,-8.1720) .. controls (10.9080,-8.1720) and (10.5360,-8.1960) ..
(10.1880,-8.1960) .. controls (10.1160,-8.1960) and (9.9720,-8.1960) ..
(9.9720,-7.9680) .. controls (9.9720,-7.8600) and (10.0680,-7.8480) ..
(10.1400,-7.8480) .. controls (10.3800,-7.8360) and (10.7640,-7.7640) ..
(10.7640,-7.3920) .. controls (10.7640,-7.2360) and (10.7160,-7.1520) ..
(10.5960,-6.9480) -- (7.3200,-1.2120) -- (6.8880,-7.4640) .. controls
(6.8880,-7.6080) and (7.0200,-7.8360) .. (7.6920,-7.8480) .. controls
(7.8480,-7.8480) and (7.9680,-7.8480) .. (7.9680,-8.0760) .. controls
(7.9680,-8.1960) and (7.8480,-8.1960) .. (7.7880,-8.1960) .. controls
(7.3680,-8.1960) and (6.9240,-8.1720) .. (6.4920,-8.1720) -- (5.8680,-8.1720)
.. controls (5.6880,-8.1720) and (5.4720,-8.1960) .. (5.2920,-8.1960) ..
controls (5.2200,-8.1960) and (5.0760,-8.1960) .. (5.0760,-7.9680) .. controls
(5.0760,-7.8480) and (5.1600,-7.8480) .. (5.3640,-7.8480) .. controls
(5.9160,-7.8480) and (5.9160,-7.8360) .. (5.9640,-7.1040) -- (6.0000,-6.6720)
-- (2.8920,-1.2120) -- (2.4480,-7.4040) .. controls (2.4480,-7.5360) and
(2.4480,-7.8360) .. (3.2640,-7.8480) .. controls (3.3960,-7.8480) and
(3.5280,-7.8480) .. (3.5280,-8.0640) .. controls (3.5280,-8.1960) and
(3.4200,-8.1960) .. (3.3480,-8.1960) .. controls (2.9280,-8.1960) and
(2.4840,-8.1720) .. (2.0520,-8.1720) -- (1.4280,-8.1720) .. controls
(1.2480,-8.1720) and (1.0320,-8.1960) .. (0.8520,-8.1960) .. controls
(0.7800,-8.1960) and (0.6360,-8.1960) .. (0.6360,-7.9680) .. controls
(0.6360,-7.8480) and (0.7320,-7.8480) .. (0.9000,-7.8480) .. controls
(1.4640,-7.8480) and (1.4760,-7.7760) .. (1.5000,-7.3920) -- (2.0280,-0.0240)
.. controls (2.0400,0.1800) and (2.0520,0.2520) .. (2.1960,0.2520) .. controls
(2.3160,0.2520) and (2.3400,0.2040) .. (2.4480,0.0240) -- (6.0240,-6.2280) --
(6.4680,-0.0240) .. controls (6.4800,0.1800) and (6.4920,0.2520) ..
(6.6360,0.2520) .. controls (6.7560,0.2520) and (6.7920,0.1920) ..
(6.8880,0.0240) -- (10.8360,-6.8640) -- cycle;
\end{scope}
\end{scope}
\end{tikzpicture}
\end{document}
图形看起来很好,但标签不知为何消失了。
答案3
附有PSTricks及解釋。
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-eucl,pst-plot}
\edef\A{2}% semi-major
\edef\B{1}% semi-minor
\edef\Cx{3}% center abscissa
\edef\Cy{3}% center ordinate
% parametric representation of an ellipse
\edef\X(#1){\A*cos(#1)+\Cx}
\edef\Y(#1){\B*sin(#1)+\Cy}
% the left focus point in RPN notation
% [-sqrt(A^2-B^2)+Cx,Cy]
\edef\F{!\A\space 2 exp \B\space 2 exp sub sqrt neg \Cx\space add
\Cy }
\psset{algebraic}
\begin{document}
\begin{pspicture}[showgrid](6,6)
\psparametricplot{0}{Pi 2 mul}{\X(t)|\Y(t)}% plot the ellipse from 0 to 2*pi
\curvepnode{Pi 4 div}{\X(t)|\Y(t)}{P}% define the point P through which the tangent line passes
% \curvepnode also produces a unit tangent vector named Ptang
%----------------------------------------------------------------------------------------------
\pnode(\Cx,\Cy){C}% define the center
\pnode(\F){F}% define the focus
%----------------------------------------------------------------------------------------------
\nodexn{-2(Ptang)+(C)}{S}% vector S = -2 Ptang + C
\nodexn{2(Ptang)+(C)}{T}% vector T = 2 Ptang + C
%-----------------------------------------------------------------------------------------------
\psline[linecolor=red](S)(T)% draw the line passing through C and parallel to the unit tangent vector
\psxline[linecolor=green](P){(S)-(C)}{(T)-(C)}% draw a line from vector P + S - C to P + T - C
\pcline[nodesep=-1,linecolor=blue](F)(P)% drawn a line from F to P
\pstInterLL[PointName=none]{F}{P}{S}{T}{I}% find the intersection point I between line FP and ST
\psdots(P)(C)(F)% draw the points P, C, F
\end{pspicture}
\end{document}
动画片
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-eucl,pst-plot}
\usepackage[nomessages]{fp}
\def\X(#1){2*cos(#1)+3}
\def\Y(#1){sin(#1)+3}
\FPset\N{20}
\FPeval\Step{round(2*pi/N:2)}
\psset{algebraic,unit=0.5}
\begin{document}
\multido{\n=0.00+\Step}{\N}{%
\begin{pspicture*}[showgrid=false](6,6)
\psparametricplot{0}{Pi 2 mul}{\X(t)|\Y(t)}
\curvepnode{\n}{\X(t)|\Y(t)}{P}
\pnode(3,3){Q}
\pnode(!3 sqrt neg 3 add 3){F}
\nodexn{-3(Ptang)+(Q)}{A}
\nodexn{3(Ptang)+(Q)}{B}
\psline[linecolor=red](A)(B)
\psxline[linecolor=green](P){(A)-(Q)}{(B)-(Q)}
\pcline[nodesep=-2,linecolor=blue](F)(P)
\pstInterLL[PointName=none]{F}{P}{A}{B}{I}
\psdots(P)(Q)(F)
\end{pspicture*}}
\end{document}
答案4
使用tzplot
:
\documentclass[border=1mm]{standalone}
\usepackage{tzplot}
\begin{document}
\begin{tikzpicture}[scale=1.4]
\def\aa{2.5}
\def\bb{2}
\tzellipse[thick]"AA"(0,0)(\aa cm and \bb cm)
\pgfmathsetmacro{\focus}{sqrt(\aa*\aa-\bb*\bb)}
\tzcoors*(0,0)(c){c}(-\focus,0)(d){d}($(0,0)+(36:{\aa} and {\bb})$)(r){r};(4pt)
% 1. tangent at (r)
\tztangent{AA}(r)[1:3]
% 2. parallel line through (c)
\tzgetxyval($(r)-(c)$){\rcx}{\rcy}
\tztangent[blue]<-\rcx,-\rcy>"BB"{AA}(r)[1:3]{shifted}[b]
% 3. intersection
\tzline"RD"(r)(d)
\tzXpoint*[red]{RD}{BB}(X){X}(4pt)
\end{tikzpicture}
\end{document}