2016-07-25 68 views
0

我正在试着做一个正确旋转的等腰三角形。我有以下数据:如何查找给定顶点,底点中点和底宽的等腰三角形的所有点?

  • 顶点点的(x, y)坐标,
  • 基部的中点的(x, y)坐标,一个
  • 的基部的宽度,a

而且我需要找到coordina另外两点的测试,BC只有上述信息才能找到最后两点的算法是什么?搜索谷歌刚刚给了我很多方程,假设它直接指向上,但我需要这些被放置之前进行转换。

An isosceles triangle rotated so that the vertex (labeled with a blue capital A) is in the lower-left and the base (labeled with a red lower-case a) is on the upper-right. The base is bisected by its midpoint (labeled by a green a with a subscript m). The other two points are labeled with a purple capital B and an orange capital C, respectively.

+2

我投票关闭这一问题作为题外话,因为它是关于数学。 –

+0

@HighPerformanceMark请让我知道在计算伪码代码时遇到困难,并且在数学上遇到困难,因此我知道在哪里提出未来的问题。另外,我的问题与其他25k ['math'](http://stackoverflow.com/questions/tagged/math)问题的区别。 –

回答

1

要找到BC

  1. 找到归一化的方向向量a_mA = (A - a_m)/|A - a_m|
  2. 找到一个向量垂直的向量a_mA - 姑且称之为a_mA'
    • a_mA' = (-a_mA.y, a_mA.x)
  3. 找到B,步骤width/2单位的a_mA'方向和添加a_m
    • B = (width/2)*a_mA' + a_m
  4. 找到C,步骤-width/2单位的a_mA'方向和添加a_m
    • C = (-width/2)*a_mA' + a_m

的jsfiddle例如:https://jsfiddle.net/asq7h2jd/

+0

为什么downvote?答案提供了一个具体算法和一个示例实现。 – sarasvati

+0

美丽,像魅力一样工作!不知道为什么downvote,但我的上涨抵消它:) –

+0

@ BenLeggiero谢谢:)我很高兴我可以帮助。如果你喜欢这个答案,请考虑接受它。 – sarasvati

相关问题