Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #1528

Re: How do you call this figure

From Cecil Westerhof <Cecil@decebal.nl>
Newsgroups comp.lang.postscript
Subject Re: How do you call this figure
Organization Decebal Computing
References (1 earlier) <87mwp6lozt.fsf@ixod.org> <6p06et.7p8.19.1@isomedia.com> <m37gca-1mo.ln1@luuk.invalid.lan> <87ehahq1e6.fsf@Aspire.decebal.nl> <8761vtpvlj.fsf@Aspire.decebal.nl>
Date 2013-07-30 11:54 +0200
Message-ID <87d2q0cr0g.fsf@Aspire.decebal.nl> (permalink)

Show all headers | View raw


Op maandag 29 jul 2013 11:24 CEST schreef Cecil Westerhof:

> I made the function:
> % centerX centerY radius [innerCircle]  tetrafoil  -
> /tetrafoil {
> 5 dict begin
> dup type /booleantype eq {
> /innerCircle exch def
> } {
> /innerCircle false def
> } ifelse
> /radius  exch def
> /centerY exch def
> /centerX exch def
>
> /offset radius 2 sqrt mul def
>
> gsave
> newpath
> centerX             centerY offset add  radius  315  225  arc
> centerX offset sub  centerY             radius  45   315  arc
> centerX             centerY offset sub  radius  135  45   arc
> centerX offset add  centerY             radius  225  135  arc
> innerCircle {
> centerX radius add  centerY  moveto
> centerX  centerY  radius  0  360  arc
> } if
> stroke
> grestore
> end
> } def
>
>
> And a little demonstration with it:
> [4 6 10 14 20 30 40 60 90] {
> 300  300
> 3  -1  roll
> tetrafoil
> } forall

I think this is a better function. The previous function had the
radius of the arc. I think it is more logical to use the radius of the
figure. And I use a repeat with rotate, because I think this is more
clear.

    % centerX centerY radius [innerCircle]  tetrafoil  -
    /tetrafoil {
        5 dict begin
            dup type /booleantype eq {
                /innerCircle exch def
            } {
                /innerCircle false def
            } ifelse
            /radius  exch def
            /centerY exch def
            /centerX exch def
    
            /circleRadius radius 2 sqrt 1 add div def
            /offset circleRadius 2 sqrt mul       def
    
            gsave
                newpath
                centerX  centerY  translate
                4 {
                    0  offset  circleRadius  315  225  arc
                    90  rotate
                } repeat
                stroke
                innerCircle {
                    0  0  circleRadius  0  360  arc
                    stroke
                } if
            grestore
        end
    } def
    
    [10 15 25 35 75 100 150 225] {
        300  500
        3  -1  roll
        tetrafoil
    } forall

What is a better way: the centre and radius as I use here, or lower
left point with width/height?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How do you call this figure Cecil Westerhof <Cecil@decebal.nl> - 2013-07-28 16:36 +0200
  Re: How do you call this figure Mark Carroll <mtbc@bcs.org> - 2013-07-28 15:48 +0100
    Re: How do you call this figure Raoul Fleckman <raoul.fleckman@gmail.com> - 2013-07-28 16:29 +0000
      Re: How do you call this figure Luuk <luuk@invalid.lan> - 2013-07-28 21:13 +0200
        Re: How do you call this figure Cecil Westerhof <Cecil@decebal.nl> - 2013-07-29 09:19 +0200
          Re: How do you call this figure Cecil Westerhof <Cecil@decebal.nl> - 2013-07-29 11:24 +0200
            Re: How do you call this figure Cecil Westerhof <Cecil@decebal.nl> - 2013-07-30 11:54 +0200
  Re: How do you call this figure luser- -droog <mijoryx@yahoo.com> - 2013-07-28 23:24 -0700
    Re: How do you call this figure Cecil Westerhof <Cecil@decebal.nl> - 2013-07-29 10:08 +0200

csiph-web