<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[ProjectCalcs Engineering]]></title><description><![CDATA[ProjectCalcs Engineering]]></description><link>https://projectcalcs.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Dec 2026 23:41:34 GMT</lastBuildDate><atom:link href="https://projectcalcs.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Modeling Pitch Factors, Bag Yields, and Geometry Shapes in Client-Side TypeScript Estimators]]></title><description><![CDATA[Engineering patterns from building 76 zero-backend Nuxt 4 & TypeScript construction calculators: roof pitch factors, slab geometry, and bag yields.]]></description><link>https://projectcalcs.hashnode.dev/modeling-pitch-factors-bag-yields-and-geometry-shapes-in-client-side-typescript-estimators</link><guid isPermaLink="true">https://projectcalcs.hashnode.dev/modeling-pitch-factors-bag-yields-and-geometry-shapes-in-client-side-typescript-estimators</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Nuxt]]></category><category><![CDATA[webdev]]></category><dc:creator><![CDATA[Fei Peng]]></dc:creator><pubDate>Sat, 14 Nov 2026 09:29:36 GMT</pubDate><content:encoded><![CDATA[<p>Homeowners rarely start a material estimate with square footage already written down—they start with a circular patio diameter, a sloped gable roof footprint, or bags of concrete stacked at a hardware store.</p>
<p>When building <a href="https://projectcalcs.com/">ProjectCalcs</a>—a collection of 76 client-side, statically prerendered Nuxt 4 &amp; TypeScript calculators running without a backend API—each material trade introduced its own physical and geometric edge cases. Here are three patterns we rely on across our concrete slab and roofing estimators.</p>
<h2>1. Apply Pitch Multipliers Before Surface Rounding</h2>
<p>Roof measurements come from horizontal ground-plane footprints (<code>length × width</code>), yet shingles cover a sloped plane whose surface grows by <code>sqrt(1 + (rise/12)^2)</code>.</p>
<p>In our <a href="https://projectcalcs.com/calculators/roofing/">Roofing Calculator</a>, each standard slope carries a typed pitch factor in <code>pitchOptions</code> (for example, <code>1.054</code> at <code>4/12</code> and <code>1.118</code> at <code>6/12</code>), keeping horizontal footprint math separate from sloped square footage and discrete bundle counts:</p>
<pre><code class="language-typescript">const footprintAreaSqFt = lengthFt * widthFt;

// Actual roof surface area before 100 sq ft "square" conversion
const roofAreaSqFt = Math.round(footprintAreaSqFt * pitch.factor * 100) / 100;

const roofSquares = Math.round((roofAreaSqFt / 100) * 100) / 100;
const roofSquaresWithWaste =
  Math.round(roofSquares * (1 + input.wastePercentage / 100) * 100) / 100;
const roofSquaresRoundedUp = Math.ceil(roofSquaresWithWaste);

// Shingles sell in bundles per square, whereas metal roofs sell by panel/square
const bundlesNeeded =
  shingle.value === "metal"
    ? 0
    : Math.ceil(roofSquaresRoundedUp * shingle.bundlesPerSquare);
</code></pre>
<p>Branching <code>bundlesNeeded</code> by product format avoids quoting bundle counts for standing-seam metal roofs while rounding shingle and underlayment orders up cleanly.</p>
<h2>2. Support Mixed Shapes Without Branching Volume Formulas</h2>
<p>Construction projects aren't always rectangles. Circular fire-pit pads and triangular corner slabs still pour to a uniform depth. Instead of duplicating cubic-yard (<code>volumeCuFt / 27</code>) and weight (<code>150 lb/cu ft</code>) math per shape, our <a href="https://projectcalcs.com/calculators/concrete/">Concrete Calculator</a> normalizes every dimension to feet, resolves <code>areaSqFt</code> per geometry branch, and feeds a single volume pipeline:</p>
<pre><code class="language-typescript">const thicknessFt = toFeet(thickness, thicknessUnit);
if (thicknessFt &lt;= 0) return null;

let areaSqFt = 0;
if (shape === "rectangle") {
  areaSqFt = toFeet(length, lengthUnit) * toFeet(width, widthUnit);
} else if (shape === "circle") {
  const radiusFt = toFeet(diameter, diameterUnit) / 2;
  areaSqFt = Math.PI * radiusFt * radiusFt;
} else if (shape === "triangle") {
  areaSqFt = (toFeet(base, baseUnit) * toFeet(height, heightUnit)) / 2;
}

const volumeCuFt = areaSqFt * thicknessFt;
const volumeCuYd = volumeCuFt / 27;
</code></pre>
<h2>3. Bind Bag Yields Directly to Typed Product Specs</h2>
<p>Ready-mix concrete arrives by the cubic yard, while bagged concrete comes in 40 lb (<code>0.30 cu ft</code>), 50 lb (<code>0.375 cu ft</code>), 60 lb (<code>0.45 cu ft</code>), and 80 lb (<code>0.60 cu ft</code>) yields. Modeling <code>bagSizeOptions</code> as typed records with explicit <code>yieldCuFt</code> values lets the same reactive pipeline estimate both ready-mix yards and ceiling-rounded bag counts (<code>Math.ceil(volumeCuFt / bagYield)</code>) purely in the browser.</p>
<p>Because every calculation stays pure inside TypeScript composables, all 255 routes compile down to static assets on Cloudflare Pages without runtime server compute.</p>
<p>What edge cases have tripped you up when modeling physical material yields or mixed unit inputs in TypeScript?</p>
]]></content:encoded></item></channel></rss>