|
SmtC: Show me the Code
Ole Peter Smith
Instituto de Matemática e Estatística
Universidade Federal de Goiás
http://www.olesmith.com.br
|
|
Problemas resolvemos na hora!
Milagres demoram mais um pouco...
Provérbio dinamarquês
|
Circle and Chords
Points [;P;] and [;Q;] on Circle [;(O,R);].
$$
\overrightarrow{OP}=\begin{pmatrix}\cos{\alpha}\\\sin{\alpha}\end{pmatrix},
\qquad
\overrightarrow{OQ}=\begin{pmatrix}\cos{\alpha}\\\sin{\alpha}\end{pmatrix},
$$
Drawing one Chord
%Center, (O), \r, radius of main circle should be predefined.
%\alphap and \alphaq as well: Angles for P and Q respective
%Angle for external point, R
\tikzmath{\alpha=(\alphap+\alphaq)*0.5;};
%Unit length coordinates of P, Q and E
\tikzmath{\px=cos(\alphap);};
\tikzmath{\py=sin(\alphap);};
\tikzmath{\qx=cos(\alphaq);};
\tikzmath{\qy=sin(\alphaq);};
\tikzmath{\ex=cos(\alpha);};
\tikzmath{\ey=sin(\alpha);};
\coordinate (P) at ($(O)+\r*(\px,\py)$);
\coordinate (Q) at ($(O)+\r*(\qx,\qy)$);
\coordinate (NP) at ($(-\py,\px)$);
\coordinate (NQ) at ($(-\qy,\qx)$);
\coordinate (P) at ($(O)+\r*(\px,\py)$);
\tikzmath{\pqx=\r*(\qx-\px);};
\tikzmath{\pqy=\r*(\qy-\py);};
%Length of segment PQ: a=|PQ|
\tikzmath{\a=(\px-\qx)*(\px-\qx)+(\py-\qy)*(\py-\qy);};
\tikzmath{\a=\r*sqrt(\a)/2;};
%Distance of segment PQ from origin
\tikzmath{\b=sqrt(\r*\r-\a*\a);};
%Distance from midpoint of PQ to focal point: c
\tikzmath{\c=(0.5*(\r*\r+\a*\a-\b*\b)/\b;};
\tikzmath{\c=\a*\a/\b;};
%Distance from P or Q Q to focal point: d
\tikzmath{\d=(\a*\a+\c*\c/(\b*\b);};
\tikzmath{\d=sqrt(\d);};
\coordinate (S) at ($(O)+\b*(\ex,\ey)$);
\coordinate (R) at ($(S)+\c*(\ex,\ey)$);
\filldraw[test,]
(S) circle(1pt)
node [anchor=north east]{$S$}
;
\filldraw[test,]
(R) circle(1pt)
node [anchor=south]{$R$}
;
\coordinate (PQ) at (\pqx,\pqy);
\tkzLabelSegment[test,pos=0.5,below](O,P) { $r$};
\tkzLabelSegment[test,pos=0.5,below](O,Q) { $r$};
\tkzLabelSegment[test,pos=0.25,below](P,Q) { $a$};
\tkzLabelSegment[test,pos=0.75,below](P,Q) { $a$};
\tkzLabelSegment[test,pos=0.5,right](O,S) { $b$};
\tkzLabelSegment[test,pos=0.5,right](S,R) { $c$};
\tkzLabelSegment[test,pos=0.5,left](P,R) { $d$};
\tkzLabelSegment[test,pos=0.5,right](Q,R) { $d$};
\tkzMarkRightAngle[test,](O,Q,R);
\tkzMarkRightAngle[test,](O,P,R);
\tkzMarkRightAngle[test,](P,S,R);
\tkzMarkRightAngle[test,](Q,S,R);
%Main circle
\draw [name path=c](O) circle(\r);
\draw [art](P) -- (O) -- (Q);
\draw [test,](O) -- (R);
|
Main Drawing
%Angles of P and Q
\tikzmath{\alphap=220;};
\tikzmath{\alphaq=290;};
\tikzmath{\tn=0.2;};
\tikzmath{\tm=0.85;};
%Center of circle
\coordinate (O) at (0,0);
%Radius of circle
\tikzmath{\r=2.5;};
%Main circle
\draw [name path=c](O) circle(\r);
%First
\input{Chord.tikz}
\coordinate (P1) at (P);
\coordinate (Q1) at (Q);
\coordinate (R1) at (R);
\draw [name path=pq1]
(P)
--
($(P)!0.9!(Q)$) node [above] { $r$ }
--
(Q)
;
\draw ($(P)!0!(R)$) -- ($(P)!1.2!(R)$);
\draw ($(Q)!0!(R)$) -- ($(Q)!1.2!(R)$);
%Second
%Angles of P and Q
\tikzmath{\alphap=50;};
\tikzmath{\alphaq=150;};
\input{10/B/05/05.2.Cord.tikz}
\draw [name path=pq2]
(P)
--
($(P)!0.1!(Q)$) node [below] { $s$ }
--
(Q)
;
\coordinate (P2) at (P);
\coordinate (Q2) at (Q);
\coordinate (R2) at (R);
\draw [name path=r12](R1) -- (R2);
\path [name intersections={of=pq1 and r12,by=C1}];
\path [name intersections={of=pq2 and r12,by=C2}];
\foreach \P in {R1,R2,C1,C2}
{
\filldraw (\P) circle(1pt);
}
\coordinate (M) at ($(P)!\tm!(Q)$);
\coordinate (N) at ($(P)!\tn!(Q)$);
\draw [name path=rm,color=white] (R1) -- ($(R1)!1.5!(M)$);
\draw [name path=rn,color=white] (R1) -- ($(R1)!1.5!(N)$);
\draw ($(P)!0!(R)$) -- ($(P)!1.2!(R)$);
\draw ($(Q)!0!(R)$) -- ($(Q)!1.2!(R)$);
\path [name intersections={of=pq1 and rm,by=M1}];
\path [name intersections={of=pq1 and rn,by=N1}];
\path [name intersections={of=c and rm,by=M2}];
\path [name intersections={of=c and rn,by=N2}];
\draw (R1) -- (M2);
\draw (R1) -- (N2);
\coordinate (RR) at ($(P1)!1.5!(R1)$);
\tkzLabelAngle[pos=0.4](RR,R1,Q1) {$F$};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\coordinate (RR) at ($(Q2)!1.5!(R2)$);
\tkzLabelAngle[pos=0.35](P2,R2,RR) {$F'$};
%Position texts for C2, M and N using label angle.
\tkzLabelAngle[pos=0.35](R2,C2,P2) {$C$};
\filldraw (C2) circle(1pt);
\tkzLabelAngle[pos=-0.25](N2,N,C2) {$N'$};
\filldraw (N) circle(1pt);
\tkzLabelAngle[pos=0.4](M2,M,C2) {$M'$};
\filldraw (M) circle(1pt);
%Position texts for C1, M1 and N1 using label angle.
\tkzLabelAngle[pos=0.25](Q1,C1,C2) {$D$};
\filldraw (C1) circle(1pt);
\tkzLabelAngle[pos=0.45](P1,M1,M) {$M$};
\filldraw (M1) circle(1pt);
\tkzLabelAngle[pos=0.45](Q1,N1,N) {$N$};
\filldraw (N1) circle(1pt);
\filldraw[color=white] (P1) circle(2pt);
\draw (P1) circle(2pt) node [left] {$P$};
\filldraw[color=white] (Q1) circle(2pt);
\draw (Q1) circle(2pt) node [below] {$Q$};
\filldraw[color=white] (P2) circle(2pt);
\draw (P2) circle(2pt) node [right,] {$P'$};
\filldraw[color=white] (Q2) circle(2pt);
\draw (Q2) circle(2pt) node [left] {$Q'$};
|
|
Messages:
0 secs.
|