4

I'm having trouble doing something that seems very simple, so I'm hoping that I've made a naive mistake.

I'm attempting to project several polygons onto a plane using the \psProjection feature in pst-solides3d.

My polygons project nicely as long as the plane's normal is facing down the x axis. As the plane tilts back (rotating about the y), at first things are fine. However, once the plane tilts back enough my polygon starts getting clipped and disappears from the top down. By the time the plane is tilted totally back, with normal pointing up the z axis, the image has completely disappeared from the plane.

Am I misunderstanding something about the way these projections are supposed to work?

My ultimate goal is to have 3 planes like this one, each with an image, and have them intersect to illustrate an algorithm I'm working on. If pstricks isn't the ideal way to do this, I'd appreciate other suggestions.

\documentclass{article}
\usepackage{pstricks}
\usepackage{pst-solides3d}

\begin{document}

\begin{pspicture}(0,0)(5,5)
    \psset{viewpoint=30 0 30 rtp2xyz,Decran=60,lightsrc=viewpoint}
    \psset{solidmemory}
    % Set normal in plane to [0.25 0 1 0] to reproduce
    \psSolid[object=plan,name=pp1,definition=equation,args={[1 0 0 0] 90}]
    \psset{plan=pp1}
\psProjection[object=polygone,fillstyle=solid,fillcolor=yellow,plan=pp1,args=-1 -0.5 1 -0.5 1 0.5 -1 0.5]
\psProjection[object=polygone,fillstyle=solid,fillcolor=yellow,plan=pp1,args=-1 0.5 0 1.5 1 0.5]
\psProjection[object=polygone,fillstyle=solid,fillcolor=yellow,plan=pp1,args=-0.25 -0.5 0.25 -0.5 0.25 0.25 -0.25 0.25]
\composeSolid
\end{pspicture}
\end{document}

Plane normal down x axis, image correct

Plane normal at 0.75 0 1, image starting to get clipped

Plane normal at 0.25 0 1, image clipped even more

  • the roof of the object is behind the plane. The reason why you cannot see it. – user2478 Jul 20 '13 at 5:35
  • @Herbert: Sorry, could you clarify a bit? The house is entirely drawn in 2D coordinates in the plane (the polygone lines specify only 2d coords), so I don't understand how the roof can be "behind the plane" - everything should live in the plane and "go along for the ride" – emperordali Jul 20 '13 at 5:43
  • your projection plane is before your roof, the reason why the roof is projected onto the backside of the plane and not seen. Use an x value for the plane which is smaller than the one of the roof, eg [-1.25 0 1 0] and you'll see it. – user2478 Jul 21 '13 at 18:06
  • @Herbert: Sorry, again I don't understand. The entire house is specified in 2D coordinates on the plane, so it has no depth - only a width and a height. Changing the normal of the plane to [-1.25 0 1 0] changes the angle of the plane. What I want to do is draw the house on the xy plane, e.g. on the plane with normal [0 0 1 0], not on the plane with normal [-1.25 0 1 0]. – emperordali Jul 21 '13 at 18:23
1

The credit all goes to Manuel Luque. Here I quote his email:

The projection polygon, circle etc.. is clipped into a rectangle corresponding to the base of the projection plane. It is in pst-solides.pro line 11237 and following lines.

/proj-pst-polygone {    proj-action (none) eqstring not {
      l@pl@n plangetrange aload pop
      setyrange setxrange
      newpath
         xmin ymin l@pl@n pointplan smoveto
         xmin ymax l@pl@n pointplan slineto
         xmax ymax l@pl@n pointplan slineto
         xmax ymin l@pl@n pointplan slineto
         xmin ymin l@pl@n pointplan slineto
     planprojpst projpath
      clip % <-------
      solidlinewidth setlinewidth
      linestyle
      linecolor
      proj-definition length 0 eq {
         [proj-args]
      } {
         proj-args
      } ifelse
      proj-definition cvx exec polygone_
      planprojpst projectionsifacevisible projpath    } if    /projname where {
      pop
      proj-definition length 0 eq {
         [proj-args]
      } {
         proj-args
      } ifelse
      proj-definition cvx exec projname cvlit exch def
      /projname where pop /projname undef    } if } def

We must therefore enlarge the base.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.