[metapost] Designing Brahmi DDHA

Hans Hagen pragma at wxs.nl
Tue Jul 31 13:42:40 CEST 2012


On 31-7-2012 12:56, Shriramana Sharma wrote:
> On Tue, Jul 31, 2012 at 3:20 PM, Hans Hagen <pragma at wxs.nl> wrote:
>> just flip the whole result:
>>
>> currentpicture := currentpicture reflectedabout (llcorner
>> currentpicture,lrcorner currentpicture) ;
>
> Hi thanks for your reply. However I think your solution would cause an
> overall y-coordinate shift of the picture because you are reflecting
> it about its lower bounding line. Further, it does not apply to a
> single path. I was very well able to achieve my desired effect of
> in-place flipping (a la GUI vector editors) by adding the following
> lines after the initial computation of pcompliant:

well, then you can reflect over

(xpart llcorner, ypart origin), (xpart lrcorner, ypart origin)

> numeric pleft, pright, phalfheight ;
> phalfheight = ( ypart llcorner p + ypart urcorner p ) / 2 ;
> pleft = xpart llcorner p ;
> pright = xpart urcorner p ;
> pcompliant := pcompliant reflectedabout ( ( pleft, phalfheight ), (
> pright, phalfheight ) ) ;
>
> Therefore my desire was to know how to make this a macro (or a
> vardef), so I can re-use this procedure per path (like I can do in my
> vector editing program). Preferably it would not modify its input path
> but create a new temporary path and return it so that I can do
> something like "path b ; b = flipvertical p ;" or say "draw
> flipvertical p" or such.
>
>   Can you please guide me with that? Thanks.

maybe store the path and swap all y coordinates by looping over the 
pathparts; but it's the same as flipping the whole result over its 
origin (normally the origins ypart represents the baseline)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the metapost mailing list