Pottery Sherd Curvature to Vessel Capacity Estimator

Estimate the original vessel's radius, diameter, and a speculative capacity based on a pottery sherd's curvature.

Important Disclaimers:
  • The radius/diameter calculation is an **approximation**, as pottery is rarely perfectly round.
  • **Capacity estimation is highly speculative** and depends heavily on your assumed vessel shape. A single sherd provides very limited information about the overall vessel form (e.g., its full height, whether it's a jar, bowl, or bottle).
  • This tool is for **illustrative purposes only** and not for precise archaeological or scientific analysis.

*Note: 1 ml = 1 cm³. Capacity is an approximation based on the chosen shape model.

`; downloadButton.style.display = 'inline-block'; // Store data for PDF report resultArea.dataset.chordLength = L_raw; resultArea.dataset.sagitta = M_raw; resultArea.dataset.lengthUnit = lengthUnit; resultArea.dataset.sagittaUnit = sagittaUnit; resultArea.dataset.vesselShape = vesselShape; resultArea.dataset.customHeight = customHeightInput.value; // Store raw input for custom height resultArea.dataset.radiusCm = R_cm.toFixed(4); resultArea.dataset.diameterCm = D_cm.toFixed(4); resultArea.dataset.estimatedCapacityMl = estimatedCapacityMl.toFixed(4); resultArea.dataset.capacityAssumption = capacityAssumptionText; } /** * Generates a PDF report of the pottery sherd curvature analysis. */ function generatePdfReport() { try { // Check if jsPDF library is loaded if (typeof window.jspdf === 'undefined' || typeof window.jspdf.jsPDF === 'undefined') { console.error('jsPDF library not loaded. Cannot generate PDF.'); showMessage('PDF generation failed: jspdf library not loaded. Please try again or check your internet connection.', 'error'); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); const resultArea = document.getElementById('resultArea'); // Retrieve stored data const chordLength = resultArea.dataset.chordLength || 'N/A'; const sagitta = resultArea.dataset.sagitta || 'N/A'; const lengthUnit = resultArea.dataset.lengthUnit || 'N/A'; const sagittaUnit = resultArea.dataset.sagittaUnit || 'N/A'; const vesselShapeKey = resultArea.dataset.vesselShape || 'N/A'; const customHeight = resultArea.dataset.customHeight || 'N/A'; const radiusCm = resultArea.dataset.radiusCm || 'N/A'; const diameterCm = resultArea.dataset.diameterCm || 'N/A'; const estimatedCapacityMl = resultArea.dataset.estimatedCapacityMl || 'N/A'; const capacityAssumption = resultArea.dataset.capacityAssumption || 'N/A'; const generationDate = new Date().toLocaleString(); if (radiusCm === 'N/A') { showMessage('No calculation data available to generate a PDF. Please perform a calculation first.', 'info'); return; } let yOffset = 20; // Title doc.setFontSize(22); doc.setTextColor(44, 62, 80); doc.text("Pottery Sherd Curvature Analysis Report", 105, yOffset, { align: 'center' }); yOffset += 15; // Date Generated doc.setFontSize(10); doc.setTextColor(100, 100, 100); doc.text(`Report Generated: ${generationDate}`, 105, yOffset, { align: 'center' }); yOffset += 20; // Disclaimer doc.setFontSize(9); doc.setTextColor(150, 150, 150); const disclaimerText = "Disclaimer: This report is based on a simplified model for illustrative purposes. Calculations for radius/diameter are approximations. Capacity estimations are highly speculative and depend heavily on assumed vessel shapes. This tool is NOT for precise archaeological or scientific analysis."; const splitDisclaimer = doc.splitTextToSize(disclaimerText, 170); doc.text(splitDisclaimer, 20, yOffset); yOffset += (splitDisclaimer.length * 5) + 15; // Input Parameters doc.setFontSize(14); doc.setTextColor(51, 51, 51); doc.text("Input Measurements:", 20, yOffset); yOffset += 10; doc.setFontSize(12); doc.text(`- Chord Length (L): ${chordLength} ${lengthUnit}`, 25, yOffset); yOffset += 7; doc.text(`- Sagitta (M): ${sagitta} ${sagittaUnit}`, 25, yOffset); yOffset += 7; doc.text(`- Assumed Vessel Shape: ${document.getElementById('vesselShape').options[document.getElementById('vesselShape').selectedIndex].text}`, 25, yOffset); yOffset += 7; if (vesselShapeKey === 'cylindrical-custom') { doc.text(`- Custom Height Input: ${customHeight} ${lengthUnit}`, 25, yOffset); yOffset += 7; } yOffset += 15; // Calculated Properties doc.setFontSize(16); doc.setTextColor(46, 204, 113); /* Green */ doc.text("Calculated Properties:", 20, yOffset); yOffset += 10; doc.setFontSize(14); doc.text(`Original Vessel Radius: ${parseFloat(radiusCm).toFixed(2)} cm`, 25, yOffset); yOffset += 10; doc.text(`Original Vessel Diameter: ${parseFloat(diameterCm).toFixed(2)} cm`, 25, yOffset); yOffset += 15; doc.setFontSize(16); doc.text(`Estimated Vessel Capacity: ${parseFloat(estimatedCapacityMl).toFixed(2)} ml (or cm³)`, 20, yOffset); yOffset += 10; doc.setFontSize(10); doc.setTextColor(80, 80, 80); const assumptionLines = doc.splitTextToSize(`Assumption for capacity: ${capacityAssumption}`, 25, 170); doc.text(assumptionLines, 25, yOffset); yOffset += (assumptionLines.length * 6) + 15; // Formula Used doc.setFontSize(12); doc.setTextColor(80, 80, 80); doc.text("Formulas Used:", 20, yOffset); yOffset += 7; doc.setFont('courier'); // Monospace font for formulas doc.text(`Radius (R): R = (L² / 8M) + (M / 2)`, 25, yOffset); yOffset += 7; doc.text(`Diameter (D): D = 2 * R`, 25, yOffset); yOffset += 7; if (vesselShapeKey === 'hemispherical') { doc.text(`Hemisphere Volume: (2/3) * π * R³`, 25, yOffset); } else if (vesselShapeKey.startsWith('cylindrical')) { doc.text(`Cylinder Volume: π * R² * H`, 25, yOffset); } doc.setFont('helvetica'); // Reset font yOffset += 15; // Footer doc.setFontSize(9); doc.setTextColor(150, 150, 150); doc.text(`Report Generated by Pottery Sherd Curvature to Vessel Capacity Estimator`, 20, doc.internal.pageSize.height - 15); doc.text("Page 1", doc.internal.pageSize.width - 20, doc.internal.pageSize.height - 15, { align: 'right' }); // Basic page number doc.save("Pottery_Sherd_Capacity_Report.pdf"); } catch (error) { console.error('Error generating PDF:', error); showMessage(`PDF generation failed: ${error.message}. Please check your browser's console for more details.`, 'error'); } }
Scroll to Top