| 1 |
-- File: tkz_elements_functions_regular.lua |
| 2 |
-- Copyright (c) 2026 Alain Matthes |
| 3 |
-- SPDX-License-Identifier: LPPL-1.3c |
| 4 |
-- Maintainer: Alain Matthes |
| 5 |
|
| 6 |
--------------------------------------------------------------------------- |
| 7 |
-- |
| 8 |
--------------------------------------------------------------------------- |
| 9 |
function regular_(c, th, s) |
| 10 |
-- Center through side |
| 11 |
local dep = angle_normalize_(point.arg(th - c)) |
| 12 |
local r = point.mod(th - c) |
| 13 |
local t = {} |
| 14 |
local angle_step = tkz.tau / s |
| 15 |
|
| 16 |
for i = 0, s - 1 do |
| 17 |
table.insert(t, c + point:polar(r, i * angle_step + dep)) |
| 18 |
end |
| 19 |
|
| 20 |
return t |
| 21 |
end |