{
const width = 200;
const height = 200;
const canvas = getCanvas(width, height);
const ctx = canvas.getContext("2d");
ctx.fillStyle = "white";
circle(width / 2, height / 2, 5, ctx);
ctx.textAlign = "center";
function drawDirectionalLightAngleNormal(x, z, color) {
ctx.font = "bold 14px serif";
const distance = Math.sqrt(x * x + z * z);
const degrees = calculateCycleAngle(x / distance, z / distance);
console.log(x / distance, z / distance, x, z, distance, degrees);
x = (-x * width) / 4;
z = (-z * height) / 4;
ctx.fillStyle = "rgb(200,200,200)";
circle(width / 2 + x, height / 2 + z, 3, ctx);
ctx.fillText(`${degrees}°`, width / 2 + x + 2, height / 2 + z - 5);
}
const lightDirections = [
[0, -1],
[-1, -1],
[-1, 0],
[-1, 1],
[0, 1],
[1, 1],
[1, 0],
[1, -1]
];
lightDirections.forEach((lightDirection) => {
drawDirectionalLightAngleNormal(lightDirection[0], lightDirection[1]);
});
return canvas;
}