<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Fun with SAS ODS Graphics: 3 Cheers for the Red, White, and Blue (Polygons) in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-3-Cheers-for-the-Red-White-and-Blue/m-p/666607#M20162</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Captain America's Shield, ODS Graphics Edition" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46853i66F29C9853A34D0F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CaptainAmericaShield.png" alt="Captain America's Shield, ODS Graphics Edition" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Captain America's Shield, ODS Graphics Edition&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Right you are,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;!&amp;nbsp;Very thoughtful of you to remember the Captain with his &lt;A href="https://www.quora.com/When-was-Captain-America-born" target="_self"&gt;July 4th birthday&lt;/A&gt; approaching!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*==&amp;gt; Remix for SAS ODS Graphics Take on Captain America's Shield
     Modeled after en.wikipedia.org/wiki/Captain_America%27s_shield;

proc sgplot data=stars(where=(id=1.5)) noautolegend noborder aspect=1;        * Select any star, scale circles appropriately;    
ellipseparm semimajor=3.75 semiminor=3.75 /  fill fillattrs=(color=CXB22234); * "Old Glory Red" circle;
ellipseparm semimajor=3 semiminor=3 /  fill fillattrs=(color=white);          * White circle;
ellipseparm semimajor=2.25 semiminor=2.25 /  fill fillattrs=(color=CXB22234); * "Old Glory Red" circle;
ellipseparm semimajor=1.5 semiminor=1.5 /  fill fillattrs=(color=CX3C3B6E);   * "Old Glory Blue" circle;
polygon x=nx y=ny id=id / group=id fill fillattrs=(color=white);              * White star;
xaxis display=none; yaxis display=none;                                       * Hide axes;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Jul 2020 15:35:33 GMT</pubDate>
    <dc:creator>tc</dc:creator>
    <dc:date>2020-07-02T15:35:33Z</dc:date>
    <item>
      <title>Fun with SAS ODS Graphics: 3 Cheers for the Red, White, and Blue (Polygons)</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-3-Cheers-for-the-Red-White-and-Blue/m-p/666526#M20157</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Happy '04JUL2020'd!" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46841i8D503C209206638D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="July4V2.png" alt="Happy '04JUL2020'd!" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Happy '04JUL2020'd!&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sure, you could settle for unicode stars (U+2605) or SAS 'starfilled' markers for your 4th of July plots. But what's the fun in that when you can roll your own polygon stars with SAS ODS Graphics and a little math help (&lt;A href="https://blackeyepeas.phys.lsu.edu/courses/ict/19c/3/Points.html" target="_self"&gt;1&lt;/A&gt; &lt;A href="https://mathworld.wolfram.com/Pentagram.html" target="_self"&gt;2&lt;/A&gt; &lt;A href="https://stackoverflow.com/questions/13695317/rotate-a-point-around-another-point" target="_self"&gt;3&lt;/A&gt;)? Happy Independence Day!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; Updated to use RGB color codes for "Old Glory Red and Blue".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="A Star..." style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46844i9C3AFDC5C5A5D916/image-size/medium?v=v2&amp;amp;px=400" role="button" title="july4outlineV2.png" alt="A Star..." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;A Star...&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="...Is Born" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46843i3284F9CCC9C51969/image-size/medium?v=v2&amp;amp;px=400" role="button" title="july4fillV2.png" alt="...Is Born" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;...Is Born&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Fun with SAS ODS Graphics: 04Jul2020 - Three Cheers for the Red, White, and Blue (Polygons)
  Inspired by discussions of stars/pentagrams at:
  1. blackeyepeas.phys.lsu.edu/courses/ict/19c/3/Points.html
  2. mathworld.wolfram.com/Pentagram.html                                       
  3. stackoverflow.com/questions/13695317/rotate-a-point-around-another-point;

proc fcmp outlib=work.funcs.points;                   * User-defined functions;     
subroutine rotate_pt(aD,oX,oY,nX,nY);                 * Function rotates a point (oX, oY) by given # of degrees (aD); 
outargs nX, nY;                                       * Returns coordinates of new point (nX, nY); 
aR=aD*constant("pi")/180;                             * Convert from degrees to radian;
nX=cos(aR)*oX-sin(aR)*oY;                             * Compute new X position;
nY=sin(aR)*ox+cos(aR)*oY;                             * Compute new Y position;
endsub;
run;

