与 PathGeometry 上的一点相切
pathGeometry.GetPointAtFractionLength(进度,出点、出切线);
GetPointAtFractionLength 给出路径几何上的一个点以及该点的切线(如果给出了分数长度)。
我已经明白了这一点,但我没有(派系长度)进展。有没有一种方法可以在路径几何上的给定点处获取路径几何的切线?
pathGeometry.GetPointAtFractionLength(progress, out point, out tangent);
GetPointAtFractionLength gives a point on the pathgeometry and a tangent at that point if factional length is given.
I have the point already but I don't have the (factional length)progress. Is there a method just to get the tangent to the pathgeometry at a given point on the pathgeometry?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看看这个问题: 获取 PathGeometry 的长度(行)在 C#/WPF
这个问题及其答案展示了一种通过展平曲线来计算点的方法。
Have a look at this question: Getting length of a PathGeometry (lines) in C#/WPF
This question and its answers show a way to calculate the point by flattening the curve.
您可以使用二分法(有关二分的维基百科文章)来查找输出点处的分数最接近给定点,然后使用该值的出切线。根据曲线的形状,您可能会遇到可能导致问题的局部最小值,因此您可能需要从线性搜索开始,直到接近,然后使用二分法找到准确的答案。
You could use the Bisection method (Wikipedia article on Bisection) to find the fraction at which the output point is closest to your given point and then use the out tangent at that value. Depending upon the shape of your curve you could have local minima that could cause problems, so you may want to start with a linear search until you get close, and then use Bisection to find an accurate answer.