zauguin / luapstricks

8 stars 0 forks source link

\pstThreeDCircle wrong when using luapstricks #85

Closed Joern-W closed 9 months ago

Joern-W commented 10 months ago

luapstricks messes up \pstThreeDCircle if used in multiple figures.

Example:

\documentclass[parskip=half,fleqn]{scrartcl}
\usepackage{pstricks}
\usepackage{pst-3dplot}

%only for pdflatex:
%\usepackage[pspdf={-dALLOWPSTRANSPARENCY}]{auto-pst-pdf}

\begin{document}

\section*{minimal working example}

First figure is always correct:

\psset{Alpha=80,Beta=15}
\begin{pspicture}(-2,-2)(7,4)
    \pstThreeDCoor  
    \pstThreeDLine(0,0,0)(4,8,4)
    \pstThreeDLine(0,0,0)(7,2,6)
    \pstThreeDCircle[beginAngle=0,endAngle=43](0,0,0)(2,4,2)(7,2,6)
\end{pspicture}

Subsequent figures are messed up when using lualatex:

\begin{pspicture}(-2,-2)(5,5)
    \pstThreeDCoor  
    \pstThreeDCircle[beginAngle=0,endAngle=90](0,0,0)(0,3,0)(0,0,3)
\end{pspicture}

\end{document}

Expected behavior: the circle in the second figure should be between y and z axis. (as seen when using pdflatex and auto-pst-pdf)

correct result by pdflatex:

result_pdflatex

messy result by lualatex:

result_lualatex
hvoss49 commented 10 months ago

A global modification of the end point in pst-3dplot is the problem. I'll fix it.

hvoss49 commented 10 months ago

fixed and upload on the way to CTAN:

@@ -1211,8 +1215,8 @@
     [xB yB zB] exch vector-sub                         % is b-bparallelA=b_orthA
     dup vector-length vecA exch div vector-scale       % is b_orthA with |a| 
     aload pop
-    /zB ED /yB ED /xB ED
-    /vecB [xB yB zB] vector-length def
+    /zBB ED /yBB ED /xBB ED
+    /vecB [xBB yBB zBB] vector-length def
     end
     /aStart \psk@ThreeDplot@beginAngle\space def
     /aEnd \psk@ThreeDplot@endAngle\space def
@@ -1225,18 +1229,24 @@
 %
       /phi angle cvi 90 mod 0 eq { angle } { vecA angle tan mul vecB atan 
         angle 180 div .5 add floor 180 mul add } ifelse def
-      xM xA phi cos mul add xB phi sin mul add 
-      yM yA phi cos mul add yB phi sin mul add 
-      zM zA phi cos mul add zB phi sin mul add 
+      xM xA phi cos mul add xBB phi sin mul add 
+      yM yA phi cos mul add yBB phi sin mul add 
+      zM zA phi cos mul add zBB phi sin mul add 
       saveCoor ConvertTo2D 
       x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul end 
     } def
     /angle aStart def
   }%
pablgonz commented 9 months ago

@hvoss49 I think this is already fixed for luatex (although it returns Non-PDF special ignored! with pdflatex), can you close it?