Checkpoint restored book coordinate frame

This commit is contained in:
2026-06-05 14:04:17 +02:00
parent ecc4413014
commit 9f659f8f63
2 changed files with 11 additions and 6 deletions
+10 -5
View File
@@ -214,10 +214,11 @@ function rebuildBook() {
const bundleCount = Math.max(4, Math.round(pageCount / 10));
const spineWidth = calculateSpineWidth(bundleCount);
const leftCount = calculateLeftBundleCount(bundleCount);
const hingeX = spineWidth * 0.5 + HINGE_INSET;
const foreEdgeX = spineWidth * 0.5 + pageWidth;
const spineHalf = spineArcHalf(spineWidth);
const hingeX = spineHalf + HINGE_INSET;
const foreEdgeX = spineHalf + pageWidth;
const bundleSpacing = calculateBundleSpacing(bundleCount, spineWidth, leftCount);
activeSpineHalf = spineWidth * 0.5;
activeSpineHalf = spineHalf;
const lines = simulatePageLines(bundleCount, pageWidth, pageSplineLength, spineWidth, foreEdgeX, bundleSpacing, leftCount);
lastLengthError = measureLineLengthError(lines, pageSplineLength);
lastSpacingError = measureStackSpacingError(lines, bundleSpacing);
@@ -245,7 +246,7 @@ function addCoverAssembly(pageWidth, depth, thickness, spineWidth) {
}
function createCoverAssemblyGeometry(pageWidth, depth, thickness, spineWidth) {
const spineHalf = spineWidth * 0.5;
const spineHalf = spineArcHalf(spineWidth);
const hingeX = spineHalf + HINGE_INSET;
const outerX = spineHalf + pageWidth + COVER_OVERHANG;
const outerTopY = BOOK_PROFILE.tableY + thickness;
@@ -339,7 +340,7 @@ function createClothSpineGeometry(depth, spineWidth) {
}
function spineCurvePoint(t, spineWidth) {
const radiusX = spineWidth * 0.42;
const radiusX = spineArcHalf(spineWidth);
const radiusY = 0.018;
const baseY = BOOK_PROFILE.tableY + BOOK_PROFILE.coverThickness + 0.002;
const theta = Math.PI * (1 - THREE.MathUtils.clamp(t, 0, 1));
@@ -350,6 +351,10 @@ function spineCurvePoint(t, spineWidth) {
};
}
function spineArcHalf(spineWidth) {
return spineWidth * 0.42;
}
function calculateSpineWidth(bundleCount) {
const minimumWidth = 0.16;
if (bundleCount <= 1) return minimumWidth;
+1 -1
View File
@@ -74,6 +74,6 @@
<button id="fast_forward" type="button">Fast Forward</button>
<output id="flip_count">0 / 10</output>
</div>
<script type="module" src="/js/webgl-book-shape-lab.js?v=spline-length-foreedge-1"></script>
<script type="module" src="/js/webgl-book-shape-lab.js?v=task1-restored-1"></script>
</body>
</html>