【问题标题】:Get vertex value that shapes 90 degrees with triangle centroid获取具有三角形质心的 90 度形状的顶点值
【发布时间】:2019-11-18 22:36:11
【问题描述】:

我有这个三角形:

我正在尝试在绿色圆圈中突出显示顶点值,以便绘制那条红线。有什么方程式可以用来提取该值吗?

The centroid vertex G = (x=5.5, y=1.5)
The other vertex B = (x=0, y=1)
and the last vertex C = (x=7, y=0)

任何帮助将不胜感激。我知道这可能是五年级的数学,但我想不出办法来计算这一点。

【问题讨论】:

    标签: math height vertex centroid


    【解决方案1】:

    如果你扔掉三角形的大部分,只保留向量 B->G 和向量 B->C,那么这个问题本身就是一个“向量投影”问题。 这些是使用 2 个向量的点积进行解析求解的,并且在其他地方都有详细记录。

    【讨论】:

      【解决方案2】:

      花了我 2 天的时间来解决这个问题,你基本上需要得到基向量和高度向量(质心)的斜率,然后求解这个方程:y = m * x + b 两个向量(基+高度)。然后你会得到 2 个不同的方程,你需要先使用替换来获得 x,然后将该值应用于第二个方程以获得 y。有关更多信息,请观看此 youtube 教程: https://www.youtube.com/watch?v=VuEbWkF5lcM

      如果有人感兴趣,这里是 PHP(伪)的解决方案:

          //slope of base
          $m1 = getSlope(baseVector);
      
          //slope of altitude (invert and divide it by 1)
          $m2 = 1/-$m1;
      
          //points
          $x1 = $baseVector->x;
          $y1 = $baseVector->y;
      
          //Centroid vertex
          $x2 = $center['x'];
          $y2 = $center['y'];
      
          //altitude equation: y = m * x + b
          //eq1: y1 = (m1 * x1) + b1 then find b1
          $b1 = -($m1 * $x1) + $y1;
          //equation: y = ($m1 * x) + $b1
      
          //eq2: y2 = (m2 * x2) + b2 then find b2
          $b2 = -($m2 * $x2) + $y2;
          //equation: y = ($m2 * x) + $b2;
      
          //substitute eq1 into eq2 and find x
          //merge the equations (move the Xs to the left side and numbers on the right side)
          $Xs = $m1 - $m2; //left side (number of Xs)
          $Bs = $b2 - $b1; //right side
          $x = $Bs / $Xs; //get x number
          $y = ($m2 * $x) + $b2; //get y number
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-06-19
        • 2021-03-11
        • 2010-12-03
        • 2014-03-13
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多