Thanks, this is very cool! Thanks to this new syntax you can line up
pst-3dplot drawing elements with sketch-generated output. The example
below aligns pst-3dplot axes with sketch based on a tweakable camera
position CamPos.
Unfortunately, the projections don't line up perfectly. If CamY is 0,
things line up for varying CamX,Z, but for significant values of CamY,
the sketch output becomes smaller while pst-3dplot output does not.
I'm not sure why this is happening, though I'm still pretty new to
sketch. I do note that perspective transformations are not supported
by pst-3dplot... any insight here, Gene?
I think I'll probably try to do my figures with rputs (with rotation,
as in the example below) instead of the somewhat nicer-looking
pstPlanePut, just so I can have perspective without trying to hack
pst-3dplot into complying with it. It's a tough call between nice-
looking in-plane text, and perspective. Anyone out there have hints
on making the \rput text look nicer... i.e. more "in-plane") (def
CamPos (15, 15, 10) in the example below to see what I mean)
Cheers,
Don
--------------aligning pst-3dplot with sketch-------------------
%%%%% TWEAKABLES %%%%%
%% cam & axis
def O (0,0,0)
def CamPos (5, 2, 10)
def dx 3
def dy 3
def dz 3
%%%%% DERIVED %%%%%
%% cam & axis
def AlphaAngle 90+atan2((CamPos)'z, (CamPos)'x)
def BetaAngle atan2((CamPos)'y, sqrt((CamPos)'z^2+(CamPos)'x^2))
%%%%% pst-3dtricks setup %%%%%
def Config {
% set up pst-3dplot -- this should always be drawn first
special | \psset{Alpha={#1}, Beta={#2} } | AlphaAngle BetaAngle
special | \psset{RotY=0, RotX=90, RotZ=0} |
}
%%%%% Axes, Ref planes %%%%%
def AxesAndPlane {
% draw the axes
line[arrows=->,linewidth=1pt](O)(dx,0,0)
line[arrows=->,linewidth=1pt](O)(0,dy,0)
line[arrows=->,linewidth=1pt](O)(0,0,dz)
% draw again using pst-3dplot
special | \pstThreeDLine[]{->}(0,0,0)(#1,0,0) | dx
special | \pstThreeDLine[]{->}(0,0,0)(0,#1,0) | dy
special | \pstThreeDLine[]{->}(0,0,0)(0,0,#1) | dz
% draw the plane
polygon[cull=false,fillstyle=solid,opacity=0.6,fillcolor=gray!
20,linewidth=0.7pt](0,0,0)(dx,0,0)(dx,dy,0)(0,dy,0)
special | \rput[bl]#1-2#3{\sf rput} | (-dx,0,0)(dx,0,0)(0,0,0)
% and again using pst-3dplot
special | \pstThreeDSquare(0,0,0)(#1,0,0)(0,#2,0) | dx dy
special | \pstPlanePut [plane=xz, planecorr=xyrot](0,1,0) { { \sf
pstPlanePut } } |
}
def L2PP {
{Config}
{AxesAndPlane}
}
%%%%% Draw with desired cam setup %%%%%
put { view((CamPos)) } {L2PP}
global {
language pstricks
}
---------------------------using the template
file---------------------------
\documentclass{article}
\usepackage[x11names,rgb]{xcolor}
\usepackage{tikz}
\usepackage{pst-3dplot}
\usetikzlibrary{snakes,arrows,shapes,backgrounds}
\usepackage[cmex10]{amsmath}
\usepackage{amsfonts}
% Use preview.sty to crop the page
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{pspicture} % set to tikzpicture for tikz output
\setlength\PreviewBorder{10pt}%
\begin{document}
%%SKETCH_OUTPUT%%
\end{document}
---------------------------------------------