Published
Edited
Mar 10, 2022
1 fork
Insert cell
# Функция getAngleDiff
Insert cell
angleTolerance = 45 * Math.PI / 180
Insert cell
function normalizeAngle(a) {
return ((a + Math.PI / 2) % Math.PI) - Math.PI / 2;
}
Insert cell
Insert cell
function toRad(deg) { return deg * Math.PI / 180; }
Insert cell
[getAngleDiff(toRad(180), toRad(-180)), getAngleDiff(toRad(-180), toRad(180))]
Insert cell
{
let tab = '\n';
for (let x = -Math.PI; x < Math.PI; x += Math.PI/18) {
let g = (x * 180 / Math.PI).toFixed(0);
while (g.length < 5) {
g += ' ';
}
tab += g + ' ';
for (let y = -Math.PI; y < Math.PI; y += Math.PI/18) {
const angleDiff = getAngleDiff(x, y);
tab += ' '; // + angleDiff.toFixed(1);
if (angleDiff > angleTolerance) {
tab += '*'
} else {
tab += ' '
}
}
tab += '\n';
}
return tab;
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more