加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 获取矩形和直线的交点

发布时间:2020-12-15 08:00:47 所属栏目:百科 来源:网络整理
导读:我需要获得矩形和直线的交点. 在矩形(矩形的中心)内有B点,在外面有A点.我需要在一个矩形边框上找到C点. 我也得到了矩形的宽度和高度. 所有这些都将是WPF应用程序,所以如果任何构建功能我将非常高兴. 解决方法 这是基本的数学求解线 – 线交叉,检查 tutorial
我需要获得矩形和直线的交点.
在矩形(矩形的中心)内有B点,在外面有A点.我需要在一个矩形边框上找到C点.
我也得到了矩形的宽度和高度.

所有这些都将是WPF应用程序,所以如果任何构建功能我将非常高兴.

解决方法

这是基本的数学求解线 – 线交叉,检查 tutorial的topcoder:

Line-Line Intersection One of the most common tasks you will find in geometry problems is line intersection. Despite the fact that it is so common,a lot of coders still have trouble with it. The first question is,what form are we given our lines in,and what form would we like them in? Ideally,each of our lines will be in the form Ax+By=C,where A,B and C are the numbers which define the line. However,we are rarely given lines in this format,but we can easily generate such an equation from two points. Say we are given two different points,(x1,y1) and (x2,y2),and want to find A,B and C for the equation above. We can do so by setting A = y2-y1 B = x1-x2 C = A*x1+B*y1

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读