3 \subsection{Direct definition
}
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$
]}
9 There are other ways to define a polygon in
2D. The options
10 \Lkeyword{definition
} and
\Lkeyword{args
} support these methods:
14 %% syntaxe : pol u --> pol'
15 \item \texttt{\Lkeyword{definition
}=
\Lkeyword{translatepol
}};
16 \texttt{\Lkeyword{args
}=$pol$ $u$
}.
18 Translation of the polygon $pol$ by the
21 %% syntaxe : pol u --> pol'
22 \item \texttt{\Lkeyword{definition
}=
\Lkeyword{rotatepol
}};
23 \texttt{\Lkeyword{args
}=$pol$ $I$ $
\alpha $
}.
25 Image of the polygon $pol$
26 after a rotation with centre $I$ and angle $
\alpha $
28 %% syntaxe : pol I alpha --> pol'
29 \item \texttt{\Lkeyword{definition
}=
\Lkeyword{hompol
}};
30 \texttt{\Lkeyword{args
}=$pol$ $I$ $
\alpha $
}.
32 Image of the polygon $pol$
33 after a homothety (dilation) with centre $I$ and ratio $
\alpha$.
35 %% syntaxe : pol I --> pol'
36 \item \texttt{\Lkeyword{definition
}=
\Lkeyword{sympol
}};
37 \texttt{\Lkeyword{args
}=$pol$ $I$
}.
39 Image of the polygon $pol$ after a
40 reflection in the point $I$.
42 %% syntaxe : pol D --> pol'
43 \item \texttt{\Lkeyword{definition
}=
\Lkeyword{axesympol
}};
44 \texttt{\Lkeyword{args
}=$pol$ $d$
}.
46 Image of the polygon $pol$ after a
47 reflection in the line $d$.
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
}.
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}
63 \psSolid[object=grille,
65 linewidth=
0.5\pslinewidth,linecolor=gray,
]
66 %% definition du plan de projection
70 base=-
3.2 3.2 -
2.2 2.2,
81 \psProjection[object=polygone,
85 \psProjection[object=polygone,
90 %% du code jps dans la definition
91 \psProjection[object=polygone,
92 definition=
{2 -
2 addv
} papply,
93 fillstyle=hlines,hatchcolor=yellow,
98 \axesIIID(
4,
2,
2)(
5,
4,
3)