options cmplib=(work.funcs);
data stars(keep=id nx ny);                            * Generate points for stars (vertices of outer and inner pentagons);
do id=4.5 to 1.5 by -1.5;                             * Nested polygons (red, white, and blue); 
  nx=0;                                               * Initialize x/y coordinates;                                     
  ny=id;                
  output;                                             * Point on larger outer pentagon;
  ox=nx; oy=ny;              
  call rotate_pt(360/5/2,.382*ox,.382*oy,nX,nY);      * Rotate (36 degrees) and scale outer pentagon points to inner pentagon points;
  output;                                             * Point on smaller inner pentagon;
  do i=1 to 4;
    call rotate_pt(360/5,ox,oy,nX,nY);                * Rotate outer pentagon points (72 degrees);
    output;                                           * Point on larger outer pentagon;
    ox=nx; oy=ny;
    call rotate_pt(360/5/2,.382*ox,.382*oy,nX,nY);    * Rotate (36 degrees) and scale outer pentagon points to inner pentagon points;
    output;                                           * Point on smaller inner pentagon;
  end;
end;

proc sgplot data=stars noautolegend noborder aspect=1;* Draw nested red=white-blue stars (polygon plot); 
styleattrs datacolors=(CXB22234 white CX3C3B6E);      * "Old Glory Red", White, "Old Glory Blue";
polygon x=nx y=ny id=id / group=id fill;              * Stars;
xaxis display=none; yaxis display=none;               * Hide axes;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2020 03:23:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-3-Cheers-for-the-Red-White-and-Blue/m-p/666526#M20157</guid>
      <dc:creator>tc</dc:creator>
      <dc:date>2020-07-02T03:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: Fun with SAS ODS Graphics: 3 Cheers for the Red, White, and Blue (Polygons)</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-3-Cheers-for-the-Red-White-and-Blue/m-p/666587#M20161</link>
      <description>&lt;P&gt;Nice job&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4628"&gt;@tc&lt;/a&gt;!&amp;nbsp; Add a few concentric circles and you'd have a Captain America shield.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2020 12:37:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-3-Cheers-for-the-Red-White-and-Blue/m-p/666587#M20161</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2020-07-02T12:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Fun with SAS ODS Graphics: 3 Cheers for the Red, White, and Blue (Polygons)</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-3-Cheers-for-the-Red-White-and-Blue/m-p/666607#M20162</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Captain America's Shield, ODS Graphics Edition" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46853i66F29C9853A34D0F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CaptainAmericaShield.png" alt="Captain America's Shield, ODS Graphics Edition" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Captain America's Shield, ODS Graphics Edition&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Right you are,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;!&amp;nbsp;Very thoughtful of you to remember the Captain with his &lt;A href="https://www.quora.com/When-was-Captain-America-born" target="_self"&gt;July 4th birthday&lt;/A&gt; approaching!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*==&amp;gt; Remix for SAS ODS Graphics Take on Captain America's Shield
     Modeled after en.wikipedia.org/wiki/Captain_America%27s_shield;

proc sgplot data=stars(where=(id=1.5)) noautolegend noborder aspect=1;        * Select any star, scale circles appropriately;    
ellipseparm semimajor=3.75 semiminor=3.75 /  fill fillattrs=(color=CXB22234); * "Old Glory Red" circle;
ellipseparm semimajor=3 semiminor=3 /  fill fillattrs=(color=white);          * White circle;
ellipseparm semimajor=2.25 semiminor=2.25 /  fill fillattrs=(color=CXB22234); * "Old Glory Red" circle;
ellipseparm semimajor=1.5 semiminor=1.5 /  fill fillattrs=(color=CX3C3B6E);   * "Old Glory Blue" circle;
polygon x=nx y=ny id=id / group=id fill fillattrs=(color=white);              * White star;
xaxis display=none; yaxis display=none;                                       * Hide axes;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2020 15:35:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-3-Cheers-for-the-Red-White-and-Blue/m-p/666607#M20162</guid>
      <dc:creator>tc</dc:creator>
      <dc:date>2020-07-02T15:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Fun with SAS ODS Graphics: 3 Cheers for the Red, White, and Blue (Polygons)</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-3-Cheers-for-the-Red-White-and-Blue/m-p/666619#M20163</link>
      <description>&lt;P&gt;Nice.&amp;nbsp; And, if you use a GLOSS or SHEEN skin, you may also get the lighting effect on the shield.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2020 15:16:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-3-Cheers-for-the-Red-White-and-Blue/m-p/666619#M20163</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2020-07-02T15:16:40Z</dc:date>
    </item>
  </channel>
</rss>

