Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Easy with Bretschneider solution in Clear category for Strawberry Fields by martin_b
from math import degrees, acos
# the area of quadrilateral can be computed using Bretschneider formula
# https://en.wikipedia.org/wiki/Bretschneider%27s_formula
# from this formula, area is maximized, when cos2((α+γ)/2) is minimized,
# (α and γ are angles of the opposite corners)
# cos2((α+γ)/2) is minimized when α+γ=π, as cos(π/2) = 0
# also, the triangles with sides ad and bc share common side x
# x = a2 + d2 − 2ad cos(α) = b2 + c2 - 2bc cos(γ)
# when reordered and substituted γ=π-α and cos(π-α)=-cos(α), we get
# cos(α) = (a2 + d2 - b2 - c2) / (2(ad+bc))
def strawberryfield(a, b, c, d):
return round(degrees(acos((a * a + d * d - c * c - b * b) / (2 * (a * d + b * c)))), 1)
April 20, 2018
Comments: