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

c# – 获取矩形和直线的交点,第1张

概述我需要获得矩形直线交点. 在矩形(矩形的中心)内有B点,在外面有A点.我需要在一个矩形边框上找到C点. 我也得到了矩形的宽度和高度. 所有这些都将是WPF应用程序,所以如果任何构建功能我将非常高兴. 这是基本的数学求解线 – 线交叉,检查 tutorial的topcoder: Line-Line Intersection One of the most common tasks you wil 我需要获得矩形和直线的交点.
在矩形(矩形的中心)内有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

总结

以上是内存溢出为你收集整理的c# – 获取矩形和直线的交点全部内容,希望文章能够帮你解决c# – 获取矩形和直线的交点所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1245697.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-07
下一篇 2022-06-07

发表评论

登录后才能评论

评论列表(0条)

保存