Initialisation du projet pst-solides3d.git (SVN revision 142)
[pst-solides3d.git] / doc / par-projectioncourbe.tex
1 \section {Courbes de fonction numériques et courbes paramétrées}
2
3 \subsection {Courbe de fonction numérique}
4
5 L'objet \Cadre{courbe} permet d'obtenir le tracé de la courbe d'une
6 fonction numérique dont le nom est passée \textsl{via\/} l'argument
7 \Cadre{function}. Cette fonction à valeurs dans \textbf{R} ayant été
8 préalablement définie avec la macro \verb+\defFunction+ vue plus avant
9 dans ce guide.
10
11 On pourra donc définir cette fonction, soit en notation algébrique
12 avec l'option \Cadre{[algebraic]}, soit en notation polonaise
13 inversée (langage postscript), avec une variable quelconque
14 $(x,u,t\ldots)$, par une expression de la forme suivant le cas~:
15
16 \begin{gbar}
17 \begin{verbatim}
18 \defFunction[algebraic]{nom_fonction}(x){x*sin(x)}{}{}
19 \end{verbatim}
20 \end{gbar}
21
22 \begin{gbar}
23 \begin{verbatim}
24 \defFunction{nom_fonction}(x){x dup sin mul}{}{}
25 \end{verbatim}
26 \end{gbar}
27
28 Cette expression dans doit être incluse dans l'environnement
29 \Cadre{pspicture}.
30
31 Les limites de la variable sont définies dans l'option
32 \Cadre{range=$xmin$ $xmax$}, et l'option \Cadre{resolution=$n$} permet
33 de préciser le nombre de points calculés pour le dessin de la courbe.
34
35 \begin{multicols}{2}
36
37 \begin{pspicture}(-3,-3)(4,3.5)%
38 \psframe*[linecolor=blue!50](-3,-3)(4,3.5)
39 \psset{lightsrc=50 20 20,viewpoint=50 30 15,Decran=60}
40 \psset{solidmemory}
41 \defFunction[algebraic]{1_sin}(x){2*sin(1/x)}{}{}
42 \psSolid[object=grille,
43 base=-3 0 -3 3,
44 linewidth=0.5\pslinewidth,linecolor=gray,]
45 %% definition du plan de projection
46 \psSolid[object=plan,
47 definition=equation,
48 args={[1 0 0 0] 90},
49 base=-3.2 3.2 -2.2 2.2,
50 planmarks,
51 showBase,
52 name=monplan,
53 ]
54 \psset{plan=monplan}
55 \psSolid[object=plan,
56 args=monplan,
57 linecolor=gray!40,
58 plangrid,
59 action=none,
60 ]
61 \psProjection[object=courbe,
62 linecolor=red,
63 range=-3 3,resolution=720,
64 function=1_sin,
65 ]
66 \composeSolid
67 \axesIIID(4,2,2)(5,4,3)
68 \end{pspicture}
69
70 \columnbreak
71
72 \begin{gbar}
73 \begin{verbatim}
74 \defFunction[algebraic]{1_sin}(x)
75 {2*sin(1/x)}{}{}
76 \psset{plan=monplan}
77 ...
78 \psProjection[object=courbe,linecolor=red,
79 range=-3 3,resolution=720,function=1_sin]
80 \end{verbatim}
81 \end{gbar}
82 \vskip -10mm
83
84 \end{multicols}
85
86
87 \subsection {Courbes paramétrées}
88
89 La technique est analogue, à la différence près que la fonction
90 évoquée est à valeurs dans $R^2$, et que l'objet passé en paramètre à
91 \verb+\psProjection+ est \Cadre{courbeR2}.
92
93 Pour dessiner un cercle de rayon $3$, on écrira :
94
95 \begin{gbar}
96 \begin{verbatim}
97 \defFunction[algebraic]{cercle}(t){3*cos(t)}{3*sin(t)}{}
98 \end{verbatim}
99 \end{gbar}
100
101 Autre exemple : les courbes de Lissajous.
102
103
104 \begin{multicols}{2}
105
106 \begin{pspicture}(-3,-3)(4,3.5)%
107 \psframe*[linecolor=blue!50](-3,-3)(4,3.5)
108 \psset{lightsrc=50 20 20,viewpoint=50 30 15,Decran=60}
109 \psset{solidmemory}
110 \defFunction[algebraic]{F}(t){2*sin(0.57735*t)}{2*sin(0.707*t)}{}
111 \psSolid[object=grille,
112 base=-3 0 -3 3,
113 linewidth=0.5\pslinewidth,linecolor=gray,]
114 %% definition du plan de projection
115 \psSolid[object=plan,
116 definition=equation,
117 args={[1 0 0 0] 90},
118 base=-3.2 3.2 -2.2 2.2,
119 name=monplan,
120 planmarks,
121 showBase,
122 ]
123 \psset{plan=monplan}
124 \psSolid[object=plan,
125 args=monplan,
126 linecolor=gray!40,
127 plangrid,
128 action=none,
129 ]
130 \psProjection[object=courbeR2,
131 range=-25.12 25.12,resolution=720,
132 normal=1 1 2,linecolor=red,
133 function=F,
134 ]
135 \composeSolid
136 \axesIIID(4,2,2)(5,4,3)
137 \end{pspicture}
138
139 \columnbreak
140
141 \begin{gbar}
142 \begin{verbatim}
143 \defFunction[algebraic]{F}(t)
144 {2*sin(0.57735*t)}
145 {2*sin(0.707*t)}
146 {}
147 \psset{plan=monplan}
148 ...
149 \psProjection[object=courbeR2,
150 range=-25.12 25.12,resolution=720,
151 normal=1 1 2,linecolor=red,
152 function=F,
153 ]
154 \end{verbatim}
155 \end{gbar}
156
157 \end{multicols}
158

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.