working lib

This commit is contained in:
Martin Fuchs
2026-08-16 13:50:49 +02:00
parent 5ca9b99df8
commit 0a0b8b19dc
3 changed files with 13 additions and 16 deletions
+1 -1
View File
@@ -44,7 +44,7 @@
} }
</style> </style>
<script src="https://cdn.jsdelivr.net/npm/p5@1.11.3/lib/p5.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/p5@1.11.3/lib/p5.min.js"></script>
<script src="../../lib/WallPlotter.js?v=stop-s"></script> <script src="../../lib/WallPlotter.js?v=bounds-px"></script>
<script src="sketch.js"></script> <script src="sketch.js"></script>
</head> </head>
<body> <body>
+6 -8
View File
@@ -1,6 +1,6 @@
let wp; let wp;
let area = 400; let area = 120;
function setup() { function setup() {
const canvas = createCanvas(windowWidth, windowHeight); const canvas = createCanvas(windowWidth, windowHeight);
@@ -42,15 +42,13 @@ async function drawArt(testOnly) {
wp.move(-area, -area); wp.move(-area, -area);
//wp.wait(1000 * 10); //wp.wait(1000 * 10);
let step = area / 4.001; let step = area / 2;
for (let y = -area; y < area; y+=step){ for (let y = -area; y <= area; y+=step){
for (let x = -area; x < area; x+=step){ for (let x = -area; x <= area; x+=step){
//if(random(1) < 0.8){ wp.move(x+step, y);
wp.draw(x, y);
wp.draw(x, y+step); wp.draw(x, y+step);
//} }
}
} }
await wp.runPath(testOnly); await wp.runPath(testOnly);
+6 -7
View File
@@ -929,15 +929,14 @@ class WallPlotter {
line(tl.x, 0, br.x, 0); line(tl.x, 0, br.x, 0);
line(0, tl.y, 0, br.y); line(0, tl.y, 0, br.y);
// Size labels in cm along bottom and right edges // Size labels in cm + screen pixels along bottom and right edges
const widthCm = (bounds.xMax - bounds.xMin) / 10; const widthCm = (bounds.xMax - bounds.xMin) / 10;
const heightCm = (bounds.yMax - bounds.yMin) / 10; const heightCm = (bounds.yMax - bounds.yMin) / 10;
const widthLabel = Number.isInteger(widthCm) const widthPx = Math.round(Math.abs(w));
? `${widthCm} cm` const heightPx = Math.round(Math.abs(h));
: `${widthCm.toFixed(1)} cm`; const fmtCm = (cm) => (Number.isInteger(cm) ? `${cm}` : cm.toFixed(1));
const heightLabel = Number.isInteger(heightCm) const widthLabel = `${fmtCm(widthCm)} cm · ${widthPx} px`;
? `${heightCm} cm` const heightLabel = `${fmtCm(heightCm)} cm · ${heightPx} px`;
: `${heightCm.toFixed(1)} cm`;
noStroke(); noStroke();
fill(bounds.preview ? 140 : 160); fill(bounds.preview ? 140 : 160);
textFont('monospace', 12); textFont('monospace', 12);