Files
web_2025/R4.01_R4.A.10/td_tp/tp5/src/ex2/helper.js
2026-03-09 14:55:40 +01:00

14 lines
322 B
JavaScript

const valueToPoint = (value, index, total) => {
const x = 0
const y = -value * 1.6
const angle = Math.PI * 2 / total * index
const cos = Math.cos(angle)
const sin = Math.sin(angle)
const tx = x * cos - y * sin + 200
const ty = x * sin + y * cos + 200
return {
x: tx,
y: ty
}
}