(1,1)点绕(0,0)旋转
时间: 2023-10-10 13:16:00 浏览: 42
好的,那么点(1,1)绕点(0,0)逆时针旋转90度后的坐标是(-1,1)。计算过程如下:
1. 将点(1,1)沿着旋转中心点(0,0)平移,得到点(1-0,1-0)=(1,1);
2. 将点(1,1)绕原点旋转90度,得到点(-1,1);
3. 将点(-1,1)沿着旋转中心点(0,0)平移回原位置,得到点(-1+0,1+0)=(-1,1)。
因此,点(1,1)绕点(0,0)逆时针旋转90度后的坐标是(-1,1)。
相关问题
c# 求某点绕某点旋转1度后坐标
假设要求点P1(x1, y1)绕点P0(x0, y0)逆时针旋转1度后的坐标P2(x2, y2),可以按照以下步骤计算:
1. 将点P1(x1, y1)平移到原点,即:将x1, y1分别减去x0, y0,得到点P1`(x1`, y1`),其中,x1` = x1 - x0,y1` = y1 - y0。
2. 计算点P1`(x1`, y1`)绕原点逆时针旋转1度后的坐标P2`(x2`, y2`)。根据旋转变换的公式可以得到:
x2` = x1` * cos(a) - y1` * sin(a)
y2` = x1` * sin(a) + y1` * cos(a)
其中,a = 1 * pi / 180,即1度对应的弧度值。
3. 将点P2`(x2`, y2`)平移到点P0(x0, y0),即:将x2`, y2`分别加上x0, y0,得到点P2(x2, y2),其中,x2 = x2` + x0,y2 = y2` + y0。
综上所述,可以写出C#代码实现:
```
double x0 = ...; // P0的横坐标
double y0 = ...; // P0的纵坐标
double x1 = ...; // P1的横坐标
double y1 = ...; // P1的纵坐标
double a = 1 * Math.PI / 180; // 1度对应的弧度值
double x1_ = x1 - x0;
double y1_ = y1 - y0;
double x2_ = x1_ * Math.Cos(a) - y1_ * Math.Sin(a);
double y2_ = x1_ * Math.Sin(a) + y1_ * Math.Cos(a);
double x2 = x2_ + x0;
double y2 = y2_ + y0;
// 输出旋转后的坐标
Console.WriteLine("P2({0}, {1})", x2, y2);
```
其中,x0, y0, x1, y1分别表示点P0, P1的横纵坐标,可以根据实际情况进行替换。
qgraphicsview 一点绕另一点旋转
您好!针对您的问题,我理解您想实现qgraphicsview中某个点围绕另一个点进行旋转。您可以尝试使用QTransform类中的translate()和rotate()方法来实现。具体步骤如下:
1. 将视图的原点移动到旋转中心点,可以使用QTransform中的translate()方法实现。
2. 使用QTransform中的rotate()方法对视图进行旋转。
3. 将视图的原点移回到原来位置,同样可以使用QTransform中的translate()方法实现。
下面是一个示例代码,您可以参考一下:
```python
from PyQt5.QtCore import QPointF, QTransform
# 假设视图中心点为(0, 0),旋转中心点为(100, 100),旋转角度为30度
view_center = QPointF(0, 0)
rotate_center = QPointF(100, 100)
angle = 30
# 将视图原点移动到旋转中心点
translate1 = QTransform()
translate1.translate(rotate_center.x(), rotate_center.y())
transform = translate1
# 对视图进行旋转
rotate = QTransform()
rotate.rotate(angle)
transform = rotate * transform
# 将视图原点移回到原来位置
translate2 = QTransform()
translate2.translate(-rotate_center.x(), -rotate_center.y())
transform = translate2 * transform
# 应用变换
graphics_view.setTransform(transform)
```
希望能对您有所帮助!如有更多问题,请随时提出。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)