Drawing Polygons
Draws a polygon for a set of vertices.
WARNING
A polygon requires at least three vertices. Otherwise, an error will be thrown.
Props
Name | Description | Type | Default |
---|---|---|---|
vertices | The vertices of the polygon. | PossibleVector2[] | none |
color | The stroke color of the polygon. | string | #000 |
line-width | The stroke line width of the polygon. | number | 1.25 |
fill | The fill color of the polygon. | string | none |
dashed | Whether the polygon should be drawn with a dashed stroke. | boolean | false |
angles | Whether to draw the interior angles of the polygon. | boolean | false |
angle-radius | The radius of the interior angles. | number | 1 |
angle-dashed | Whether the interior angles should be drawn with a dashed stroke. | boolean | false |
Examples
Triangle
Code
vue
<template>
<Graph :units="false" :grid="false" :axis="false">
<Polygon
:vertices="[
[-3, -2],
[-3, 4],
[4.5, -2],
]"
/>
</Graph>
</template>
Regular Hexagon with Angles
Code
vue
<template>
<Graph :units="false" :grid="false" :axis="false">
<Polygon
:vertices="[
[-1, 0.732],
[0, 2.464],
[2, 2.464],
[3, 0.732],
[2, -1],
[0, -1],
]"
angles
:angle-radius="0.7"
/>
</Graph>
</template>