This site is supported by donations to The OEIS Foundation.

Template:Regular polygon/doc

From OeisWiki
Jump to: navigation, search

This documentation subpage contains instructions, categories, or other information for Template:Regular polygon. [<Edit> Template:Regular polygon]

[⧼Purge⧽ Template:Regular polygon/doc]

The {{regular polygon}} graphic template is used to draw a regular polygon. A nondegenerate regular polygon is a polygon with at least 3 distinct vertices. (To draw a nonregular polygon, use the {{polygon}} graphic template.)

Usage


{{regular polygon|n = ''n''|radius = ''radius''|units = ''units''
|stroke width = ''stroke width''|stroke color = ''stroke color''|stroke style = ''stroke style''
|fill = ''fill''|z-index = ''z-index''
}}

where:

  • n is the number (maximum 24) of points (vertices) (default: 3);
  • radius is the radius of the circumscribing circle (default: 100);
  • units are the units associated with radius and stroke width (default: px). Units may be chosen among %, px, cm, mm, in, pc, pt, em or ex;
  • stroke width is the regular polygon stroke width (default: 1);
  • stroke color is the regular polygon stroke color (default: black, i.e.     );
  • stroke style is the stroke style for the regular polygon (default: solid), chosen among the values listed in the table of stroke styles below;
  • fill is the regular polygon fill style (includes color, gradient, pattern) (default: none) (yet to be implemented... if ever possible!);
  • z-index is the z-index of the regular polygon (default: 0, same as for the canvas).

Stroke styles

Table of stroke styles[1]
Value Description
none no line/border
hidden same as none (except in border conflict resolution for table elements)
dotted dotted line/border
dashed dashed line/border
solid solid line/border
double double line/border
groove 3D grooved line/border (the effect depends on the border-color value)
ridge 3D ridged line/border (the effect depends on the border-color value)
inset 3D inset line/border (the effect depends on the border-color value)
outset 3D outset line/border (the effect depends on the border-color value)
inherit line/border style should be inherited from the parent element

Examples


<!--
-->{{canvas|width = 500|height = 500|float = right|<!--

  -->{{translate|<!--
    -->{{regular polygon| 3 | z-index = 2 
       | radius = 50 | stroke width = 3 | units = px       
       | stroke color = red | stroke style = solid        
       }}<!--
  -->| 75, 75
     }}<!--

  -->{{translate|<!--
    -->{{regular polygon| 4 | z-index = 2 
       | radius = 50 | stroke width = 4 | units = px       
       | stroke color = green | stroke style = dotted        
       }}<!--
  -->| 425, 75
     }}<!--

  -->{{translate|<!--
    -->{{regular polygon| 5 | z-index = 2 
       | radius = 150 | stroke width = 5 | units = px       
       | stroke color = gold | stroke style = double        
       }}<!--
  -->| 250, 250
     }}<!--

  -->{{translate|<!--
    -->{{regular polygon| 6 | z-index = 2 
       | radius = 50 | stroke width = 6 | units = px       
       | stroke color = blue | stroke style = dashed        
       }}<!--
  -->| 75, 425
     }}<!--

  -->{{translate|<!--
    -->{{regular polygon| 7 | z-index = 2 
       | radius = 50 | stroke width = 7 | units = px       
       | stroke color = purple | stroke style = solid       
       }}<!--
  -->| 425, 425
     }}<!--



Square trough the centers of the 3-gon, 4-gon, 6-gon and 7-gon

  -->{{translate|<!--  
    -->{{regular polygon| 4 | z-index = 1 
       | radius = (2 * 175^2)^(1/2) | stroke width = 3 | units = px       
       }}<!--
  -->| 250, 250
     }}<!--



  -->{{translate|<!--
    -->{{regular polygon| 8 | z-index = 2 
       | radius = 50 | stroke width = 4 | units = px       
       | stroke color = lightgreen | stroke style = dotted       
       }}<!--
  -->| 250, 250
     }}<!--

-->}}<!--
-->

yields

Rotation applied before translation


<!--
-->{{canvas|width = 500|height = 500|float = right|<!--

  -->{{translate|<!--
    -->{{rotate|<!--
      -->{{regular polygon| 5 | radius = 150 }}<!--    
    -->| angle = 0*(pi/10)
       }}<!--
  -->| 250, 250
     }}<!--

  -->{{translate|<!--
    -->{{rotate|<!--
      -->{{regular polygon| 5 | radius = 150 }}<!--    
    -->| angle = 1*(pi/10)
       }}<!--
  -->| 250, 250
     }}<!--

  -->{{translate|<!--
    -->{{rotate|<!--
      -->{{regular polygon| 5 | radius = 150 }}<!--    
    -->| angle = 2*(pi/10)
       }}<!--
  -->| 250, 250
     }}<!--

  -->{{translate|<!--
    -->{{rotate|<!--
      -->{{regular polygon| 5 | radius = 150 }}<!--    
    -->| angle = 3*(pi/10)
       }}<!--
  -->| 250, 250
     }}<!--

-->}}<!--
-->

yields

Translation applied before rotation


