Wood Height Calculator for Stimpmeter
Mark E.
Below will help you find the highest point of the wood or whatever material you are using to make your own Stimpmeter.
OR you can go here: https://www.calculatormall.com/wood-height-calculator-for-stimpmeter.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Wood Height Calculator</title>
</head>
<body>
<h2>Wood Height Calculator</h2>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
Enter the length of the wood (in inches): <input type="text" name="length">
<br><br>
Enter the angle (in degrees): <input type="text" name="angle">
<br><br>
<input type="submit" value="Calculate">
</form>
<?php
// Function to calculate the height of the highest point
function calculateHeight($angle, $length) {
// Convert angle from degrees to radians
$angleRad = deg2rad($angle);
// Calculate the height using trigonometry
$height = $length * sin($angleRad);
return $height;
}
// Check if form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Retrieve and sanitize user input
$length = isset($_POST['length']) ? floatval($_POST['length']) : 0;
$angle = isset($_POST['angle']) ? floatval($_POST['angle']) : 0;
// Calculate the height of the highest point
$height = calculateHeight($angle, $length);
// Display the result
echo "<p>At an angle of $angle degrees, the highest point of the wood (length: $length inches) would be approximately " . number_format($height, 2) . " inches.</p>";
// Generate a graph
$imageWidth = 400;
$imageHeight = 400;
$image = imagecreatetruecolor($imageWidth, $imageHeight);
$white = imagecolorallocate($image, 255, 255, 255); // White color
$black = imagecolorallocate($image, 0, 0, 0);
$blue = imagecolorallocate($image, 0, 0, 255);
// Fill the image with white background
imagefilledrectangle($image, 0, 0, $imageWidth, $imageHeight, $white);
// Draw angle indicator
$angleX = $imageWidth / 2;
$angleY = $imageHeight / 2;
$angleLength = min($imageWidth, $imageHeight) * 0.45; // 90% of the smaller dimension
$angleRadians = deg2rad($angle);
$angleEndX = $angleX + $angleLength * cos($angleRadians);
$angleEndY = $angleY - $angleLength * sin($angleRadians);
imageline($image, $angleX, $angleY, $angleEndX, $angleEndY, $blue);
imageline($image, $angleEndX, $angleEndY, $angleEndX - 5, $angleEndY + 10, $blue);
imageline($image, $angleEndX, $angleEndY, $angleEndX + 5, $angleEndY + 10, $blue);
// Draw line at the bottom of the graph
imageline($image, $angleX, $angleY, $angleEndX, $angleY, $black);
// Output the image
imagepng($image, "wood_angle_graph.png");
echo '<p><img src="/wood_angle_graph.png" alt="Wood Angle Graph"></p>';
// Free up memory
imagedestroy($image);
}
?>
</body>
</html>
Wood Height Calculator Output: