Checkpoint restored book coordinate frame
This commit is contained in:
@@ -214,10 +214,11 @@ function rebuildBook() {
|
|||||||
const bundleCount = Math.max(4, Math.round(pageCount / 10));
|
const bundleCount = Math.max(4, Math.round(pageCount / 10));
|
||||||
const spineWidth = calculateSpineWidth(bundleCount);
|
const spineWidth = calculateSpineWidth(bundleCount);
|
||||||
const leftCount = calculateLeftBundleCount(bundleCount);
|
const leftCount = calculateLeftBundleCount(bundleCount);
|
||||||
const hingeX = spineWidth * 0.5 + HINGE_INSET;
|
const spineHalf = spineArcHalf(spineWidth);
|
||||||
const foreEdgeX = spineWidth * 0.5 + pageWidth;
|
const hingeX = spineHalf + HINGE_INSET;
|
||||||
|
const foreEdgeX = spineHalf + pageWidth;
|
||||||
const bundleSpacing = calculateBundleSpacing(bundleCount, spineWidth, leftCount);
|
const bundleSpacing = calculateBundleSpacing(bundleCount, spineWidth, leftCount);
|
||||||
activeSpineHalf = spineWidth * 0.5;
|
activeSpineHalf = spineHalf;
|
||||||
const lines = simulatePageLines(bundleCount, pageWidth, pageSplineLength, spineWidth, foreEdgeX, bundleSpacing, leftCount);
|
const lines = simulatePageLines(bundleCount, pageWidth, pageSplineLength, spineWidth, foreEdgeX, bundleSpacing, leftCount);
|
||||||
lastLengthError = measureLineLengthError(lines, pageSplineLength);
|
lastLengthError = measureLineLengthError(lines, pageSplineLength);
|
||||||
lastSpacingError = measureStackSpacingError(lines, bundleSpacing);
|
lastSpacingError = measureStackSpacingError(lines, bundleSpacing);
|
||||||
@@ -245,7 +246,7 @@ function addCoverAssembly(pageWidth, depth, thickness, spineWidth) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createCoverAssemblyGeometry(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 hingeX = spineHalf + HINGE_INSET;
|
||||||
const outerX = spineHalf + pageWidth + COVER_OVERHANG;
|
const outerX = spineHalf + pageWidth + COVER_OVERHANG;
|
||||||
const outerTopY = BOOK_PROFILE.tableY + thickness;
|
const outerTopY = BOOK_PROFILE.tableY + thickness;
|
||||||
@@ -339,7 +340,7 @@ function createClothSpineGeometry(depth, spineWidth) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function spineCurvePoint(t, spineWidth) {
|
function spineCurvePoint(t, spineWidth) {
|
||||||
const radiusX = spineWidth * 0.42;
|
const radiusX = spineArcHalf(spineWidth);
|
||||||
const radiusY = 0.018;
|
const radiusY = 0.018;
|
||||||
const baseY = BOOK_PROFILE.tableY + BOOK_PROFILE.coverThickness + 0.002;
|
const baseY = BOOK_PROFILE.tableY + BOOK_PROFILE.coverThickness + 0.002;
|
||||||
const theta = Math.PI * (1 - THREE.MathUtils.clamp(t, 0, 1));
|
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) {
|
function calculateSpineWidth(bundleCount) {
|
||||||
const minimumWidth = 0.16;
|
const minimumWidth = 0.16;
|
||||||
if (bundleCount <= 1) return minimumWidth;
|
if (bundleCount <= 1) return minimumWidth;
|
||||||
|
|||||||
@@ -74,6 +74,6 @@
|
|||||||
<button id="fast_forward" type="button">Fast Forward</button>
|
<button id="fast_forward" type="button">Fast Forward</button>
|
||||||
<output id="flip_count">0 / 10</output>
|
<output id="flip_count">0 / 10</output>
|
||||||
</div>
|
</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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user