// SPDX-License-Identifier: MIT
// Copyright (c) 2026 Incoprea
// Polygon across-flats sizing
// Not compiled or tested in-world
// Setup: Place in a spare prim. Set side count at least three and circumradius positive. Owner touch prints results without altering the scene.
// Stop / restore: Disable or remove. No prim properties are changed.
// Notes: Across-flats diameter is twice the apothem; for odd-sided polygons it is not the total width between opposite edges.
// License: see LICENSE in this distribution.
// Original Incoprea. MIT. Owner-only calculation.
integer SIDES=8;
float RADIUS=4.0;
default
{
    touch_start(integer detectedCount)
    {
        if (llDetectedKey(0)!=llGetOwner()) return;
        if(SIDES<3||RADIUS<=0.0)
        {
            llOwnerSay("Invalid polygon.");
            return;
        }
        float a=PI/(float)SIDES;
        llOwnerSay("Apothem="+(string)(RADIUS*llCos(a))+"; twice apothem="+(string)(2.0*RADIUS*llCos(a))+"; side="+(string)(2.0*RADIUS*llSin(a)));
    }
}