<!--
-->{{canvas|width = 500|height = 500|float = right|<!--

  -->{{translate|<!--
    -->{{rotate|<!--


      -->{{rotate|<!--
        -->{{translate|<!--
          -->{{rotate|<!--
            -->{{regular polygon| 5 | radius = 150 }}<!--    
          -->| angle = - 1*(pi/10)
             }}<!--
        -->| 100, 0
           }}<!--
      -->| angle = 0*(2*pi/5)
         }}<!--

      -->{{rotate|<!--
        -->{{translate|<!--
          -->{{rotate|<!--
            -->{{regular polygon| 5 | radius = 150 }}<!--    
          -->| angle = - 1*(pi/10)
             }}<!--
        -->| 100, 0
           }}<!--
      -->| angle = 1*(2*pi/5)
         }}<!--

      -->{{rotate|<!--
        -->{{translate|<!--
          -->{{rotate|<!--
            -->{{regular polygon| 5 | radius = 150 }}<!--    
          -->| angle = - 1*(pi/10)
             }}<!--
        -->| 100, 0
           }}<!--
      -->| angle = 2*(2*pi/5)
         }}<!--

      -->{{rotate|<!--
        -->{{translate|<!--
          -->{{rotate|<!--
            -->{{regular polygon| 5 | radius = 150 }}<!--    
          -->| angle = - 1*(pi/10)
             }}<!--
        -->| 100, 0
           }}<!--
      -->| angle = 3*(2*pi/5)
         }}<!--
 
      -->{{rotate|<!--
        -->{{translate|<!--
          -->{{rotate|<!--
            -->{{regular polygon| 5 | radius = 150 }}<!--    
          -->| angle = - 1*(pi/10)
             }}<!--
        -->| 100, 0
           }}<!--
      -->| angle = 4*(2*pi/5)
         }}<!--


    -->| angle = 1*(pi/10)
       }}<!--
  -->| 250, 250
     }}<!--

-->}}<!--
-->

yields

Code


<noinclude>{{Documentation}}</noinclude><includeonly><!--
-->{{rotate|<!--
  -->{{polygon| n = {{{n|{{{1|3}}}}}} <!-- equilateral triangle by default
  -->| points = 

{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 2 
| {{#expr: {{{radius|100}}} * cos ( 0 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin ( 0 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
  {{#expr: {{{radius|100}}} * cos ( 1 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin ( 1 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 3 
| {{#expr: {{{radius|100}}} * cos ( 2 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin ( 2 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 4 
| {{#expr: {{{radius|100}}} * cos ( 3 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin ( 3 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 5 
| {{#expr: {{{radius|100}}} * cos ( 4 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin ( 4 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 6 
| {{#expr: {{{radius|100}}} * cos ( 5 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin ( 5 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 7 
| {{#expr: {{{radius|100}}} * cos ( 6 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin ( 6 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 8 
| {{#expr: {{{radius|100}}} * cos ( 7 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin ( 7 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 9 
| {{#expr: {{{radius|100}}} * cos ( 8 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin ( 8 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 10 
| {{#expr: {{{radius|100}}} * cos ( 9 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin ( 9 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 11 
| {{#expr: {{{radius|100}}} * cos (10 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin (10 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 12 
| {{#expr: {{{radius|100}}} * cos (11 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin (11 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 13 
| {{#expr: {{{radius|100}}} * cos (12 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin (12 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 14 
| {{#expr: {{{radius|100}}} * cos (13 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin (13 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 15 
| {{#expr: {{{radius|100}}} * cos (14 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin (14 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 16 
| {{#expr: {{{radius|100}}} * cos (15 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin (15 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 17 
| {{#expr: {{{radius|100}}} * cos (16 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin (16 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 18 
| {{#expr: {{{radius|100}}} * cos (17 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin (17 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 19 
| {{#expr: {{{radius|100}}} * cos (18 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin (18 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 20 
| {{#expr: {{{radius|100}}} * cos (19 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin (19 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 21 
| {{#expr: {{{radius|100}}} * cos (20 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin (20 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 22 
| {{#expr: {{{radius|100}}} * cos (21 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin (21 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 23 
| {{#expr: {{{radius|100}}} * cos (22 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin (22 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}} 
{{#ifexpr: ( {{{n|{{{1|3}}}}}} ) >= 24 
| {{#expr: {{{radius|100}}} * cos (23 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }}, {{#expr: {{{radius|100}}} * sin (23 * ( 2*pi / ( {{{n|{{{1|3}}}}}} ) ) ) }};
}}
 
     | units = {{{units|px}}} 
     | stroke width = {{{stroke width|1}}} 
     | stroke color = {{{stroke color|black}}} 
     | stroke style = {{{stroke style|solid}}} 
     | fill = {{{fill|none}}} 
     | z-index = {{{z-index|0}}} 
     }}<!--
-->| angle = {{#expr: ( 6 - ( {{{n|{{{1|3}}}}}} ) ) * ( pi / (2 * ( {{{n|{{{1|3}}}}}} ) ) ) }}
   | angle unit = rad
   }}<!--
--></includeonly>

See also

Drawing templates






Affine transforms templates

See Help:CSS Transforms.




Notes

  1. www.w3schools.com, CSS border-style Property.