{"id":2312,"date":"2025-02-13T09:34:55","date_gmt":"2025-02-13T09:34:55","guid":{"rendered":"https:\/\/donhit.com\/en\/?p=2312"},"modified":"2025-02-13T09:35:51","modified_gmt":"2025-02-13T09:35:51","slug":"roof-pitch","status":"publish","type":"post","link":"https:\/\/donhit.com\/en\/calculator\/roof-pitch\/","title":{"rendered":"Roof Pitch Calculator"},"content":{"rendered":"<p><center><div class=\"calculator123\">\r\n        <div class=\"header123\">\r\n            <h2>Roof Pitch Calculator<\/h2>\r\n            <p>Calculate your roof pitch by entering the rise and run measurements<\/p>\r\n        <\/div>\r\n\r\n        <div class=\"input-group\">\r\n            <label for=\"rise\">Rise (Vertical Height)<\/label>\r\n            <div class=\"input-field\">\r\n                <input type=\"number\" id=\"rise\" placeholder=\"Enter rise\" min=\"0\" step=\"0.1\">\r\n                <span class=\"unit\">inches<\/span>\r\n            <\/div>\r\n            <div class=\"error\" id=\"rise-error\">Please enter a valid rise value<\/div>\r\n        <\/div>\r\n\r\n        <div class=\"input-group\">\r\n            <label for=\"run\">Run (Horizontal Length)<\/label>\r\n            <div class=\"input-field\">\r\n                <input type=\"number\" id=\"run\" placeholder=\"Enter run\" min=\"0\" step=\"0.1\">\r\n                <span class=\"unit\">inches<\/span>\r\n            <\/div>\r\n            <div class=\"error\" id=\"run-error\">Please enter a valid run value<\/div>\r\n        <\/div>\r\n\r\n        <div class=\"roof-visual\">\r\n            <div class=\"roof-diagram\">\r\n                <div class=\"roof-line\" id=\"roof-line\"><\/div>\r\n                <div class=\"dimension-line\" id=\"rise-line\"><\/div>\r\n                <div class=\"dimension-label\" id=\"rise-label\"><\/div>\r\n                <div class=\"dimension-label\" id=\"run-label\"><\/div>\r\n            <\/div>\r\n        <\/div>\r\n\r\n        <button onclick=\"calculatePitch()\">Calculate Pitch<\/button>\r\n\r\n        <div class=\"results\">\r\n            <div class=\"result-item\">\r\n                <span class=\"result-label\">Pitch Ratio<\/span>\r\n                <span class=\"result-value\" id=\"pitch-ratio\">-<\/span>\r\n            <\/div>\r\n            <div class=\"result-item\">\r\n                <span class=\"result-label\">Angle (Degrees)<\/span>\r\n                <span class=\"result-value\" id=\"angle-degrees\">-<\/span>\r\n            <\/div>\r\n            <div class=\"result-item\">\r\n                <span class=\"result-label\">Slope Percentage<\/span>\r\n                <span class=\"result-value\" id=\"slope-percentage\">-<\/span>\r\n            <\/div>\r\n        <\/div>\r\n    <\/div>\r\n\r\n    <script>\r\n        function calculatePitch() {\r\n            \/\/ Get input values\r\n            const rise = parseFloat(document.getElementById('rise').value);\r\n            const run = parseFloat(document.getElementById('run').value);\r\n\r\n            \/\/ Reset errors\r\n            document.getElementById('rise-error').style.display = 'none';\r\n            document.getElementById('run-error').style.display = 'none';\r\n\r\n            \/\/ Validate inputs\r\n            if (isNaN(rise) || rise <= 0) {\r\n                document.getElementById('rise-error').style.display = 'block';\r\n                return;\r\n            }\r\n            if (isNaN(run) || run <= 0) {\r\n                document.getElementById('run-error').style.display = 'block';\r\n                return;\r\n            }\r\n\r\n            \/\/ Calculate pitch values\r\n            const ratio = rise \/ (run \/ 12); \/\/ Convert run to feet\r\n            const angle = Math.atan(rise \/ run) * (180 \/ Math.PI);\r\n            const slope = (rise \/ run) * 100;\r\n\r\n            \/\/ Update results\r\n            document.getElementById('pitch-ratio').textContent = `${ratio.toFixed(1)}\/12`;\r\n            document.getElementById('angle-degrees').textContent = `${angle.toFixed(1)}\u00b0`;\r\n            document.getElementById('slope-percentage').textContent = `${slope.toFixed(1)}%`;\r\n\r\n            \/\/ Update visual guide\r\n            updateRoofVisual(rise, run);\r\n        }\r\n\r\n        function updateRoofVisual(rise, run) {\r\n            const diagram = document.querySelector('.roof-diagram');\r\n            const roofLine = document.getElementById('roof-line');\r\n            const riseLine = document.getElementById('rise-line');\r\n            const riseLabel = document.getElementById('rise-label');\r\n            const runLabel = document.getElementById('run-label');\r\n\r\n            \/\/ Calculate visual dimensions\r\n            const maxDimension = Math.max(rise, run);\r\n            const scale = 150 \/ maxDimension; \/\/ Scale to fit within 150px\r\n            const visualRise = rise * scale;\r\n            const visualRun = run * scale;\r\n\r\n            \/\/ Update roof line\r\n            const length = Math.sqrt(visualRise * visualRise + visualRun * visualRun);\r\n            const angle = Math.atan2(visualRise, visualRun) * (180 \/ Math.PI);\r\n            \r\n            roofLine.style.width = `${length}px`;\r\n            roofLine.style.transform = `rotate(${angle}deg)`;\r\n\r\n            \/\/ Update dimension lines and labels\r\n            riseLine.style.height = `${visualRise}px`;\r\n            riseLine.style.left = `${visualRun}px`;\r\n            riseLine.style.bottom = '0';\r\n\r\n            riseLabel.textContent = `${rise}\"`;\r\n            riseLabel.style.left = `${visualRun + 10}px`;\r\n            riseLabel.style.bottom = `${visualRise \/ 2}px`;\r\n\r\n            runLabel.textContent = `${run}\"`;\r\n            runLabel.style.left = `${visualRun \/ 2}px`;\r\n            runLabel.style.bottom = '-20px';\r\n        }\r\n\r\n        \/\/ Add input event listeners for real-time updates\r\n        document.getElementById('rise').addEventListener('input', function() {\r\n            if (this.value && document.getElementById('run').value) {\r\n                calculatePitch();\r\n            }\r\n        });\r\n\r\n        document.getElementById('run').addEventListener('input', function() {\r\n            if (this.value && document.getElementById('rise').value) {\r\n                calculatePitch();\r\n            }\r\n        });\r\n    <\/script><\/center><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[184],"tags":[],"class_list":["post-2312","post","type-post","status-publish","format-standard","hentry","category-calculator"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Roof Pitch Calculator - DonHit<\/title>\n<meta name=\"description\" content=\"Easily calculate your roof pitch with our free Roof Pitch Calculator tool. Get instant slope measurements in degrees, ratios, and percentages. Try now!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/donhit.com\/en\/calculator\/roof-pitch\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Roof Pitch Calculator - DonHit\" \/>\n<meta property=\"og:description\" content=\"Easily calculate your roof pitch with our free Roof Pitch Calculator tool. Get instant slope measurements in degrees, ratios, and percentages. Try now!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/donhit.com\/en\/calculator\/roof-pitch\/\" \/>\n<meta property=\"og:site_name\" content=\"DonHit - World of Tools\" \/>\n<meta property=\"article:published_time\" content=\"2025-02-13T09:34:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-13T09:35:51+00:00\" \/>\n<meta name=\"author\" content=\"DonHit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DonHit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Roof Pitch Calculator - DonHit","description":"Easily calculate your roof pitch with our free Roof Pitch Calculator tool. Get instant slope measurements in degrees, ratios, and percentages. Try now!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/donhit.com\/en\/calculator\/roof-pitch\/","og_locale":"en_US","og_type":"article","og_title":"Roof Pitch Calculator - DonHit","og_description":"Easily calculate your roof pitch with our free Roof Pitch Calculator tool. Get instant slope measurements in degrees, ratios, and percentages. Try now!","og_url":"https:\/\/donhit.com\/en\/calculator\/roof-pitch\/","og_site_name":"DonHit - World of Tools","article_published_time":"2025-02-13T09:34:55+00:00","article_modified_time":"2025-02-13T09:35:51+00:00","author":"DonHit","twitter_card":"summary_large_image","twitter_misc":{"Written by":"DonHit","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/donhit.com\/en\/calculator\/roof-pitch\/#article","isPartOf":{"@id":"https:\/\/donhit.com\/en\/calculator\/roof-pitch\/"},"author":{"name":"DonHit","@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/0c6ff7dcd8ba4810c56a532f09c33148"},"headline":"Roof Pitch Calculator","datePublished":"2025-02-13T09:34:55+00:00","dateModified":"2025-02-13T09:35:51+00:00","mainEntityOfPage":{"@id":"https:\/\/donhit.com\/en\/calculator\/roof-pitch\/"},"wordCount":8,"commentCount":0,"publisher":{"@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/0c6ff7dcd8ba4810c56a532f09c33148"},"articleSection":["Calculator"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/donhit.com\/en\/calculator\/roof-pitch\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/donhit.com\/en\/calculator\/roof-pitch\/","url":"https:\/\/donhit.com\/en\/calculator\/roof-pitch\/","name":"Roof Pitch Calculator - DonHit","isPartOf":{"@id":"https:\/\/donhit.com\/en\/#website"},"datePublished":"2025-02-13T09:34:55+00:00","dateModified":"2025-02-13T09:35:51+00:00","description":"Easily calculate your roof pitch with our free Roof Pitch Calculator tool. Get instant slope measurements in degrees, ratios, and percentages. Try now!","breadcrumb":{"@id":"https:\/\/donhit.com\/en\/calculator\/roof-pitch\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/donhit.com\/en\/calculator\/roof-pitch\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/donhit.com\/en\/calculator\/roof-pitch\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Trang ch\u1ee7","item":"https:\/\/donhit.com\/en\/"},{"@type":"ListItem","position":2,"name":"Calculator","item":"https:\/\/donhit.com\/en\/category\/calculator\/"},{"@type":"ListItem","position":3,"name":"Roof Pitch Calculator"}]},{"@type":"WebSite","@id":"https:\/\/donhit.com\/en\/#website","url":"https:\/\/donhit.com\/en\/","name":"DonHit - World of tools","description":"","publisher":{"@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/0c6ff7dcd8ba4810c56a532f09c33148"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/donhit.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/0c6ff7dcd8ba4810c56a532f09c33148","name":"DonHit","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/donhit.com\/en\/wp-content\/uploads\/2024\/11\/logo-donhit.webp","contentUrl":"https:\/\/donhit.com\/en\/wp-content\/uploads\/2024\/11\/logo-donhit.webp","width":400,"height":267,"caption":"DonHit"},"logo":{"@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/image\/"},"description":"DonHit is a website designed to provide useful tools for everyone. Its primary goal is to support and empower the community. All the tools available on the site are completely free to use.","sameAs":["https:\/\/donhit.com\/en"],"url":"https:\/\/donhit.com\/en\/author\/admin_don\/"}]}},"_links":{"self":[{"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts\/2312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/comments?post=2312"}],"version-history":[{"count":2,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts\/2312\/revisions"}],"predecessor-version":[{"id":2314,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts\/2312\/revisions\/2314"}],"wp:attachment":[{"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/media?parent=2312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/categories?post=2312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/tags?post=2312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}