# [pstricks] error in qudripole in pst-circ v2.09

Patrice MÉGRET Patrice.MEGRET at umons.ac.be
Wed Jun 18 09:43:14 CEST 2014

```Dear Herbert,

I come back to the quadripole in pst-circ v2.09.
The following code is used in the optocoupler  (line 1359, error in line 1375), quadripole (line1393, error in line 1408) and coupleur (line 2903, error in line 2916). (There is of course the same error for my newtransformerquad) in the version I sent you yesterday)
There is a systematic error for #4 because /X4 and /Y4 are replaced by  \pst at tempc instead of \pst at tempd, so the horizontal centering never takes into account the#4 coordinates.

By the way, the mechanism to center along the x-axis differs from that to center on the y-axis.
If x1,y1 is the topleft, x2,y2 the bottomleft, x3,y3 the topright and x4,y4 the bottomright, we have:

Xc =( greater of (x1,x2) + lower of (x3,x4))/2
Yc =( lower of (y1,y3) + lower of (y2,y4))/2

\pnode(!%
\pst at tempa /Y1 exch \pst at number\psyunit div def
/X1 exch \pst at number\psxunit div def
\pst at tempb /Y2 exch \pst at number\psyunit div def
/X2 exch \pst at number\psxunit div def
\pst at tempc /Y3 exch \pst at number\psyunit div def
/X3 exch \pst at number\psxunit div def
\pst at tempc /Y4 exch \pst at number\psyunit div def
/X4 exch \pst at number\psxunit div def
/XC X1 X2 lt {X2} {X1} ifelse X3 X4 lt {X3} {X4} ifelse add 2 div def
/YC Y1 Y3 lt {Y1} {Y3} ifelse Y2 Y4 lt {Y2} {Y4} ifelse add 2 div def
XC YC){C@}

Could you correct the errors with \pst at tempd.
For the centering, it is more logical to take the greater of (y2,y3) but  it is a question of taste.

Best regards,

Patrice

UMONS
__________________________________________________________
Prof. Dr Ir Patrice Mégret
Université de Mons - University of Mons
Faculté Polytechnique - Faculty of Engineering
Head of Electromagnetism and Telecommunication Department
Boulevard Dolez 31
7000 Mons
Belgium
+32(0)65/37.41.91 (direct)
+32(0)65/37.41.47 (secretary)
+32(0)65/37.41.99 (fax)
www.umons.ac.be/telecom<http://www.umons.ac.be/telecom>
people.umons.ac.be/patrice.megret<http://people.umons.ac.be/patrice.megret>
__________________________________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/pstricks/attachments/20140618/77f68a6c/attachment-0001.html>
```