| 1 |
\section{The option \texttt{transform}} |
| 2 |
|
| 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. |
| 6 |
|
| 7 |
\subsection{Identical scaling factor in the three coordinates} |
| 8 |
|
| 9 |
The scaling factor is set to $0.5$. It is either introduced within the PostScript variable `\texttt{/Facteur}': |
| 10 |
\begin{verbatim} |
| 11 |
\pstVerb{/Facteur {.5 mulv3d} def}% |
| 12 |
\end{verbatim} |
| 13 |
and then passed to the option \verb+transform+: |
| 14 |
\begin{verbatim} |
| 15 |
\psSolid[object=cube,a=2,ngrid=3, |
| 16 |
transform=Facteur](2,0,1)% |
| 17 |
\end{verbatim} |
| 18 |
or directly passed to the option: |
| 19 |
\begin{verbatim} |
| 20 |
\psSolid[object=cube,a=2,ngrid=3, |
| 21 |
transform={.5 mulv3d}](2,0,1)% |
| 22 |
\end{verbatim} |
| 23 |
Here the \textit{jps} abbreviation \texttt{transform=\{.5 mulv3d\}} for a function $\mathbb{R}^3 \rightarrow \mathbb{R}^3$ was used. |
| 24 |
|
| 25 |
Another method would be to use the code |
| 26 |
\begin{verbatim} |
| 27 |
\defFunction[algebraic]{matransformation}(x,y,z) |
| 28 |
{.5*x} |
| 29 |
{.5*y} |
| 30 |
{.5*z} |
| 31 |
\end{verbatim} |
| 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, |
| 40 |
a=2,ngrid=3](-2,0,1) |
| 41 |
\psSolid[object=cube,fillcolor=green!50, |
| 42 |
a=2,transform={.5 mulv3d}, |
| 43 |
ngrid=3](2,0,1) |
| 44 |
\psSolid[object=cube, |
| 45 |
action=draw, |
| 46 |
a=2,ngrid=3](2,0,1) |
| 47 |
\end{pspicture} |
| 48 |
\end{LTXexample} |
| 49 |
|
| 50 |
\encadre{The scaling factor also affects the position coordinates of the cube's center.} |
| 51 |
|
| 52 |
\subsection{Different scaling factors for the three coordinates} |
| 53 |
|
| 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, |
| 63 |
a=2,ngrid=3](-2,0,1) |
| 64 |
\psSolid[object=cube,fillcolor=green!50, |
| 65 |
a=2,transform={.75 4 .5 scaleOpoint3d}, |
| 66 |
ngrid=3](2,0,1) |
| 67 |
\psSolid[object=cube, |
| 68 |
action=draw, |
| 69 |
a=2,ngrid=3](2,0,1) |
| 70 |
\end{pspicture} |
| 71 |
\end{LTXexample} |
| 72 |
|
| 73 |
\subsection{Transformation associated with the distance to the origin} |
| 74 |
|
| 75 |
Here an example applied to a cube: |
| 76 |
|
| 77 |
\begin{equation*} |
| 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 |
| 82 |
\end{aligned}\right. |
| 83 |
\end{equation*} |
| 84 |
|
| 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} |
| 88 |
\pstVerb{ |
| 89 |
/gro { |
| 90 |
4 dict begin |
| 91 |
/M defpoint3d |
| 92 |
/a .5 def |
| 93 |
/b 1 a 3 sqrt mul sub def |
| 94 |
/k M norme3d a mul b add def |
| 95 |
M k mulv3d |
| 96 |
end |
| 97 |
} def}% |
| 98 |
\psset{linewidth=.02,linecolor=gray} |
| 99 |
\psSolid[object=cube,a=3,ngrid=9, |
| 100 |
transform=gro]% |
| 101 |
\end{pspicture} |
| 102 |
\end{LTXexample} |
| 103 |
%\newpage |
| 104 |
|
| 105 |
\subsection{Bending and \Index{torsion} of beams} |
| 106 |
|
| 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 |
| 109 |
10$^{\mathrm{o}}$ around the $Oz$ axis is---given. |
| 110 |
Now that the adjacent floors have a distance of $0.5$~cm, one multiplies $z\times20$. |
| 111 |
|
| 112 |
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 |
|
| 114 |
\begin{LTXexample}[pos=t] |
| 115 |
\psset{viewpoint=100 50 20 rtp2xyz,lightsrc=viewpoint,Decran=100,unit=0.65} |
| 116 |
\begin{pspicture}(-3,-1)(3.5,11) |
| 117 |
\psSolid[object=grille,base=-2 2 -2 2,ngrid=8]% |
| 118 |
\psSolid[object=prisme,h=10,ngrid=20 2, |
| 119 |
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 |
\end{pspicture} |
| 121 |
\begin{pspicture}(-3,-1)(3.5,11) |
| 122 |
\psSolid[object=grille,base=-2 2 -2 2,ngrid=8]% |
| 123 |
\pstVerb{ |
| 124 |
/torsion {% on tourne de 10 degr\'{e}s suivant l'axe Oz \`{a} chaque niveau |
| 125 |
2 dict begin |
| 126 |
/M defpoint3d % on r\'{e}cup\`{e}re les coordonn\'{e}es |
| 127 |
M /z exch def pop pop |
| 128 |
M 0 0 z 20 mul rotateOpoint3d |
| 129 |
end} def}% |
| 130 |
\psSolid[object=prisme,h=10,ngrid=20 2, |
| 131 |
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 |
transform=torsion]% |
| 133 |
\psTransformPoint[RotZ=20](2 0 10)(0,0,0){A} |
| 134 |
\psTransformPoint[RotZ=20](2 1 10)(0,0,0){A'} |
| 135 |
\psTransformPoint[RotZ=20](-2 0 10)(0,0,0){B} |
| 136 |
\psTransformPoint[RotZ=20](-2 -1 10)(0,0,0){B'} |
| 137 |
\psline[linecolor=red]{v-v}(A')(A)(B)(B') |
| 138 |
\end{pspicture} |
| 139 |
\begin{pspicture}(-3.5,-1)(3,11) |
| 140 |
\psSolid[object=grille,base=-2 2 -2 2,ngrid=8]% |
| 141 |
\pstVerb{% id\'{e}e de Christophe Poulain |
| 142 |
/flexion {% on tourne de 2 degr\'{e}s suivant l'axe Oy \`{a} chaque niveau |
| 143 |
2 dict begin |
| 144 |
/M defpoint3d % on r\'{e}cup\`{e}re les coordonn\'{e}es |
| 145 |
M /z exch def pop pop |
| 146 |
M 0 z 2 mul 0 rotateOpoint3d |
| 147 |
end} def}% |
| 148 |
\axesIIID(0,0,0)(3,3,10) |
| 149 |
\psSolid[object=prisme,h=10,ngrid=20 2, |
| 150 |
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 |
transform=flexion]% |
| 152 |
\psTransformPoint[RotY=20](0.5 0 10)(0,0,0){A} |
| 153 |
\psPoint(3 20 cos mul 20 sin 10 mul add 0.5 add,0, 20 cos 10 mul 20 sin 3 mul sub){A'} |
| 154 |
\psdot(A)\psline[linecolor=red]{-v}(A)(A') |
| 155 |
\end{pspicture} |
| 156 |
\end{LTXexample} |
| 157 |
|
| 158 |
\endinput |