From 4d279427e5ff95b4ac7a1e0324a746894ef04280 Mon Sep 17 00:00:00 2001 From: mathieu-mp Date: Fri, 1 Mar 2024 04:49:29 +0100 Subject: [PATCH] Add regular polygon shapes to display component (#3551) --- components/display/index.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/display/index.rst b/components/display/index.rst index a8a9b12f0..b061e51d2 100644 --- a/components/display/index.rst +++ b/components/display/index.rst @@ -101,6 +101,13 @@ and circles: // and a filled triangle ! it.filled_triangle(125, 5, 105, 25, 150, 50); + // Regular Polygons? Let's draw the outline of a pointy-topped hexagon inscribed in a circle + // centered on [x1=100,y1=100] with a radius of 50 + it.regular_polygon(100, 100, 50, EDGES_HEXAGON); + // and a filled flat-topped octagon! + it.filled_regular_polygon(200, 200, 50, EDGES_OCTAGON, VARIATION_FLAT_TOP); + // Need to rotate the polygon, or retrieve the coordinates of its vertices? Check the API! + All the above methods can optionally also be called with an argument at the end which specifies in which color to draw. For monochrome displays, only ``COLOR_ON`` (the default if color is not given) and ``COLOR_OFF`` are supported.