给定面积找到直角三角形的边界

Finding the boundary of a right angled triangle given the area

我试图找到点 p1, p2 作为假想线(黄色)在红色箭头的方向移动。点 p1, p2, p3, p4 将限定用户输入区域 A。我想要的是当黄线从右向左扫过时给定区域的 "first" 出现。

p3, p4Aangle 已知。

我最初尝试过类似(伪代码)的方法:

from right to left of the triangle:
    Move p1 to the left on the x-axis by epsilon
    Calculate p2 and the area bounded by (p1,p2,p3,p4)
    if(area < error): return the result
    else: continue

但是,此解可能不会收敛,因为 epsilon 值可能 "jumped" 结束。 (例如,如果我试图通过每次将数字 0 递增 0.3 来找到数字 4,它永远不会达到 4)。

因此,我尝试了二分查找法,但失败了,因为我意识到所界定的区域不是单调递增的(例如,绿线和三角形最左端所界定的区域也是二进制搜索返回的可能解决方案)。

我的问题是有算法可以解决这类问题吗?并且保证收敛?

让三角形的右边缘 (p3-p4) 的长度为 R

我们p1-p3距离是x。那么梯形面积为

A = 1/2 * x * (R + R - x * ctg(angle))
2*A = 2*x*R - x^2*ctg(angle)
x^2 * ctg(angle) - 2 * x * R + 2 * A = 0

求解未知x的二次方程,求是否存在真根(范围0..R*tg(angle)