Created
April 9, 2024 05:39
-
-
Save mcneds/0390a935d7f3cadd3e25d36d57b56a8b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
#example values | |
R=60 | |
Tw=R/2 | |
W=30 | |
L=45 | |
θ=math.pi/4 | |
r1 = (math.sqrt(((Tw - W / 2) ** 2) + ((R + L/2) ** 2))) | |
r2 = (math.sqrt(((((Tw - W / 2) ** 2) + (R - L/2) ** 2)))) | |
r3 = (math.sqrt((R + L/2) ** 2 + (Tw + W/2) ** 2)) | |
r4 = (math.sqrt(((R - L / 2) ** 2) + ((Tw + W / 2) ** 2))) | |
θr1 = (math.atan((Tw - W / 2)/(L/2 + R))) | |
θr2 = (math.atan((Tw - W/2)/(R - L / 2))) | |
θr4 = (math.atan((Tw + W / 2)/(R - L / 2))) | |
θT3 = θr2 - θr1 | |
HT3 = r2 * math.sin(θT3) | |
HT4 = L * math.sin(θr4) | |
HT5 = math.sqrt((W ** 2) - ((r4-r2)**2)) | |
Turnangle = θ - θr1 + θr4 | |
overall = ((Turnangle)/2) * r3 ** 2 | |
print(f"overall {overall}") | |
T1and2 = ((r3-r1) * (W)) | |
print(f"T1and2: {T1and2}") | |
T3 = ((r1-r2) * HT3) / 2 | |
print(f"T3: {T3}") | |
T4 = ((r3-r4)*HT4)/2 | |
print(f"T4: {T4}") | |
T5 = ((r4-r2)*HT5)/2 | |
print(f"T5: {T5}") | |
Innercircle = (Turnangle/2) * r2 ** 2 | |
print(f"innercircle {Innercircle}") | |
areashaded = overall - T1and2 - T3 - T4 - T5 - Innercircle | |
print(f"shaded area: {areashaded}") | |
#result is 4026.4 square units, 3.7% off of a result obtained with CAD. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment