计算机图形学矩阵变换_计算机图形学中的变换类型(反射和剪切)

本文介绍了计算机图形学中的反射和剪切两种矩阵变换。反射是对象关于某轴的镜像,对象大小不变。文章通过实例展示了如何计算X轴反射后三角形顶点的新坐标。剪切则是改变物体形状的变形,可以沿X、Y或XY方向进行。同样以三角形为例,解释了剪切参数如何影响顶点坐标。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

计算机图形学矩阵变换

反射 (Reflection)

The reflection is just like the mirror image of the original image. The mirror image can be either about the x-axis or the y-axis. In the reflection process, the size of the object does not change. We can also say that the reflection is a kind of rotation where the angle of rotation is 180 degrees, while the reflected object is always formed on the other side of the mirror and the size of the reflected image is the same as the size of the original image.

反射就像原始图像的镜像一样。 镜像可以围绕x轴或y轴。 在反射过程中,对象的大小不会改变。 我们也可以说反射是旋转角度为180度的一种旋转,而反射对象总是形成在镜子的另一侧,并且反射图像的大小与反射镜的大小相同。原始图像。

We can see reflection of object in these four ways:

我们可以通过以下四种方式看到对象的反射:

  • Reflection along X-axis

    沿X轴反射

  • Reflection along Y-axis

    沿Y轴反射

  • Reflection along the line(x=y)

    沿线反射(x = y)

  • Reflection perpendicular to XY-axis

    垂直于XY轴的反射

Now let us understand reflection with the help of an example,

现在让我们借助示例来了解反思,

Example:

例:

Problem Statement: Given a triangle with coordinate points A (3, 4), B (6, 4), C (5, 6). Apply the reflection on the X-axis and obtain the new coordinates of the object.

问题陈述:给定一个具有坐标点A(3,4)B(6,4)C(5,6 )的三角形。 在X轴上应用反射,并获得对象的新坐标。

Solution:

解:

Given -

鉴于-

  • Old corner coordinates of the triangle = A (3, 4), B (6, 4), C (5, 6)

    三角形的旧角坐标= A(3,4),B(6,4),C(5,6)

  • Reflection has to be taken on the X-axis

    必须在X轴上进行反射

For the co-ordinates A (3, 4)

对于坐标A(3,4)

Let the new co-ordinates of corner A after reflection be = (Xnew, Ynew).

令反射后角A的新坐标为=(X new ,Y new )。

When we apply the reflection equations, we get:

当我们应用反射方程式时,我们得到:

Xnew = Xold = 3

Xnew = X = 3

Ynew = -Yold = -4

Y = -Y = -4

Thus, the new co-ordinates of corner A after reflection is = (3, -4).

因此,反射后角A的新坐标为=(3,-4)。

For the co-ordinates B (6, 4)

对于坐标B(6,4)

Let the new co-ordinates of corner B after reflection be = (Xnew, Ynew).

令反射后角B的新坐标为=(X new ,Y new )。

When we apply the reflection equations, we get-

当我们应用反射方程式时,我们得到-

Xnew = Xold = 6

X = X = 6

Ynew = -Yold = -4

Y = -Y = -4

Thus, the new co-ordinates of corner B after reflection is = (6, -4).

因此,反射后角B的新坐标为=(6,-4)。

For the co-ordinates C (5, 6)

对于坐标C(5,6)

Let the new coordinates of corner C after reflection be = (Xnew, Ynew).

令反射后角C的新坐标为=(X new ,Y new )。

When we apply the reflection equations, we get-

当我们应用反射方程式时,我们得到-

Xnew = Xold = 5

X = X = 5

Ynew = -Yold = -6

Y = -Y = -6

Thus, the new co-ordinates of corner C after reflection is = (5, -6).

因此,反射后角C的新坐标为=(5,-6)。

Thus, the new co-ordinates of the triangle after reflection will be = A (3, -4), B (6, -4), C (5, -6).

因此,反射后三角形的新坐标将为= A(3,-4),B(6,-4),C(5,-6)。

剪力 (Shearing)

Shearing is the transformation of an object which changes the shape of the object. The shearing can be in one direction or two directions. It is an ideal technique to change the shape of an existing figure. The sliding of layers of the object occurs while doing the same. Shearing can be done in three ways,

剪切是物体的变形,它改变了物体的形状。 剪切可以在一个方向或两个方向上。 更改现有图形的形状是一种理想的技术。 进行相同操作时会发生对象层的滑动。 剪切可以通过三种方式完成,

  • Shearing in the X-direction

    X方向的剪切

  • Shearing in the Y-direction

    Y方向的剪切

  • Shearing in the X-Y direction

    XY方向的剪切

Shearing in X axis can be done using this equation,

可以使用以下公式完成X轴的剪切,

  • Xnew = Xold + Shx x Yold

    X = X + Sh x x Y

  • Ynew = Yold

    Y = Y

Shearing in Y axis can be done using this equation,

可以使用以下公式完成Y轴的剪切,

  • Xnew = Xold

    X = X

  • Ynew = Yold + Shy x Xold

    Y = Y + Sh y x X

Now let us understand shearing more clearly with the help of an example,

现在让我们借助示例更清楚地了解剪切

Example:

例:

Problem Statement: Given a triangle with points A (1, 1), B (0, 0) and C (1, 0). You need to apply shear parameter 2 on the X-axis and 2 on Y-axis and find out the new coordinates of the object.

问题陈述:给定一个三角形,它具有点A(1,1)B(0,0)C(1,0) 。 您需要在X轴上应用剪切参数2,在Y轴上应用剪切参数2,以找到对象的新坐标。

Solution:

解:

Given-

鉴于-

  • Old corner co-ordinates of the triangle = A (1, 1), B(0, 0), C(1, 0)

    三角形的旧角坐标= A(1,1),B(0,0),C(1,0)

  • Shearing parameter towards X-direction (Shx) = 2, Y direction (Shy) = 2

    X方向(Sh x )= 2的剪切参数,Y方向(Sh y )= 2的剪切参数

Shearing in X Axis

X轴剪切

For the co-ordinates A (1, 1):

对于坐标A(1,1):

Let the new co-ordinates of corner A after shearing be = (Xnew, Ynew).

设剪切后角A的新坐标为=(X new ,Y new )。

When we apply the shearing equations, we get-

当我们应用剪切方程时,我们得到-

  • Xnew= Xold + Shx x Yold = 1 + 2 x 1 = 3

    X = X + Sh x x X = 1 + 2 x 1 = 3

  • Ynew= Yold = 1

    Y = Y = 1

Thus, the new co-ordinates of corner A after shearing is = (3, 1).

因此,剪切后角A的新坐标为=(3,1)。

For the co-ordinates B (0, 0):

对于坐标B(0,0):

Let the new co-ordinates of corner B after shearing be = (Xnew, Ynew).

设剪切后角B的新坐标为=(X new ,Y new )。

When we apply the shearing equations, we get-

当我们应用剪切方程时,我们得到-

  • Xnew= Xold + Shx x Yold = 0 + 2 x 0 = 0

    X = X + Sh x x Y = 0 + 2 x 0 = 0

  • Ynew= Yold = 0

    Y = Y = 0

Thus, the new co-ordinates of corner B after shearing is = (0, 0).

因此,剪切后角B的新坐标为=(0,0)。

For the co-ordinates C (1, 0)

对于坐标C(1、0)

Let the new co-ordinates of corner C after shearing be = (Xnew, Ynew).

设剪切后角C的新坐标为=(X new ,Y new )。

When we apply the shearing equations, we get-

当我们应用剪切方程时,我们得到-

  • Xnew= Xold + Shx x Yold = 1 + 2 x 0 = 1

    X = X + Sh x x Y = 1 + 2 x 0 = 1

  • Ynew= Yold = 0

    Y = Y = 0

Thus, the new co-ordinates of corner C after shearing is = (1, 0).

因此,剪切后角C的新坐标为=(1,0)。

Thus, the new co-ordinates of the after shearing in X axis = A (3, 1), B (0, 0), C (1, 0).

因此,X轴上剪切后的新坐标= A(3,1),B(0,0),C(1,0)。

Shearing in Y Axis

Y轴剪切

For the co-ordinates A (1, 1)

对于坐标A(1,1)

Let the new coordinates of corner A after shearing be = (Xnew, Ynew).

设剪切后角A的新坐标为=(X new ,Y new )。

When we apply the shearing equations, we get-

当我们应用剪切方程时,我们得到-

  • Xnew= Xold = 1

    X = X = 1

  • Ynew= Yold + Shy x Xold = 1 + 2 x 1 = 3

    Y = Y + Sh y x X = 1 + 2 x 1 = 3

Thus, the new co-ordinates of corner A after shearing is = (1, 3).

因此,剪切后角A的新坐标为=(1,3)。

For the co-ordinates B (0, 0)

对于坐标B(0,0)

Let the new co-ordinates of corner B after shearing be = (Xnew, Ynew).

设剪切后角B的新坐标为=(X new ,Y new )。

When we apply the shearing equations, we get-

当我们应用剪切方程时,我们得到-

  • Xnew= Xold = 0

    X = X = 0

  • Ynew= Yold + Shy x Xold = 0 + 2 x 0 = 0

    Y = Y + Sh y x X = 0 + 2 x 0 = 0

Thus, the new co-ordinates of corner B after shearing is = (0, 0).

因此,剪切后角B的新坐标为=(0,0)。

For the co-ordinates C (1, 0)

对于坐标C(1、0)

Let the new co-ordinates of corner C after shearing be = (Xnew, Ynew).

设剪切后角C的新坐标为=(X new ,Y new )。

When we apply the shearing equations, we get-

当我们应用剪切方程时,我们得到-

  • Xnew= Xold = 1

    X = X = 1

  • Ynew= Yold + Shy x Xold = 0 + 2 x 1 = 2

    Y = Y + Sh y x X = 0 + 2 x 1 = 2

Thus, new co-ordinates of corner C after shearing is = (1, 2). 

因此,剪切后角C的新坐标为=(1、2)。

Thus, the new co-ordinates of the triangle after shearing in Y axis is = A (1, 3), B (0, 0), C (1, 2).

因此,三角形在Y轴上剪切后的新坐标为= A(1、3),B(0、0),C(1、2)。

翻译自: https://www.includehelp.com/computer-graphics/types-of-transformations-reflection-and-shearing.aspx

计算机图形学矩阵变换

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值