| 1 |
\section{Polygons} |
| 2 |
|
| 3 |
\subsection{Direct definition} |
| 4 |
|
| 5 |
The object \Lkeyword{polygone} allows us to define a \Index{polygon}. We use |
| 6 |
the option \Lkeyword{args} to specify the list of vertices: |
| 7 |
\texttt{[object=polygone,args=$A_0$ $A_1$ \ldots $A_n$]} |
| 8 |
|
| 9 |
There are other ways to define a polygon in 2D. The options |
| 10 |
\Lkeyword{definition} and \Lkeyword{args} support these methods: |
| 11 |
|
| 12 |
\begin{itemize} |
| 13 |
|
| 14 |
%% syntaxe : pol u --> pol' |
| 15 |
\item \texttt{\Lkeyword{definition}=\Lkeyword{translatepol}}; |
| 16 |
\texttt{\Lkeyword{args}=$pol$ $u$}. |
| 17 |
|
| 18 |
Translation of the polygon $pol$ by the |
| 19 |
vector $\vec u$ |
| 20 |
|
| 21 |
%% syntaxe : pol u --> pol' |
| 22 |
\item \texttt{\Lkeyword{definition}=\Lkeyword{rotatepol}}; |
| 23 |
\texttt{\Lkeyword{args}=$pol$ $I$ $\alpha $}. |
| 24 |
|
| 25 |
Image of the polygon $pol$ |
| 26 |
after a rotation with centre $I$ and angle $\alpha $ |
| 27 |
|
| 28 |
%% syntaxe : pol I alpha --> pol' |
| 29 |
\item \texttt{\Lkeyword{definition}=\Lkeyword{hompol}}; |
| 30 |
\texttt{\Lkeyword{args}=$pol$ $I$ $\alpha $}. |
| 31 |
|
| 32 |
Image of the polygon $pol$ |
| 33 |
after a homothety (dilation) with centre $I$ and ratio $\alpha$. |
| 34 |
|
| 35 |
%% syntaxe : pol I --> pol' |
| 36 |
\item \texttt{\Lkeyword{definition}=\Lkeyword{sympol}}; |
| 37 |
\texttt{\Lkeyword{args}=$pol$ $I$}. |
| 38 |
|
| 39 |
Image of the polygon $pol$ after a |
| 40 |
reflection in the point $I$. |
| 41 |
|
| 42 |
%% syntaxe : pol D --> pol' |
| 43 |
\item \texttt{\Lkeyword{definition}=\Lkeyword{axesympol}}; |
| 44 |
\texttt{\Lkeyword{args}=$pol$ $d$}. |
| 45 |
|
| 46 |
Image of the polygon $pol$ after a |
| 47 |
reflection in the line $d$. |
| 48 |
\end{itemize} |
| 49 |
|
| 50 |
|
| 51 |
In the following example we define, name and draw the polygon with |
| 52 |
vertices $(-1,0)$, $(-3, 1)$, $(0, 2)$, then---in blue---the |
| 53 |
image after a rotation about the point $(-1,0)$ through an angle |
| 54 |
$-45$. Finally, we translate the polygon with the vector shift |
| 55 |
$(2,-2)$ by directly incorporating \textit{jps code} within the |
| 56 |
argument of \Lkeyword{definition}. |
| 57 |
|
| 58 |
\begin{LTXexample}[width=7.5cm] |
| 59 |
\begin{pspicture}(-3,-3)(4,3.5)% |
| 60 |
\psframe*[linecolor=blue!50](-3,-3)(4,3.5) |
| 61 |
\psset{lightsrc=50 20 20,viewpoint=50 30 15,Decran=60} |
| 62 |
\psset{solidmemory} |
| 63 |
\psSolid[object=grille, |
| 64 |
base=-3 0 -3 3, |
| 65 |
linewidth=0.5\pslinewidth,linecolor=gray,] |
| 66 |
%% definition du plan de projection |
| 67 |
\psSolid[object=plan, |
| 68 |
definition=equation, |
| 69 |
args={[1 0 0 0] 90}, |
| 70 |
base=-3.2 3.2 -2.2 2.2, |
| 71 |
name=monplan, |
| 72 |
planmarks, |
| 73 |
] |
| 74 |
\psset{plan=monplan} |
| 75 |
\psSolid[object=plan, |
| 76 |
args=monplan, |
| 77 |
linecolor=gray!40, |
| 78 |
plangrid, |
| 79 |
action=none, |
| 80 |
] |
| 81 |
\psProjection[object=polygone, |
| 82 |
args=-1 0 -3 1 0 2, |
| 83 |
name=P, |
| 84 |
] |
| 85 |
\psProjection[object=polygone, |
| 86 |
definition=rotatepol, |
| 87 |
linecolor=blue, |
| 88 |
args=P -1 0 -45, |
| 89 |
] |
| 90 |
%% du code jps dans la definition |
| 91 |
\psProjection[object=polygone, |
| 92 |
definition={2 -2 addv} papply, |
| 93 |
fillstyle=hlines,hatchcolor=yellow, |
| 94 |
linestyle=dashed, |
| 95 |
args=P, |
| 96 |
] |
| 97 |
\composeSolid |
| 98 |
\axesIIID(4,2,2)(5,4,3) |
| 99 |
\end{pspicture} |
| 100 |
\end{LTXexample} |
| 101 |
|
| 102 |
\endinput |