2016-07-25 64 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

相關問題