# [pstricks] 3D-Coordinate-System

Markus Krebs markuskrebs at web.de
Wed Aug 15 17:51:13 CEST 2007

Hi!

Is something like this (see example) possible with pst-3dplot?

A 3D-Coordinate System with an angle of 135 degrees between x_2 and
x_1, shortened with factor 1/2 * sqrt(2).

Any help is appreciated!

Thanks!

Markus

Minimal example

\documentclass{article}
\begin{document}
\begin{pspicture}(-6,-6)(8,8)
\psaxes[labels=all,subticks=1]{->}(0,0)(-5.5,-3)(5,7)
\psgrid[linewidth=0.5pt,linestyle=solid,gridwidth=0.5pt,subgriddiv=2,griddots=10,gridlabels=0]
\uput{5pt}[270](5,0){$x_2$}
\uput{5pt}[0](0,7.0){$x_3$}
%
% $x_1$-Achse
%
\def\xAxismin{-6}
\def\xAxismax{8}
%
\FPneg{\xmin}{\xAxismin}
\FPmul{\xmin}{\xmin}{0.5}
\FPneg{\xmax}{\xAxismax}
\FPmul{\xmax}{\xmax}{0.5}
\FPsub{\steps}{\xAxismax}{\xAxismin}
\FPtrunc{\steps}{\steps}{0}
%
\psline[linewidth=1pt]{->}(\xmin,\xmin)(\xmax,\xmax)
\uput{5pt}[270](\xmax,\xmax){$x_1$}
\multido{\r=\xmin+-0.5}{\steps}{%
\rput{0}(\r,\r){\psline[linecolor=black](0.0,-0.15)(0.0,0.15)}
\FPneg{\B}{\B}
\FPtrunc{\B}{\B}{0}
\FPifzero{\B}
% do nothing if \B is zero (do not attach 0 to axis)
\else
\uput{9pt}[270](\r,\r){$\B$}
\fi
}
%
% Coordinates of the point
\def\xthreedcoor{3}
\def\ythreedcoor{4}
\def\zthreedcoor{5}
% [1,0,0] --> [-0.5,-0.5]; [0,1,0]-->[1,0]; [0,0,1]-->[0,1]; [0,0,0]-->[0,0]
% xp=x' = -1/2*x_1+x_2
% yp=y' = -1/2*x_1+x_3
\FPmul{\xtcoor}{\xthreedcoor}{-0.5}
% x'
% y'
%
% draw a line to the calculated point in the plane
\psline[linecolor=blue](0,0)(\xp,\yp)
% draw lines to the axes
\psset{linestyle=dashed}
\psline[linecolor=red](\xtcoor,\xtcoor)(\xp,\xtcoor)(\ythreedcoor,0)
\psline[linecolor=red](0,0)(\xp,\xtcoor)(\xp,\yp)(0,\zthreedcoor)
% print the Coordinates of P and P'
\FPclip{\xp}{\xp}
\FPclip{\yp}{\yp}
\rput*{0}(-3,3){X$(\FPprint{\xthreedcoor} \mid \FPprint{\ythreedcoor} \mid \FPprint{\zthreedcoor})$}
\rput*{0}(-3,2){X$'(\FPprint{\xp} \mid \FPprint{\yp})$}
\uput{5pt}[90](\xp,\yp){X} % angle should depend on P
%
\end{pspicture}

\end{document}