Set book page bounds and physical cover width
This commit is contained in:
@@ -70,11 +70,12 @@ const FAST_FLIP_COUNT = 10;
|
||||
const FAST_FLIP_OVERLAP = 5;
|
||||
const OPEN_SEAM_GAP = 0.003;
|
||||
const PAGE_COUNT_MIN = 40;
|
||||
const PAGE_COUNT_MAX = 500;
|
||||
const PAGE_COUNT_STEP = 10;
|
||||
const PAGE_WIDTH = 1.62;
|
||||
const PAGE_SPLINE_LENGTH = 1.955;
|
||||
const PAGE_LINE_SEGMENTS = 48;
|
||||
const PAGE_DEPTH = 2.24;
|
||||
const PAGE_WIDTH = PAGE_DEPTH * 2 / 3;
|
||||
const PAGE_SPLINE_LENGTH = PAGE_WIDTH;
|
||||
const COVER_DEPTH = 2.30;
|
||||
const COVER_OVERHANG = (COVER_DEPTH - PAGE_DEPTH) * 0.5;
|
||||
const COVER_SUPPORT_OVERHANG = COVER_OVERHANG;
|
||||
@@ -259,7 +260,7 @@ function rebuildBook() {
|
||||
activeSpineHalf = spineHalf;
|
||||
activeCoverOuterX = spineHalf + pageWidth + COVER_OVERHANG;
|
||||
const lines = simulatePageLines(bundleCount, pageWidth, pageSplineLength, spineWidth, foreEdgeX, bundleSpacing, leftCount);
|
||||
const coverOuterX = solvedStackOuterX(lines) + COVER_OVERHANG;
|
||||
const coverOuterX = spineHalf + pageWidth + COVER_OVERHANG;
|
||||
activeCoverOuterX = coverOuterX;
|
||||
lastLengthError = measureLineLengthError(lines, pageSplineLength);
|
||||
lastSpacingError = measureStackSpacingError(lines, bundleSpacing);
|
||||
@@ -427,25 +428,7 @@ function calculateSpineWidth(bundleCount) {
|
||||
}
|
||||
|
||||
function calculateMaximumPageCount() {
|
||||
let maximum = PAGE_COUNT_MIN;
|
||||
for (let candidate = PAGE_COUNT_MIN; candidate <= 1000; candidate += PAGE_COUNT_STEP) {
|
||||
const bundleCount = Math.max(4, Math.round(candidate / 10));
|
||||
if (!isBundleCountReachable(bundleCount)) break;
|
||||
maximum = candidate;
|
||||
}
|
||||
return maximum;
|
||||
}
|
||||
|
||||
function isBundleCountReachable(bundleCount) {
|
||||
const spineWidth = calculateSpineWidth(bundleCount);
|
||||
const bundleSpacing = calculateBundleSpacing(bundleCount, spineWidth, bundleCount);
|
||||
const foreEdgeX = spineWidth * 0.5 + PAGE_WIDTH;
|
||||
const target = restingTarget(1, foreEdgeX, bundleCount - 1, bundleCount, bundleSpacing);
|
||||
const anchor = spineCurvePoint(1, spineWidth);
|
||||
const chordLength = Math.hypot(target.x - anchor.x, target.y - anchor.y);
|
||||
const solverSlack = PAGE_SPLINE_LENGTH - chordLength;
|
||||
const minimumSlack = PAGE_SPLINE_LENGTH / (PAGE_LINE_SEGMENTS + 1);
|
||||
return solverSlack >= minimumSlack;
|
||||
return PAGE_COUNT_MAX;
|
||||
}
|
||||
|
||||
function calculateBundleSpacing(bundleCount, spineWidth, leftCount) {
|
||||
|
||||
@@ -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=flip-arclength-width-1"></script>
|
||||
<script type="module" src="/js/webgl-book-shape-lab.js?v=page-ratio-cover-width-1"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user