如何计算垂直线段的终点? [英] How to calculate end points of perpendicular line segments?

查看:185
本文介绍了如何计算垂直线段的终点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道一个线段与垂直端盖我想创建的距离/尺寸的终点,但我需要calcuate垂直线的终点。我一直在敲打我的头靠在墙上使用任何45-45-90三角形和圆点的产品,但我似乎无法让它走到一起。

I know the end points of a line segment and the distance/size of the perpendicular end caps I'd like to create but I need to calcuate the end points of the perpendicular line. I've been banging my head against the wall using either 45-45-90 triangles and dot products but I just can't seem to make it come together.

我知道蓝色和红色点之间的距离的点,我需要找到的点为红色。

I know the points in blue and the distance to the points in red, I need to find the points in red.

在标记为重复,我想张贴在<一个答案href="http://stackoverflow.com/questions/133897/how-do-you-find-a-point-a-given-perpendicular-distance-from-a-line">this问题但它导致端盖它总是垂直。

Before marking as duplicate, I tried the answer posted in this question but it resulted in end caps which were always vertical.

推荐答案

如果B1是2红点之间的蓝点,B2是其他蓝色点,则做到这一点的方法是:

If B1 is the blue point between the 2 red points, and B2 is the other blue point then the way to do this is:

  • 找到B1 - B2
  • 正常化这一载体
  • 然后按一半的红点之间的距离扩大这个载体了
  • 在旋转90度
  • 将此向量B1(这是R1)
  • 在减去此向量从B1(这是R2)

以上全部是相当简单 - !最棘手位将被搞清楚怎么写出来文本

All of the above is fairly straightforward - the trickiest bit would be figuring out how to write it out in text!

这可能是有益的,但​​ - 矩阵旋转90度:

This might be helpful though - matrix to rotate by 90 degrees:

[ 0  -1 ]
[ 1   0 ]

这篇关于如何计算垂直线段的终点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