坐標轉換 計算機圖形學
什么是轉型? (What is Transformation?)
Transformation refers to the mathematical operations or rules that are applied on a graphical image consisting of the number of lines, circles, and ellipses to change its size, shape, or orientation. It can also reposition the image on the screen.
轉換是指應用于圖形圖像的數學運算或規則,這些圖形由線,圓和橢圓的數量組成,以更改其大小,形狀或方向。 它還可以將圖像重新放置在屏幕上。
Transformations play a very crucial role in computer graphics.
轉換在計算機圖形學中起著至關重要的作用。
轉換類型 (Types of Transformations)
There are various types of transformations in computer graphics through which an image can be processed, edited ad altered. Some basic and most commonly used types of these transformations are:
計算機圖形學中有各種類型的轉換,可以通過這些轉換來處理圖像,編輯和更改圖像。 這些轉換的一些基本且最常用的類型是:
Translation
翻譯
Rotation
回轉
Scaling
縮放比例
Reflection
反射
Shearing
剪力
翻譯 (Translation)
Translation refers to a technique in which a point is shift from one place to another, whose distance is known.
翻譯是指一種技術,在該技術中,一個點從一個位置移動到另一個位置,該位置的距離是已知的。
Consider a point A(x1, y1) be shifted to another point B (x2, y2). Now we only know the shifting distance tx along x-axis and ty along y-axis.
考慮將點A(x 1 ,y 1 )移到另一個點B(x 2 ,y 2 )。 現在我們只知道沿x軸和叔?沿y軸的換檔距離t X。
Now, the new coordinates (x2, y2) can be calculated as:
現在,新的坐標(x 2 ,y 2 )可以計算為:
x2 = x1 + tx
x 2 = x 1 + t x
y2 = y1 + ty
y 2 = y 1 + t y
For example:
例如:
Suppose we want to shift a point with coordinates at A(30,100) and distance along x-axis is 10 units and 20 units along y-axis.
假設我們要移動一個坐標為A(30,100)的點,并且沿x軸的距離為10個單位,沿y軸的距離為20個單位。
Using translation:
使用翻譯:
Here tx = 10 ;
這里t x = 10;
and ty = 20
且y = 20
New coordinates A’ (x2, y2):
新坐標A ' (x 2 ,y 2 ):
x2 = 30 + 10 = 130
x 2 = 30 + 10 = 130
y2 = 100 + 20 = 120
y 2 = 100 + 20 = 120
The point will be shifted to A’ (130, 120 ).
該點將移至A ' (130,120)。
回轉 (Rotation)
Rotation refers to mathematical operation in which the graphical object is rotated about an angle (θ) to the axis.
旋轉是指數學操作,其中圖形對象相對于軸旋轉角度(θ)。
Rotation is of two types: anti-clockwise and clockwise rotation.
旋轉有兩種類型:逆時針旋轉和順時針旋轉。
Suppose we want to rotate a point with coordinates A (x1, y1) clockwise through an angle θ about the origin
假設我們要繞著原點將坐標A(x 1 ,y 1 )的點順時針旋轉角度θ
Then the new coordinates A’ (x2, y2):
然后,新坐標A ' (x 2 ,y 2 ):
x2 = x1 cosθ + y1 sinθ
×2 = X 1 +COSθY 1SINθ
y2 = x1 sinθ - y1 cosθ
Y 2 = X 1SINθ - Y 1個 COSθ
縮放比例 (Scaling)
Scaling refers to a mathematical rule applied to change the size of the image.
縮放是指用于更改圖像大小的數學規則。
If the value of scaling factors is negative, the size is decreased and when the value is positive, the size of the image is increased.
如果縮放因子的值為負,則減小大小,而當值為正時,增大圖像的大小。
Suppose the point with coordinates A (x1, y1) is to be scaled by a factor sx along the x-axis and sy along the y-axis.
假設坐標為A(x 1, y 1 )的點沿x軸縮放系數s x,沿y軸縮放y。
Hence the new coordinates after scaling will be:
因此,縮放后的新坐標將為:
x2 = x1 x sx
x 2 = x 1 xs x
y2 = y1 x sy
y 2 = y 1 xs y
Translation, rotation and scaling are termed as basic translations.
平移,旋轉和縮放稱為基本平移。
其他轉變 (Other Transformations)
The other two transformation techniques are as follows,
其他兩種轉換技術如下:
反射 (Reflection)
Reflection refers to the mirror image of the original graphical object. It is an 180o rotation operation.
反射是指原始圖形對象的鏡像。 這是一個180 o的旋轉操作。
Reflection can be done about following ways:
可以通過以下方式進行反思:
x-axis
X軸
y-axis
y軸
the origin and
起源和
A plane perpendicular to the origin
垂直于原點的平面
剪力 (Shearing)
Shearing is a transformation in which the shape of the object is slanted about the axis.
剪切是一種變換,其中對象的形狀圍繞軸傾斜。
In y-shearing:
在y剪切中:
The new-coordinates will be:
新的坐標將是:
x' = x
X' = x
y' = y + sy x
' = y + s y x
In x-shearing:
在x剪切中:
The new-coordinates will be:
新的坐標將是:
x' = x + sx y
x ' = x + s x y
y' = y
y'= y
翻譯自: https://www.includehelp.com/computer-graphics/types-of-transformations.aspx
坐標轉換 計算機圖形學