summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pst-solides3d/doc-en/par-transform_en_corr.tex
blob: d141e5cb126dbae88ec9a6b14c7560d212fd3d99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
\section{The option \texttt{transform}}

The option \verb+transform=...+, which is nothing else than a formula $\mathbb{R}^3 \rightarrow  \mathbb{R}^3$,
which is applied to every point of the solid. In the first example, the object that accepts the transformation is a cube.
The referenced cube is yellow, the transformed cube is green and the cube before the transformation is setup with a reticule.

\subsection{Identical scaling factor in the three coordinates}

The scaling factor is set to $0.5$. It is either introduced within the PostScript variable `\texttt{/Facteur}':
\begin{verbatim}
\pstVerb{/Facteur {.5 mulv3d} def}%
\end{verbatim}
and then passed to the option \verb+transform+:
\begin{verbatim}
\psSolid[object=cube,a=2,ngrid=3,
         transform=Facteur](2,0,1)%
\end{verbatim}
or directly passed to the option:
\begin{verbatim}
\psSolid[object=cube,a=2,ngrid=3,
         transform={.5 mulv3d}](2,0,1)%
\end{verbatim}
Here the \textit{jps} abbreviation \texttt{transform=\{.5 mulv3d\}} for a function $\mathbb{R}^3 \rightarrow \mathbb{R}^3$ was used.

Another method would be to use the code
\begin{verbatim}
\defFunction[algebraic]{matransformation}(x,y,z)
   {.5*x}
   {.5*y}
   {.5*z}
\end{verbatim}
and then pass it to the option
\Cadre{[\texttt{transform=matransformation}]}.
\begin{LTXexample}[pos=t]
\psset{viewpoint=20 60 20 rtp2xyz,lightsrc=viewpoint,Decran=20}
\begin{pspicture}(-5,-3)(6,5)
\psframe(-5,-3)(6,5)
\psSolid[object=grille,base=-4 4 -4 4,fillcolor=red!50]%
\axesIIID(0,0,0)(4,4,4)%
\psSolid[object=cube,fillcolor=yellow!50,
      a=2,ngrid=3](-2,0,1)
\psSolid[object=cube,fillcolor=green!50,
      a=2,transform={.5 mulv3d},
      ngrid=3](2,0,1)
\psSolid[object=cube,
      action=draw,
      a=2,ngrid=3](2,0,1)
\end{pspicture}
\end{LTXexample}

\encadre{The scaling factor also affects the position coordinates of the cube's center.}

\subsection{Different scaling factors for the three coordinates}

Let's for example use a factor 0.75 for $x$, 4
for $y$ and 0.5 for $z$ using the function \texttt{scaleOpoint3d} from the
 \textit{jps} library -- so a cube will be transformed to a cuboid.
\begin{LTXexample}[pos=t]
\psset{viewpoint=20 60 20 rtp2xyz,lightsrc=viewpoint,Decran=20}
\begin{pspicture}(-5,-3)(6,5)
\psframe(-5,-3)(6,5)
\psSolid[object=grille,base=-4 4 -4 4,fillcolor=red!50]%
\axesIIID(0,0,0)(4,4,4)%
\psSolid[object=cube,fillcolor=yellow!50,
      a=2,ngrid=3](-2,0,1)
\psSolid[object=cube,fillcolor=green!50,
      a=2,transform={.75 4 .5 scaleOpoint3d},
      ngrid=3](2,0,1)
\psSolid[object=cube,
      action=draw,
      a=2,ngrid=3](2,0,1)
\end{pspicture}
\end{LTXexample}

\subsection{Transformation associated with the distance to the origin}

Here an example applied to a cube:

\begin{equation*}
\left\lbrace\begin{aligned}
x'&=\big(0.5\sqrt{x^2+y^2+z^2}+1-0.5\sqrt{3}\big)x \\
y'&=\big(0.5\sqrt{x^2+y^2+z^2}+1-0.5\sqrt{3}\big)y \\
z'&=\big(0.5\sqrt{x^2+y^2+z^2}+1-0.5\sqrt{3}\big)z
\end{aligned}\right.
\end{equation*}

\begin{LTXexample}[width=7cm]
\begin{pspicture}(-3,-4)(4,3)
\psset{viewpoint=20 60 20 rtp2xyz,lightsrc=10 15 7,Decran=20}
\pstVerb{
/gro {
4 dict begin
   /M defpoint3d
   /a .5 def
   /b 1 a 3 sqrt mul sub def
   /k M norme3d a mul b add def
   M k mulv3d
end
} def}%
\psset{linewidth=.02,linecolor=gray}
\psSolid[object=cube,a=3,ngrid=9,
      transform=gro]%
\end{pspicture}
\end{LTXexample}
%\newpage

\subsection{Bending and torsion of beams}

The solid to the left is a prism of the height 10 cm with 20 floors
(\verb+[ngrid=20 2]+). In every floor, an additional angle of rotation -- for example 10$^{\mathrm{o}}$ around the $Oz$ axis is -- given.
 Now that the adjacent floors have a distance of $0.5$~cm, one multiplies $z\times20$.

La flexion est envisagée dans le plan $xOz$ sous l'action d'une force perpendiculaire à la poutre appliquée en son extrémité.

\begin{LTXexample}[pos=t]
\psset{viewpoint=100 50 20 rtp2xyz,lightsrc=viewpoint,Decran=100,unit=0.65}
\begin{pspicture}(-3,-1)(3.5,11)
\psframe(-3,-1)(3.5,11)
\psSolid[object=grille,base=-2 2 -2 2,ngrid=8]%
\psSolid[object=prisme,h=10,ngrid=20 2,
        base=0.5 0 0.5 0.5 0 0.5 -0.5 0.5 -0.5 0 -0.5 -0.5 0 -0.5 0.5 -0.5]%
\end{pspicture}
\begin{pspicture}(-3,-1)(3.5,11)
\psframe(-3,-1)(3.5,11)
\psSolid[object=grille,base=-2 2 -2 2,ngrid=8]%
\pstVerb{
/torsion {% on tourne de 10 degrés suivant l'axe Oz à chaque niveau
2 dict begin
   /M defpoint3d % on récupère les coordonnées
   M /z exch def pop pop
    M 0 0 z 20 mul rotateOpoint3d
end} def}%
\psSolid[object=prisme,h=10,ngrid=20 2,
        base=0.5 0 0.5 0.5 0 0.5 -0.5 0.5 -0.5 0 -0.5 -0.5 0 -0.5 0.5 -0.5,
        transform=torsion]%
\psTransformPoint[RotZ=20](2 0 10)(0,0,0){A}
\psTransformPoint[RotZ=20](2 1 10)(0,0,0){A'}
\psTransformPoint[RotZ=20](-2 0 10)(0,0,0){B}
\psTransformPoint[RotZ=20](-2 -1 10)(0,0,0){B'}
\psline[linecolor=red]{v-v}(A')(A)(B)(B')
\end{pspicture}
\begin{pspicture}(-3.5,-1)(3,11)
\psframe(-3.5,-1)(3,11)
\psSolid[object=grille,base=-2 2 -2 2,ngrid=8]%
\pstVerb{%  idée de Christophe Poulain
/flexion {% on tourne de 2 degrés suivant l'axe Oy à chaque niveau
2 dict begin
   /M defpoint3d % on récupère les coordonnées
   M /z exch def pop pop
    M 0 z 2 mul 0 rotateOpoint3d
end} def}%
\axesIIID(0,0,0)(3,3,10)
\psSolid[object=prisme,h=10,ngrid=20 2,
        base=0.5 0 0.5 0.5 0 0.5 -0.5 0.5 -0.5 0 -0.5 -0.5 0 -0.5 0.5 -0.5,
        transform=flexion]%
\psTransformPoint[RotY=20](0.5 0 10)(0,0,0){A}
\psPoint(3 20 cos mul 20 sin 10 mul add 0.5 add,0, 20 cos 10 mul 20 sin 3 mul sub){A'}
\psdot(A)\psline[linecolor=red]{-v}(A)(A')
\end{pspicture}
\end{LTXexample}

\endinput