[pstricks] Quartic Bezier curves (of fourth order)
Jonny Smith
joesm77 at gmail.com
Thu Mar 20 13:00:59 CET 2008
Awesome! Beautiful! Love it!
I'm using something like
...
\begin{document}
\psset{xunit=0.1cm,yunit=0.1cm}
\begin{pspicture}(125,20)
\psbezierIV[linewidth=4pt,showpoints=true]{<->}(0,2)(45,2)(60,40)(75,2)(120,2)
\end{pspicture}
\end{document}
for my design purposes.
Thanks a lot!
J
On Wed, Mar 19, 2008 at 8:59 PM, Herbert Voss <Herbert.Voss at fu-berlin.de>
wrote:
> a solution created with hot needles ...
>
> Herbert
>
>
> \documentclass{article}
> \usepackage{pst-plot}
>
> \makeatletter
> \pst at def{BezierQuartic}<
> ] /Points ED % y4 x4 y3 x3 y2 x2 y1 x1 y0 x0
> /GetBezierCoor {
> /t ED % t on stack
> /t1 1 t sub def
> % the x coordinate
> Points 8 get t 4 exp mul % x0*B0(t)
> Points 6 get t 3 exp 4 mul mul t1 mul add % x1*B1(t)
> Points 4 get t 2 exp 6 mul mul t1 2 exp mul add % x2*B2(t)
> Points 2 get t 4 mul mul t1 3 exp mul add % x3*B3(t)
> Points 0 get t1 4 exp mul add % x4*B4(t)
> % the y coordinate
> Points 9 get t 4 exp mul % y0*B0(t)
> Points 7 get t 3 exp 4 mul mul t1 mul add % y1*B1(t)
> Points 5 get t 2 exp 6 mul mul t1 2 exp mul add % y2*B2(t)
> Points 3 get t 4 mul mul t1 3 exp mul add % y3*B3(t)
> Points 1 get t1 4 exp mul add % y4*B4(t)
> } def
> /epsilon 0.01 def
> /n 5 def
> epsilon GetBezierCoor % next Bezier point
> Points 0 get Points 1 get % starting point
> ArrowA moveto
> epsilon epsilon 1 {
> /t ED
> t GetBezierCoor
> t 0.9999 lt { lineto }{ 1 epsilon sub GetBezierCoor 4 2 roll ArrowB
> pop pop pop pop } ifelse
> } for >
> %\def\tx at BezierQuartic{BezierQuartic }
> \def\psbezierIV{\pst at object{psbezierIV}}
> \def\psbezierIV at i{%
> \pst at getarrows{%
> \begin at OpenObj
> \pst at getcoors[\psbezierIV at ii%
> }}
> \def\psbezierIV at ii{%
> \addto at pscode{%
> \tx at BezierQuartic
> \ifshowpoints \tx at BezierShowPoints \fi
> }%
> \end at OpenObj}
> %
> \makeatother
>
> \begin{document}
> \psset{xunit=0.2cm}
> \begin{pspicture}(40,15)
>
> \psbezierIV[linewidth=2pt,showpoints=true]{<->}(0,0)(10,5)(20,13)(30,5)(40,0)
> \end{pspicture}
>
> \end{document}
> _______________________________________________
> pstricks mailing list
> pstricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/pstricks/attachments/20080320/6f3be0fe/attachment.html
More information about the PSTricks
mailing list