“变换”和“仿射变换”之间的区别在哪里?

时间:2023-02-09 10:58:39

There is a function like:

有一个功能,如:

CATransform3DGetAffineTransform

Returns the affine transform represented by 't'. If 't' can not be exactly represented as an affine transform the returned value is undefined.

返回由't'表示的仿射变换。如果't'不能精确表示为仿射变换,则返回值是未定义的。

I'm not so math-orientated, so a easy to understand description would be very nice. Wikipedia was no big help here.

我不是那么以数学为导向,所以一个易于理解的描述会非常好。*在这里没什么大不了的。

3 个解决方案

#1


Affine transformations are transformations that do not "overly distort" your geometry in the sense that:

仿射变换是在以下意义上不会“过度扭曲”几何形状的变换:

  • points that lay on a line before still lie on a line after the transformation
  • 在转换之后仍然躺在一条线上之前在一条线上的点

  • the relative distances between points stay the same (so a square might not be square anymore, but still has equal side lengths)
  • 点之间的相对距离保持不变(因此正方形可能不再是正方形,但仍具有相等的边长)

So rotation and scaling are affine - projection, for example, is not.

因此,旋转和缩放是仿射的 - 例如,投影不是。

#2


Affine transformations are transformations, but transformations need not be Affine. For example, a shear of the plane is not Affine because it doesn't send lines to lines.

仿射变换是转换,但转换不一定是仿射。例如,平面的剪切不是Affine,因为它不会向线发送线。

Affine transformations are by definition those transformations that preserve ratios of distances and send lines to lines (preserving "colinearity"). In finite-dimensional Euclidean geometry, these act by a linear transformation followed by a translation i.e. x -> Ax + b where x is a vector, A is a linear transformation and b is a vector.

仿射变换根据定义是那些保持距离比率并将线发送到线(保持“共线性”)的变换。在有限维欧几里德几何中,这些通过线性变换,然后是平移,即x - > Ax + b,其中x是矢量,A是线性变换,b是矢量。

Affine transformations are great for changing co-ordinate systems, perhaps from one that is fairly hard to visualise back to the usual co-ordinates.

仿射变换对于改变坐标系统非常有用,可能从一个相当难以可视化回归到通常坐标的系统。

The Affine transformations you're likely to come across in practice are translations, dilation (i.e. scaling), rotation and reflection. If you're developing for iOS, say, check out the CGAffineTransform sections of the developer documentation. These will explain how to create Affine transformations using several convenience methods, and how to apply these to UIView instances with the -setTransform message.

您在实践中可能遇到的仿射变换是平移,扩张(即缩放),旋转和反射。如果您正在为iOS开发,请查看开发人员文档的CGAffineTransform部分。这些将解释如何使用几种便捷方法创建仿射变换,以及如何使用-setTransform消息将这些方法应用于UIView实例。

Last, an important point about Affine transformations is that they're not commutative under composition: Applying transform T1 followed by transform T2 is in general different from applying T2 followed by T1. That is, the order in which you apply these matters.

最后,关于仿射变换的一个重要观点是它们在组合下不是可交换的:应用变换T1然后变换T2通常不同于应用T2后跟T1。也就是说,您应用这些事项的顺序。

#3


CoreAnimation uses 3D transforms. Affine transforms are a 2D subset of those 3D transforms. They allow only translation, rotation and scaling in X,Y plan.

CoreAnimation使用3D变换。仿射变换是这些3D变换的2D子集。它们只允许在X,Y平面中进行平移,旋转和缩放。

#1


Affine transformations are transformations that do not "overly distort" your geometry in the sense that:

仿射变换是在以下意义上不会“过度扭曲”几何形状的变换:

  • points that lay on a line before still lie on a line after the transformation
  • 在转换之后仍然躺在一条线上之前在一条线上的点

  • the relative distances between points stay the same (so a square might not be square anymore, but still has equal side lengths)
  • 点之间的相对距离保持不变(因此正方形可能不再是正方形,但仍具有相等的边长)

So rotation and scaling are affine - projection, for example, is not.

因此,旋转和缩放是仿射的 - 例如,投影不是。

#2


Affine transformations are transformations, but transformations need not be Affine. For example, a shear of the plane is not Affine because it doesn't send lines to lines.

仿射变换是转换,但转换不一定是仿射。例如,平面的剪切不是Affine,因为它不会向线发送线。

Affine transformations are by definition those transformations that preserve ratios of distances and send lines to lines (preserving "colinearity"). In finite-dimensional Euclidean geometry, these act by a linear transformation followed by a translation i.e. x -> Ax + b where x is a vector, A is a linear transformation and b is a vector.

仿射变换根据定义是那些保持距离比率并将线发送到线(保持“共线性”)的变换。在有限维欧几里德几何中,这些通过线性变换,然后是平移,即x - > Ax + b,其中x是矢量,A是线性变换,b是矢量。

Affine transformations are great for changing co-ordinate systems, perhaps from one that is fairly hard to visualise back to the usual co-ordinates.

仿射变换对于改变坐标系统非常有用,可能从一个相当难以可视化回归到通常坐标的系统。

The Affine transformations you're likely to come across in practice are translations, dilation (i.e. scaling), rotation and reflection. If you're developing for iOS, say, check out the CGAffineTransform sections of the developer documentation. These will explain how to create Affine transformations using several convenience methods, and how to apply these to UIView instances with the -setTransform message.

您在实践中可能遇到的仿射变换是平移,扩张(即缩放),旋转和反射。如果您正在为iOS开发,请查看开发人员文档的CGAffineTransform部分。这些将解释如何使用几种便捷方法创建仿射变换,以及如何使用-setTransform消息将这些方法应用于UIView实例。

Last, an important point about Affine transformations is that they're not commutative under composition: Applying transform T1 followed by transform T2 is in general different from applying T2 followed by T1. That is, the order in which you apply these matters.

最后,关于仿射变换的一个重要观点是它们在组合下不是可交换的:应用变换T1然后变换T2通常不同于应用T2后跟T1。也就是说,您应用这些事项的顺序。

#3


CoreAnimation uses 3D transforms. Affine transforms are a 2D subset of those 3D transforms. They allow only translation, rotation and scaling in X,Y plan.

CoreAnimation使用3D变换。仿射变换是这些3D变换的2D子集。它们只允许在X,Y平面中进行平移,旋转和缩放。