Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm working on the example given at 4.14.3. in the documentation on Pst-Solides3d : Transformation associated with the distance to the origin.

The code is as follows

\documentclass[a4paper,10pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage[english]{babel} 
\usepackage[english,verbose]{layout}
\usepackage{pstricks-add}
\usepackage{auto-pst-pdf}
\usepackage{multido}
\usepackage{pst-solides3d}
\usepackage{fp}
\begin{document}
\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 0.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](0,0,0)% 
\end{pspicture}
\end{document}

And transforms the cube accordingly. What I would like, is to be able to parameterize the procedure in a loop, for the parameter \a.

\documentclass[a4paper,10pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage[english]{babel} 
\usepackage[english,verbose]{layout}
\usepackage{pstricks-add}
\usepackage{auto-pst-pdf}
\usepackage{multido}
\usepackage{pst-solides3d}
\usepackage{fp}
\begin{document}
\multido{\iA=0+1}{15}{%
\FPeval{\iB}{\iA*0.5/15}%
\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 \iB\space 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](0,0,0)% 
\end{pspicture}
\newpage
}
\end{document}

So that the parameter a varies from 0 to 0.5 (modulo 1 increment..) in 15 steps. But somehow pst-Solides3d doesn't like it when I put anything else than a number there after /a. Any solution ?

For the sake of being perfectly clear : My goal is to animate a coordinate transformation on a cube. The transformation is given by the function /gro. The target transformed cube has a transformation of parameter /a = 0.5. /a = 0 doesn't transform the cube at all. So my goal is to generate pictures with /a ranging from 0 to 0.5, that is going from untransformed to fully transformed cube. Then I'll use animategraphics to animate the transformation.

Edit: I have figured it out, all I was missing was a \space after \iB.

share|improve this question
    
+1 nice question; could you turn your snippet into a complete MWE? :) –  cmhughes Nov 18 '12 at 22:17
    
I don't know if I understand your comment correctly. I interpreted as you wanting me to expand the shortly written second code. Done :) –  Mathusalem Nov 18 '12 at 22:27
    
have a look at MWE –  cmhughes Nov 18 '12 at 22:35
    
Please present the complete code that is compilable for others to make a test. –  I am who I say I am Nov 18 '12 at 23:53
    
Sorry, I forgot to post. This is the whole code. The first one works (with pdflatex) the second one won't. –  Mathusalem Nov 19 '12 at 0:05
show 3 more comments

closed as too localized by Joseph Wright Nov 19 '12 at 8:28

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.