[pstricks] Polygon as Nodes in ptree

Tan Woon Kiong twoonkio at dso.org.sg
Thu Dec 26 07:42:49 CET 2002


Hi,

I need to draw trees with nodes that are 6-sided polygons. pstree gives 
only up to 4-sides: "\Tdia". Is there a way to go beyond diamond nodes?

Thanks,
- WK


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   From Herbert.Voss at alumni.TU-Berlin.DE Thu Jan  2 11:11:34 2003
Received: from mailout10.sul.t-online.com (mailout10.sul.t-online.com [194.25.134.21])
	by tug.org (8.11.6/8.11.6) with ESMTP id h02ABVx21812
	for <pstricks at tug.org>; Thu, 2 Jan 2003 11:11:32 +0100
Received: from fwd11.sul.t-online.de 
	by mailout10.sul.t-online.com with smtp 
	id 18U2J3-00028n-04; Thu, 02 Jan 2003 11:10:29 +0100
Received: from alumni.TU-Berlin.DE (0308025841-0001@[217.88.112.93]) by fmrl11.sul.t-online.com
	with esmtp id 18U2Iw-2BtSWOC; Thu, 2 Jan 2003 11:10:22 +0100
Message-ID: <3E14100D.90806 at alumni.TU-Berlin.DE>
Date: Thu, 02 Jan 2003 11:10:21 +0100
From: Herbert Voss <Herbert.Voss at alumni.TU-Berlin.DE>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; de-DE; rv:1.0.2) Gecko/20021120 Netscape/7.01
X-Accept-Language: de-de, de
MIME-Version: 1.0
To: Swami Pallasena <swami at math.mun.ca>
CC: pstricks at tug.org
References: <Pine.LNX.4.44.0301011740240.14677-100000 at riemann.math.mun.ca>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Sender: 0308025841-0001 at t-dialin.net
X-Virus-Scanned: by amavisd-milter (http://amavis.org/)
Subject: [pstricks] Re: PSTrick question
Sender: pstricks-admin at tug.org
Errors-To: pstricks-admin at tug.org
X-BeenThere: pstricks at tug.org
X-Mailman-Version: 2.0.13
Precedence: bulk
List-Help: <mailto:pstricks-request at tug.org?subject=help>
List-Post: <mailto:pstricks at tug.org>
List-Subscribe: <http://tug.org/mailman/listinfo/pstricks>,
	<mailto:pstricks-request at tug.org?subject=subscribe>
List-Id: Computational graphics in (La)TeX using PSTricks <pstricks.tug.org>
List-Unsubscribe: <http://tug.org/mailman/listinfo/pstricks>,
	<mailto:pstricks-request at tug.org?subject=unsubscribe>
List-Archive: <http://tug.org/pipermail/pstricks/>

Swami Pallasena schrieb:

>But, if I want "filled" 16 petals, I am unable to understand the
>codes you sent for eight petals filled.  The commands use
>phrases like "add def, sub def, cos mul, sin mul" etc, which I am
>unable to locate in PSTricks manuals - I guess they are raw
>postscript language commands,  Since I did not understand their
>roles, I could not get filled diagram.  You could either let me know
>what these mean, or send me a filled 16 petals according to the
>above specifications, and I shall try to undersnad them.
>  
>
\documentclass{article}
\usepackage{pstricks}
\usepackage{multido}
\begin{document}
\begin{pspicture}(-7,-7)(7,7)
    \SpecialCoor
    \qdisk(0,0){5pt}
\multido{%
    \rAngleA=11.25+22.50,\rAngleB=3.50+22.50,%
    \rAngleC=1+22.50,\rAngleD=0+22.50}{16}{%
        \psarc(0,0){6.5}{-\rAngleA}{\rAngleA}
        \psbezier(6.5;\rAngleA)(8;\rAngleB)(7;\rAngleC)(8;\rAngleD)
            \psbezier(8;-\rAngleD)(7;-\rAngleC)(8;-\rAngleB)(6.5;-\rAngleA)%
    }%
\end{pspicture}
\par
\begin{pspicture}(-7,-7)(7,7)
    \SpecialCoor
    \qdisk(0,0){5pt}
    \multido{\rAngleA=-11.25+22.50,\rAngleB=11.25+22.50}{16}{%
      \pscustom[fillcolor=red,fillstyle=solid]{%
        \psarc(0,0){6.5}{\rAngleA}{\rAngleB}
        \psbezier%
          (! 6.5 \rAngleB\space cos mul 6.5 \rAngleB\space sin mul)%
          (! /a \rAngleB\space 7.75 sub def 8 a cos mul 8 a sin mul)%
          (! /a \rAngleB\space 10.25 sub def 7 a cos mul 7 a sin mul)%
          (! /a \rAngleB\space 11.25 sub def 8 a cos mul 8 a sin mul)
        \psbezier%
          (! /a \rAngleA\space 11.25 add def 8 a cos mul 8 a sin mul)
          (! /a \rAngleA\space 10.25 add def 7 a cos mul 7 a sin mul)%
          (! /a \rAngleA\space 7.75 add def 8 a cos mul 8 a sin mul)%
          (! 6.5 \rAngleA\space cos mul 6.5 \rAngleA\space sin mul)%
      }
    }
\end{pspicture}
\end{document}

you need a closed path to fill something. "(! " starts a postscript
command sequence. It is nearly the same like the code from
the HP pocket calculators. The first solution with the polar coordinates
is a bit tricky. It does not has a closed path, so you are not able to
start a fill command.

Herbert





More information about the PSTricks mailing list