WPF C#查找变换后的RectangleGeometry的角 [英] WPF C# Finding the corners of a transformed RectangleGeometry

查看:262
本文介绍了WPF C#查找变换后的RectangleGeometry的角的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对将多个RenderTransforms推送到Canvas的DrawingContext中绘制的Rect进行命中测试。我对RectangleGeometry应用了相同的旋转/缩放/平移变换,以便获得最终图形的边界。但是,RectangleGeometry的.Bounds属性返回轴对齐的边界框,而我需要定向的边界框。

I'm trying to do some hit testing on a Rect I've drawn with several RenderTransforms pushed to the Canvas' DrawingContext. I've applied the same rotate/scale/translate transforms to a RectangleGeometry so I can get the bounds of the final drawing. However, the .Bounds property on RectangleGeometry returns the axis-aligned bounding box, while I need the oriented bounding box.

总之,我需要一些方法来找到角

In short, I need some way to find the corners of the actual transformed rectangle so I can perform hit/collision testing on it.

推荐答案

将变换应用于矩形的点

这篇关于WPF C#查找变换后的RectangleGeometry的角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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