I manage to create a circle inside triangle with this code, but circle inside other polygons are not maximum size:var p1 = board.create(point, [0.0, 2.0]);var p2 = board.create(point, [2.0, 1.0]);//var pol = board.create(regularpolygon, [p1, p2, 3]);var pol = board.create(regularpolygon, [p1, p2, 4]);//var pol = board.create(regularpolygon, [p1, p2, 5]);board.create(incircle, pol.vertices);What is the easiest way to draw a maximum circle inside square and pentagon?How about smallest circle around the polygon?
Drawing a biggest possible circle inside a polygon - JSXGRAPH
javascript;geometry
This is why geometry class in high school had you spending all that time drawing stuff.Assuming a regular polygon (all sides same length, all corners same angle), it is immediately obvious that the centers of the largest inscribed circle and the smallest circumscribed circle are identical, and are given by the vector arithmetic mean of the polygon vertices.The smallest inscribed circle touches the polygon at the midpoint of each edge.  The radius is thus given by the distance from the center to the midpoint of any one edge of the polygon.The smallest circumscribed circle touches the polygon at every vertex.  The radius is the distance from the center to any one vertex of the polygon.