查找具有角度的边界矩形的尺寸 [英] Find dimensions of bounding rectangle having angle

查看:47
本文介绍了查找具有角度的边界矩形的尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要找到矩形的边界尺寸与角度.在画布上绘制的成角度的矩形.我只是内在的高度和宽度 倾斜的矩形,在画布上绘制时其左上角.我需要根据此信息本身进行计算.有了这么多的参数,我无法弄清楚得出尺寸的逻辑.

I need to find the bounding dimensions of a rectangle with angle. The angled rectangle in drawn on canvas. I just have the height and width of the inner angled rectangle and the left top of it when drawn on a canvas. I need to calculate based on this info itself. With this much parameters I am not able to figure out a logic to derive the dimensions.


Sumit Datta

Sumit Datta

推荐答案

我可能对此无济于事,因为它与c#无关,但是哎呀.

I probably shouldn't help you with this, because it's nothing to do with c#, but what the heck.

给出theta,h和w.

Given theta, h, and w.

边界矩形的高度将为H1 + H2.

The height of the bounding rectangle will be H1 + H2.

边界矩形的宽度将为W1 + W2.

The width of the bounding rectangle will be W1 + W2.

您可以使用简单的三角函数得出H1,H2,W1和W2.例如

You can work out H1, H2, W1, and W2 using simple trigonometry. For example,

cos(90-theta)= H1/w =>   H1 = w * cos(90-theta)

cos(90 - theta) = H1 / w   =>   H1 = w * cos(90 - theta)



这篇关于查找具有角度的边界矩形的尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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