1 \section{The option \texttt{transform}}
3 The option \Lkeyword{transform}, which is nothing else than a formula $\mathbb{R}^3 \rightarrow \mathbb{R}^3$,
4 which is applied to every point of the solid. In the first example, the object that accepts the transformation is a cube.
5 The referenced cube is yellow, the transformed cube is green and the cube before the \Index{transformation} is setup with a reticule.
7 \subsection{Identical scaling factor in the three coordinates}
9 The scaling factor is set to $0.5$. It is either introduced within the PostScript variable `\texttt{/Facteur}':
11 \pstVerb{/Facteur {.5 mulv3d} def}%
13 and then passed to the option \verb+transform+:
15 \psSolid[object=cube,a=2,ngrid=3,
16 transform=Facteur](2,0,1)%
18 or directly passed to the option:
20 \psSolid[object=cube,a=2,ngrid=3,
21 transform={.5 mulv3d}](2,0,1)%
23 Here the \textit{jps} abbreviation \texttt{transform=\{.5 mulv3d\}} for a function $\mathbb{R}^3 \rightarrow \mathbb{R}^3$ was used.
25 Another method would be to use the code
27 \defFunction[algebraic]{matransformation}(x,y,z)
32 and then pass it to the option
33 \texttt{transform=matransformation}.
34 \begin{LTXexample}[pos=t]
35 \psset{viewpoint=20 60 20 rtp2xyz,lightsrc=viewpoint,Decran=20}
36 \begin{pspicture}(-5,-3)(6,5)
37 \psSolid[object=grille,base=-4 4 -4 4,fillcolor=red!50]%
38 \axesIIID(0,0,0)(4,4,4)%
39 \psSolid[object=cube,fillcolor=yellow!50,
41 \psSolid[object=cube,fillcolor=green!50,
42 a=2,transform={.5 mulv3d},
50 \encadre{The scaling factor also affects the position coordinates of the cube's center.}
52 \subsection{Different scaling factors for the three coordinates}
54 Let's for example use a factor 0.75 for $x$, 4
55 for $y$ and 0.5 for $z$ using the function \texttt{scaleOpoint3d} from the
56 \textit{jps} library---so a cube will be transformed to a cuboid.
57 \begin{LTXexample}[pos=t]
58 \psset{viewpoint=20 60 20 rtp2xyz,lightsrc=viewpoint,Decran=20}
59 \begin{pspicture}(-5,-3)(6,5)
60 \psSolid[object=grille,base=-4 4 -4 4,fillcolor=red!50]%
61 \axesIIID(0,0,0)(4,4,4)%
62 \psSolid[object=cube,fillcolor=yellow!50,
64 \psSolid[object=cube,fillcolor=green!50,
65 a=2,transform={.75 4 .5 scaleOpoint3d},
73 \subsection{Transformation associated with the distance to the origin}
75 Here an example applied to a cube:
78 \left\lbrace\begin{aligned}
79 x'&=\big(0.5\sqrt{x^2+y^2+z^2}+1-0.5\sqrt{3}\big)x \\
80 y'&=\big(0.5\sqrt{x^2+y^2+z^2}+1-0.5\sqrt{3}\big)y \\
81 z'&=\big(0.5\sqrt{x^2+y^2+z^2}+1-0.5\sqrt{3}\big)z
85 \begin{LTXexample}[width=7cm]
86 \begin{pspicture}(-3,-4)(4,3)
87 \psset{viewpoint=20 60 20 rtp2xyz,lightsrc=10 15 7,Decran=20}
93 /b 1 a 3 sqrt mul sub def
94 /k M norme3d a mul b add def
98 \psset{linewidth=.02,linecolor=gray}
99 \psSolid[object=cube,a=3,ngrid=9,
105 \subsection{Bending and \Index{torsion} of beams}
107 The solid to the left is a prism of the height 10 cm with 20 floors
108 (\texttt{\Lkeyword{ngrid}=20 2}). In every floor, an additional angle of rotation---for example 10$^{\mathrm{o}}$ around the $Oz$ axis is---given.
109 Now that the adjacent floors have a distance of $0.5$~cm, one multiplies $z\times20$.
111 La flexion est envisag\'{e}e dans le plan $xOz$ sous l'action d'une force perpendiculaire \`{a} la poutre appliqu\'{e}e en son extr\'{e}mit\'{e}.
113 \begin{LTXexample}[pos=t]
114 \psset{viewpoint=100 50 20 rtp2xyz,lightsrc=viewpoint,Decran=100,unit=0.65}
115 \begin{pspicture}(-3,-1)(3.5,11)
116 \psSolid[object=grille,base=-2 2 -2 2,ngrid=8]%
117 \psSolid[object=prisme,h=10,ngrid=20 2,
118 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]%
120 \begin{pspicture}(-3,-1)(3.5,11)
121 \psSolid[object=grille,base=-2 2 -2 2,ngrid=8]%
123 /torsion {% on tourne de 10 degr\'{e}s suivant l'axe Oz \`{a} chaque niveau
125 /M defpoint3d % on r\'{e}cup\`{e}re les coordonn\'{e}es
126 M /z exch def pop pop
127 M 0 0 z 20 mul rotateOpoint3d
129 \psSolid[object=prisme,h=10,ngrid=20 2,
130 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,
132 \psTransformPoint[RotZ=20](2 0 10)(0,0,0){A}
133 \psTransformPoint[RotZ=20](2 1 10)(0,0,0){A'}
134 \psTransformPoint[RotZ=20](-2 0 10)(0,0,0){B}
135 \psTransformPoint[RotZ=20](-2 -1 10)(0,0,0){B'}
136 \psline[linecolor=red]{v-v}(A')(A)(B)(B')
138 \begin{pspicture}(-3.5,-1)(3,11)
139 \psSolid[object=grille,base=-2 2 -2 2,ngrid=8]%
140 \pstVerb{% id\'{e}e de Christophe Poulain
141 /flexion {% on tourne de 2 degr\'{e}s suivant l'axe Oy \`{a} chaque niveau
143 /M defpoint3d % on r\'{e}cup\`{e}re les coordonn\'{e}es
144 M /z exch def pop pop
145 M 0 z 2 mul 0 rotateOpoint3d
147 \axesIIID(0,0,0)(3,3,10)
148 \psSolid[object=prisme,h=10,ngrid=20 2,
149 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,
151 \psTransformPoint[RotY=20](0.5 0 10)(0,0,0){A}
152 \psPoint(3 20 cos mul 20 sin 10 mul add 0.5 add,0, 20 cos 10 mul 20 sin 3 mul sub){A'}
153 \psdot(A)\psline[linecolor=red]{-v}(A)(A')